diff --git a/application/recipes/__pycache__/recipes_api.cpython-313.pyc b/application/recipes/__pycache__/recipes_api.cpython-313.pyc index 152fcf9..932a1a2 100644 Binary files a/application/recipes/__pycache__/recipes_api.cpython-313.pyc and b/application/recipes/__pycache__/recipes_api.cpython-313.pyc differ diff --git a/application/recipes/recipes_api.py b/application/recipes/recipes_api.py index 9fa48ab..6846454 100644 --- a/application/recipes/recipes_api.py +++ b/application/recipes/recipes_api.py @@ -26,6 +26,7 @@ def recipes(): def recipe(id, mode='view'): units = database_recipes.getUnits() print("woot") + print(session) if mode == "edit": return render_template("recipe_edit.html", recipe_id=id, current_site=session['selected_site'], units=units) if mode == "view": diff --git a/application/recipes/sql/getRecipeByID.sql b/application/recipes/sql/getRecipeByID.sql index 88982b8..c7b5669 100644 --- a/application/recipes/sql/getRecipeByID.sql +++ b/application/recipes/sql/getRecipeByID.sql @@ -1,7 +1,7 @@ WITH passed_id AS (SELECT %s AS passed_id), cte_recipe_items AS ( SELECT items.*, - COALESCE(%%site_name%%_items.barcode, items.uuid) AS uuid, + /*COALESCE(%%site_name%%_items.barcode, items.uuid) AS uuid,*/ (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=%%site_name%%_item_info.uom) AS item_uom, COALESCE(%%site_name%%_items.item_name, items.item_name) AS item_name, COALESCE(%%site_name%%_items.links, items.links) AS links, diff --git a/application/recipes/static/js/recipeEditHandler.js b/application/recipes/static/js/recipeEditHandler.js index 86f5072..32fc161 100644 --- a/application/recipes/static/js/recipeEditHandler.js +++ b/application/recipes/static/js/recipeEditHandler.js @@ -1,23 +1,3 @@ -var mode = false -async function toggleDarkMode() { - let darkMode = document.getElementById("dark-mode"); - darkMode.disabled = !darkMode.disabled; - mode = !mode; - if(mode){ - document.getElementById('modeToggle').innerHTML = "light_mode" - document.getElementById('main_html').classList.add('uk-light') - - } else { - document.getElementById('modeToggle').innerHTML = "dark_mode" - document.getElementById('main_html').classList.remove('uk-light') - } -} - - -if(session.user.flags.darkmode){ - toggleDarkMode() -} - // Beginning of site specific code! var recipe = []; document.addEventListener('DOMContentLoaded', async function() { diff --git a/application/recipes/static/js/recipeViewHandler.js b/application/recipes/static/js/recipeViewHandler.js index 1ac534f..e4165ce 100644 --- a/application/recipes/static/js/recipeViewHandler.js +++ b/application/recipes/static/js/recipeViewHandler.js @@ -1,22 +1,3 @@ -var mode = false -async function toggleDarkMode() { - let darkMode = document.getElementById("dark-mode"); - darkMode.disabled = !darkMode.disabled; - mode = !mode; - if(mode){ - document.getElementById('modeToggle').innerHTML = "light_mode" - document.getElementById('main_html').classList.add('uk-light') - - } else { - document.getElementById('modeToggle').innerHTML = "dark_mode" - document.getElementById('main_html').classList.remove('uk-light') - } -} - -if(session.user.flags.darkmode){ - toggleDarkMode() -} - // Beginning of site specific code! var recipe = []; document.addEventListener('DOMContentLoaded', async function() { diff --git a/application/recipes/static/js/recipesListHandler.js b/application/recipes/static/js/recipesListHandler.js index d5372c7..4bc06a2 100644 --- a/application/recipes/static/js/recipesListHandler.js +++ b/application/recipes/static/js/recipesListHandler.js @@ -1,22 +1,3 @@ -var mode = false -async function toggleDarkMode() { - let darkMode = document.getElementById("dark-mode"); - darkMode.disabled = !darkMode.disabled; - mode = !mode; - if(mode){ - document.getElementById('modeToggle').innerHTML = "light_mode" - document.getElementById('main_html').classList.add('uk-light') - } else { - document.getElementById('modeToggle').innerHTML = "dark_mode" - document.getElementById('main_html').classList.remove('uk-light') - } -} - - -if(session.user.flags.darkmode){ - toggleDarkMode() -} - async function changeSite(site){ console.log(site) const response = await fetch(`/changeSite`, { diff --git a/application/recipes/templates/recipe_edit.html b/application/recipes/templates/recipe_edit.html index c1b1d93..27d19a7 100644 --- a/application/recipes/templates/recipe_edit.html +++ b/application/recipes/templates/recipe_edit.html @@ -16,13 +16,18 @@ - - + {% if session['user']['flags']['darkmode'] %} + + {% endif %} - + {% if session['user']['flags']['darkmode'] %} + + {% else %} + + {% endif %}