-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.html.eex
67 lines (62 loc) · 2.21 KB
/
index.html.eex
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
56
57
58
59
60
61
62
63
64
65
66
67
<section class="todoapp">
<header class="header">
<h1>todos</h1>
<%= if @editing.id do %>
<a href="<%= Routes.item_path(@conn, :index) %>" class="new-todo">
Click here to create a new item!
</a>
<% else %>
<%= render "form.html", Map.put(assigns, :action, Routes.item_path(@conn, :create)) %>
<% end %>
</header>
<section class="main" style="display: block;">
<input id="toggle-all" class="toggle-all" type="checkbox">
<label for="toggle-all">Mark all as complete</label>
<ul class="todo-list">
<%= for item <- filter(@items, @filter) do %>
<li data-id="<%= item.id %>" class="<%= complete(item) %>">
<a href="<%= Routes.item_path(@conn, :toggle, item.id) %>"
class="toggle <%= checked(item) %>">
</a>
<div class="view">
<%= if item.id == @editing.id do %>
<%= render "form.html", Map.put(assigns, :action,
Routes.item_path(@conn, :update, item)) %>
<% else %>
<a href="<%= Routes.item_path(@conn, :edit, item) %>" class="dblclick">
<label><%= item.text %></label>
</a>
<span></span> <!-- used for CSS Double Click -->
<% end %>
<%= link "", class: "destroy", method: :delete,
to: Routes.item_path(@conn, :delete, item),
data: [confirm: "Are you sure?"] %>
</div>
</li>
<% end %>
</ul>
</section>
<footer class="footer" style="display: block;">
<span class="todo-count"><%= remaining_items(@items) %> items left</span>
<ul class="filters">
<li>
<a href="/items" class='<%= selected(@filter, "all") %>'>
All
</a>
</li>
<li>
<a href="/active" class='<%= selected(@filter, "active") %>'>
Active
[<%= Enum.count(filter(@items, "active")) %>]
</a>
</li>
<li>
<a href="/completed" class='<%= selected(@filter, "completed") %>'>
Completed
[<%= Enum.count(filter(@items, "completed")) %>]
</a>
</li>
</ul>
<button class="clear-completed" style="display: block;">Clear completed</button>
</footer>
</section>