This repository has been archived by the owner on Sep 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathtodos.jade
180 lines (165 loc) · 4.04 KB
/
todos.jade
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
head
title Todos
body
#top-tag-filter
+tag_filter
#main-pane
+todos
#side-pane
+lists
template(name="lists")
h3 Todo Lists
if loading
#lists Loading...
else
#lists
each lists
div.list(class=selected)
if editing
.edit
input#list-name-input(type="text" value=name)
else
.display
a.list-name(class=name_class href="/#{_id}")= name
#createList
input#new-list(type="text" placeholder="New list")
template(name="todos")
if any_list_selected
#items-view
if loading
| Loading...
else
#new-todo-box
input#new-todo(type="text" placeholder="New item")
ul#item-list
each todos
+todo_item
template(name="todo_item")
li.todo(class=done_class)
if editing
.edit
input#todo-input(type="text" value=text)
else
.destroy
.display
input.check(name="markdone" type="checkbox" checked=done)
.todo-text= text
.item-tags
each tag_objs
.tag.removable_tag
.name= tag
.remove
if adding_tag
.tag.edittag
input#edittag-input(type="text")
else
.tag.addtag +tag
template(name="tag_filter")
#tag-filter.tag-list
.label Show:
each tags
.tag(class=selected)
= tag_text
span.count (#{count})
//-
<head>
<title>Todos</title>
</head>
<body>
<div id="top-tag-filter">
{{> tag_filter}}
</div>
<div id="main-pane">
{{> todos}}
</div>
<div id="side-pane">
{{> lists}}
</div>
</body>
<template name="lists">
<h3>Todo Lists</h3>
{{#if loading}}
<div id="lists">Loading...</div>
{{else}}
<div id="lists">
{{#each lists}}
<div class="list {{selected}}">
{{#if editing}}
<div class="edit">
<input class="list-name-input" id="list-name-input" type="text" value="{{name}}" />
</div>
{{else}}
<div class="display">
<a class="list-name {{name_class}}" href="/{{_id}}">
{{name}}
</a>
</div>
{{/if}}
</div>
{{/each}}
</div>
<div id="createList">
<input type="text" id="new-list" placeholder="New list" />
</div>
{{/if}}
</template>
<template name="todos">
{{#if any_list_selected}}
<div id="items-view">
{{#if loading}}
Loading...
{{else}}
<div id="new-todo-box">
<input type="text" id="new-todo" placeholder="New item" />
</div>
<ul id="item-list">
{{#each todos}}
{{> todo_item}}
{{/each}}
</ul>
{{/if}}
</div>
{{/if}}
</template>
<template name="todo_item">
<li class="todo {{done_class}}">
{{#if editing}}
<div class="edit">
<input id="todo-input" type="text" value="{{text}}" />
</div>
{{else}}
<div class="destroy"></div>
<div class="display">
<input class="check" name="markdone" type="checkbox" {{{done_checkbox}}} />
<div class="todo-text">{{text}}</div>
</div>
{{/if}}
<div class="item-tags">
{{#each tag_objs}}
<div class="tag removable_tag">
<div class="name">{{tag}}</div>
<div class="remove"></div>
</div>
{{/each}}
{{#if adding_tag}}
<div class="tag edittag">
<input type="text" id="edittag-input" value="" />
</div>
{{else}}
<div class="tag addtag">
+tag
</div>
{{/if}}
</div>
</li>
</template>
<template name="tag_filter">
<div id="tag-filter" class="tag-list">
<div class="label">Show:</div>
{{#each tags}}
<div class="tag {{selected}}">
{{tag_text}} <span class="count">({{count}})</span>
</div>
{{/each}}
</div>
</template>