forked from snyk-labs/nodejs-goof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.ejs
33 lines (29 loc) · 1.04 KB
/
edit.ejs
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
<% layout( 'layout' ) -%>
<h1 id="page-title"><%= title %></h1>
<div id="list">
<form action="/create" method="post" accept-charset="utf-8">
<div class="item-new">
<input class="input" type="text" name="content" />
</div>
</form>
<% todos.forEach( function ( todo ){ %>
<% if( todo._id == current ){ %>
<div class="item-new">
<% }else{ %>
<div class="item">
<% } %>
<% if( todo._id == current ){ %>
<form class="update-form" action="/update/<%= todo._id %>" method="post" accept-charset="utf-8">
<input class="update-input" type="text" name="content" value="<%= todo.content %>" />
</form>
<% }else{ %>
<a class="update-link" href="/edit/<%= todo._id %>" title="Update this todo item"><%= todo.content %></a>
<% } %>
<% if( todo._id == current ){ %>
<a class="del-btn-edit" href="/destroy/<%= todo._id %>" title="Delete this todo item">Delete</a>
<% }else{ %>
<a class="del-btn" href="/destroy/<%= todo._id %>" title="Delete this todo item">Delete</a>
<% } %>
</div>
<% }); %>
</div>