summaryrefslogtreecommitdiff
path: root/views/recipe/create.ejs
blob: a6921a80dcc4404f6e485f34fdc84933500724cc (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
<%- include('../partials/header') %>
<%- include('../partials/nav') %>

<div class='content'>
    <%- include('../partials/categories') %>
    <div class='main'>
        <div class='createCard'>
            <h4 style='text-align: center'>Create Recipe</h4>
            <form id='createForm' action="/recipe" method='POST'>
                <label for="">Title:</label>
                <input type="text" name='recipe[title]'>
                <label for="">Image:</label>
                <!-- <input type="text" name='recipe[picture]'> -->
                <!-- <input type="file" name='picture' accept='image/png, image/jpg'> -->
                <a href='/recipe/image/upload'>Upload image</a>
                <% if(files) { %>
                    <select id="" name="recipe[picture]">
                        <% files.map(f => { %>
                            <option value='<%= f %>'><%= f %></option>
                        <% }) %>
                    </select>
                <% } %>
                <label for="">Category:</label>
                <input type="text" name='recipe[category]'>
                <label for="">Ingridients:</label>
                <input type="text" name='recipe[ingridients]'>
                <label for="">Number of steps:</label>
                <div class='stepControl'>
                    <input id='stpnum' type="number" value=0 name='recipe[nsteps]'>
                    <div class='stepBtns'>
                        <button id='minus' onclick='prevent(event)'>-</button>
                        <button id='plus' onclick='prevent(event)'>+</button>
                    </div>
                </div>
                <button id='sub' type="submit">Create</button>
            </form>
        </div>
    </div>
    <%- include('../partials/popular') %> 
</div>

<script type='text/javascript' src='/libs/main.js'></script>
<script type='text/javascript'>
    const prevent = (e) => {
        e.preventDefault();
    }
</script>

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