-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.html.heex
76 lines (72 loc) · 2.11 KB
/
index.html.heex
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
68
69
70
71
72
73
74
75
76
<.header>
Listing Items
<:actions>
<.link href={~p"/items/new"}>
<.button>New Item</.button>
</.link>
</:actions>
</.header>
<.table id="items" rows={@items} row_click={&JS.navigate(~p"/items/#{&1}")}>
<:col :let={item} label="Text"><%= item.text %></:col>
<:col :let={item} label="Person"><%= item.person_id %></:col>
<:col :let={item} label="Status"><%= item.status %></:col>
<:action :let={item}>
<div class="sr-only">
<.link navigate={~p"/items/#{item}"}>Show</.link>
</div>
<.link navigate={~p"/items/#{item}/edit"}>Edit</.link>
</:action>
<:action :let={item}>
<.link href={~p"/items/#{item}"} method="delete" data-confirm="Are you sure?">
Delete
</.link>
</:action>
</.table>
<section class="todoapp">
<header class="header">
<h1>todos</h1>
<%= new(Map.put(assigns, :action, ~p"/items/new")) %>
</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 <- @items do %>
<li data-id={item.id} class={complete(item)}>
<div class="view">
<%= if item.status == 1 do %>
<input class="toggle" type="checkbox" checked/>
<% else %>
<input class="toggle" type="checkbox"/>
<% end %>
<label><%= item.text %></label>
<.link
class="destroy"
navigate={~p"/items/#{item.id}"}
method="delete"
data-confirm="Are you sure?"
>
</.link>
</div>
</li>
<% end %>
</ul>
</section>
<footer class="footer" style="display: block;">
<span class="todo-count"><strong>1</strong> item left</span>
<ul class="filters">
<li>
<a href="#/" class="selected">All</a>
</li>
<li>
<a href="#/active">Active</a>
</li>
<li>
<a href="#/completed">Completed</a>
</li>
</ul>
<button class="clear-completed" style="display: block;">
Clear completed
</button>
</footer>
</section>