summaryrefslogtreecommitdiff
path: root/views/recipe/show.ejs
blob: 9fcc771f7f77aa02ffd43fea5157a2ad300dd749 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<%- include('../partials/header') %> 
<%- include('../partials/nav') %> 

<div class='content'>
    <%- include('../partials/categories') %>
    <div class='main'>
        <h4 style='text-align: center'><%= recipe.title %>,
         by <a  style='text-decoration: none;' href="/account/<%= recipe.author.id %>">
            <em><%= recAuthor.bio.name %></em></a>
        </h4>
        <div class='recIngImg'>
            <div class='savImg'>
                <img src="/images/<%= recipe.author.username %>/<%= recipe.picture %>" alt="recipe" style='max-width: 25rem'>
                <% if(usr) { %>
                    <% if(account.favorites.includes(recipe._id)) { %>
                        <form class='saveRecForm' action="/recipe/<%= recipe._id %>/unsave?_method=PUT" method='POST'>
                            <button id='saveBtn'>Saved</button>
                        </form>
                    <% } else { %>
                        <form class='saveRecForm' action="/recipe/<%= recipe._id %>/save?_method=PUT" method='POST'>
                            <button id='saveBtn'>Save</button>
                        </form>
                    <% } %>
                <% } %>
            </div>
            <div class='Ing'>
                <h5>Ingredients:</h5>
                <ul>
                    <% ingridients.map(i => { %>
                        <li><%= i %></li>
                    <% }) %>
                </ul>
            </div>
        </div>
        <p class='category'><span>
            <a style='text-decoration: none;' href="/categories/<%= recipe.category.toLowerCase() %>">
                <%= recipe.category %>
            </a>
        </span></p>
        <div class='steps'>
            <h4>Instructions (<%= recipe.steps.length %> steps)</h4>
            <% recipe.steps.map(s => { %>
                <div>
                    <h5>Step <%= s.number %>:</h5>
                    <p><%= s.step %></p>
                </div>
            <% }) %>
        </div>
    </div>
    <%- include('../partials/popular') %> 
</div>

<%- include('../partials/magicCats') %>
<%- include('../partials/magicPops') %>
<%- include('../partials/footer') %>