diff options
author | root <root@vagrantz.xyz> | 2021-04-06 10:57:50 +0000 |
---|---|---|
committer | root <root@vagrantz.xyz> | 2021-04-06 10:57:50 +0000 |
commit | 8170d5bc0544fbc02155b8b57751cd1dec33dd69 (patch) | |
tree | d5cffb086fe6d5585c1e00ea5d5d2d907e6d2cd6 /views/recipe/edit.ejs |
Diffstat (limited to 'views/recipe/edit.ejs')
-rw-r--r-- | views/recipe/edit.ejs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/views/recipe/edit.ejs b/views/recipe/edit.ejs new file mode 100644 index 0000000..d72b3e4 --- /dev/null +++ b/views/recipe/edit.ejs @@ -0,0 +1,71 @@ +<%- include('../partials/header') %> +<%- include('../partials/nav') %> + +<div class='content'> + <%- include('../partials/categories') %> + <div class='main'> + <div class='editCard'> + <h4 style='text-align: center'>Edit Recipe Details and Ingredients</h4> + <form id='createForm' action="/recipe/<%= recipe._id %>?_method=PUT" method='POST'> + <label for="">Title:</label> + <input type="text" name='recipe[title]' value='<%= recipe.title %>'> + <label for="">Image:</label> + <a href='/recipe/image/upload'>Upload image</a> + <% if(files) { %> + <select id="" name="recipe[picture]"> + <option value='<%= recipe.picture %>' selected disabled> <%= recipe.picture %> + <% files.map(f => { %> + <option value='<%= f %>'><%= f %></option> + <% }) %> + </select> + <% } %> + <label for="">Category:</label> + <input type="text" name='recipe[category]' value='<%= recipe.category %>'> + <label for="">Ingredients:</label> + <input type="text" name='recipe[ingridients]' value='<%= recipe.ingridients %>'> + <label for="">Number of steps:</label> + <div class='stepControl'> + <input id='stpnum' type="number" value='<%= recipe.steps.length %>' name='recipe[nsteps]'> + </div> + <button id='sub' type="submit">Edit</button> + </form> + </div> + <div class='stepsToEd'> + <h4>Instructions (<%= recipe.steps.length %> steps)</h4> + <% recipe.steps.map(s => { %> + <div class='stepToEd' style='display: flex; padding: 0'> + <div style='display:flex; flex-direction: column; width: 100%;'> + <h5>Step <%= s.number %>:</h5> + <p><%= s.step %></p> + </div> + <div class='edtr' style="display: flex; flex-direction: column; align-items: right; justify-content: center; margin: 0; padding: 0"> + <form action="/recipe/<%= recipe._id %>/step/<%= s._id %>/edit" onclick="(e) => e.preventDefult()"> + <button class='editStpBtns' style='margin: 0; padding: .25rem'> + <i class='fas fa-edit'></i> + </button> + </form> + <form action="/recipe/<%= recipe._id %>/step/<%= s._id %>?_method=DELETE" method='POST'> + <button class='editStpBtns' style='margin: 0; padding: .25rem'> + <i class='fas fa-trash'></i> + </button> + </form> + </div> + </div> + <% }) %> + </div> + <form style='margin-top: 0;' id='createForm' action="/recipe/<%= recipe._id %>/step/create"> + <button id='addStep'>Add a step</button> + </form> + </div> + <%- include('../partials/popular') %> +</div> + +<script type='text/javascript'> + const prevent = (e) => { + e.preventDefault(); + } +</script> + +<%- include('../partials/magicCats') %> +<%- include('../partials/magicPops') %> +<%- include('../partials/footer') %> |