diff --git a/app/routes/auth_routes.py b/app/routes/auth_routes.py index 4164b70..8046879 100644 --- a/app/routes/auth_routes.py +++ b/app/routes/auth_routes.py @@ -22,7 +22,7 @@ def login(): flash('Invalid Credentials', 'warning') - return render_template('login.html') + return render_template('user_auth/login.html') @auth_bp.route('/logout') @login_required diff --git a/app/static/css/recipe_form.css b/app/static/css/recipe_form.css new file mode 100644 index 0000000..6cc8e0a --- /dev/null +++ b/app/static/css/recipe_form.css @@ -0,0 +1,50 @@ +.directions-section { + margin-bottom: 20px; +} + +.direction-row { + display: flex; + align-items: flex-start; + margin-bottom: 10px; +} + +.direction-step-number { + width: 30px; + font-size: 1.5rem; + margin-right: 10px; +} + +.direction-input { + flex: 1; + padding: 8px; + border: 1px solid #ccc; + border-radius: 4px; + resize: vertical; + min-height: 50px; +} + +.remove-direction-btn { + background-color: #e74c3c; + color: white; + border: none; + padding: 8px 12px; + margin-left: 10px; + cursor: pointer; + border-radius: 4px; +} + +.add-direction-btn { + background-color: #3498db; + color: white; + border: none; + padding: 10px 20px; + cursor: pointer; + border-radius: 4px; +} + +.recipe-image { + max-width: 100%; + height: auto; + border-radius: 8px; + margin-bottom: 15px; +} \ No newline at end of file diff --git a/app/static/js/recipe_form.js b/app/static/js/recipe_form.js new file mode 100644 index 0000000..f5b6e1c --- /dev/null +++ b/app/static/js/recipe_form.js @@ -0,0 +1,56 @@ +document.addEventListener('DOMContentLoaded', function () +{ + const ingredientsList = document.getElementById('ingredients-list'); + const addIngredientBtn = document.getElementById('add-ingredient-btn'); + const directionsList = document.getElementById('directions-list'); + const addDirectionBtn = document.getElementById('add-direction-btn'); + + addIngredientBtn.addEventListener('click', function () + { + const ingredientRow = document.createElement('div'); + ingredientRow.classList.add('ingredient-row'); + + ingredientRow.innerHTML = ` + + + `; + + ingredientsList.appendChild(ingredientRow); + + // Add event listener to the remove button + ingredientRow.querySelector('.remove-ingredient-btn').addEventListener('click', function () + { + ingredientsList.removeChild(ingredientRow); + }); + }); + + addDirectionBtn.addEventListener('click', function () + { + const directionCount = directionsList.children.length + 1; + const directionRow = document.createElement('div'); + directionRow.classList.add('direction-row'); + + directionRow.innerHTML = ` +
${directionCount}
+ + + `; + + directionsList.appendChild(directionRow); + + // Add event listener to the remove button + directionRow.querySelector('.remove-direction-btn').addEventListener('click', function () + { + directionsList.removeChild(directionRow); + updateStepNumbers(); + }); + }); + + function updateStepNumbers() + { + document.querySelectorAll('.direction-step-number').forEach((step, index) => + { + step.textContent = index + 1; + }); + } +}); diff --git a/app/templates/base.html b/app/templates/base.html index fcf1308..980a764 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -5,11 +5,15 @@ - {% block title %} - SpiceShare{% endblock %} + <title> + {% block title %} + {{title}} | SpiceShare + {% endblock %} + +