From e0ef5b02618a4474a3cad6d55d35c1476e82c844 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 30 May 2022 11:35:19 +0200 Subject: [PATCH] Basic navigation --- js/defaults_dialog.js | 34 ++++++++++++++- js/defaults_dialog_entries.js | 2 +- main.html | 78 ++++++++++++++++++++--------------- src/css/defaults_dialog.css | 17 +++++++- wizard/buttons.html | 8 ++++ wizard/filters.html | 1 + wizard/gps.html | 1 + wizard/outputs.html | 1 + wizard/pids.html | 1 + wizard/receiver.html | 1 + 10 files changed, 107 insertions(+), 37 deletions(-) create mode 100644 wizard/buttons.html create mode 100644 wizard/filters.html create mode 100644 wizard/gps.html create mode 100644 wizard/outputs.html create mode 100644 wizard/pids.html create mode 100644 wizard/receiver.html diff --git a/js/defaults_dialog.js b/js/defaults_dialog.js index 27c465ef..64009317 100644 --- a/js/defaults_dialog.js +++ b/js/defaults_dialog.js @@ -37,20 +37,48 @@ helper.defaultsDialog = (function (data) { } }; + privateScope.saveWizardStep = function (selectedDefaultPreset, wizardStep) { + //TODO add saving logic + + privateScope.wizard(selectedDefaultPreset, wizardStep + 1); + }; + privateScope.wizard = function (selectedDefaultPreset, wizardStep) { const steps = selectedDefaultPreset.wizardPages; const stepsCount = selectedDefaultPreset.wizardPages.length; const stepName = steps[wizardStep]; - + console.log(steps[wizardStep], wizardStep, stepsCount); - if (wizardStep >= stepsCount) { + if (wizardStep >= stepsCount - 1) { //This is the last step, time to finalize + $container.hide(); privateScope.saveAndReboot(); } else { + const $content = $container.find('.defaults-dialog__wizard'); + $.get("./wizard/" + stepName + ".html", function(data) { + $content.html(data); + }); + $.get("./wizard/buttons.html", function(data) { + $(data).appendTo($content); + }); + + $container.on('click', '#wizard-next', function () { + privateScope.saveWizardStep(selectedDefaultPreset, wizardStep); + }); + + $container.on('click', '#wizard-skip', function () { + privateScope.wizard(selectedDefaultPreset, wizardStep + 1); + }); + + $container.find('.defaults-dialog__content').hide(); + $container.find('.defaults-dialog__wizard').show(); + + savingDefaultsModal.close(); + $container.show(); } @@ -150,6 +178,8 @@ helper.defaultsDialog = (function (data) { }; privateScope.render = function () { + $container.find('.defaults-dialog__content').show(); + $container.find('.defaults-dialog__wizard').hide(); let $place = $container.find('.defaults-dialog__options'); $place.html(""); for (let i in data) { diff --git a/js/defaults_dialog_entries.js b/js/defaults_dialog_entries.js index 9336e27f..78ae7ce4 100644 --- a/js/defaults_dialog_entries.js +++ b/js/defaults_dialog_entries.js @@ -6,7 +6,7 @@ helper.defaultsDialogData = [{ "notRecommended": false, "reboot": true, "mixerToApply": 3, - "wizardPages": ['receiver', 'motors', 'gps', 'filter', 'pid'], + "wizardPages": ['receiver', 'outputs', 'gps', 'filters', 'pids'], "settings": [ { key: "model_preview_type", diff --git a/main.html b/main.html index 71da7b46..8d7689ab 100755 --- a/main.html +++ b/main.html @@ -16,8 +16,12 @@
@@ -42,38 +46,39 @@
-
+
+ +
@@ -92,10 +97,10 @@
+ + + +
@@ -104,10 +109,10 @@
+ + + +
@@ -173,13 +178,16 @@
  • - +
  • - +
  • - +