Skip to content

Commit 216ce7d

Browse files
authored
Merge pull request #50 from zyishai/master
Improve todos toggling
2 parents 8dad1ba + c9070cd commit 216ce7d

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

web/css/toodles.css

+8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
font-size: .75em;
5454
}
5555

56+
.todo-source-link:hover {
57+
text-decoration: underline;
58+
}
59+
5660
.todo-source-link a:link, .todo-source-link a:visited {
5761
color: grey !important;
5862
}
@@ -77,6 +81,10 @@
7781
text-align: center;
7882
}
7983

84+
.todo-item:hover {
85+
cursor: pointer;
86+
}
87+
8088
.todo-item-body {
8189
word-wrap: break-word;
8290
}

web/html/index.html

+9-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
</span>
3838
<span>Delete</span>
3939
</div>
40-
<div class="select-all navbar-item" v-on:click="selectAll">
40+
<div class="navbar-item deselect-all" v-on:click="deselectAll" v-show="todos.length && todos.every(t => t.selected)">
41+
<span class="icon">
42+
<i class="fa fa-square"></i>
43+
</span>
44+
<span>Deselect All</span>
45+
</div>
46+
<div class="select-all navbar-item" v-on:click="selectAll" v-show="todos.some(t => !t.selected)">
4147
<span class="icon">
4248
<i class="fa fa-check-square"></i>
4349
</span>
@@ -130,14 +136,14 @@
130136
<th>Tags</th>
131137
</tr>
132138
</thead>
133-
<tr class="todo-item" v-for="todo in todos" v-if="todo.body.indexOf(todoSearch) !== -1 || (todo.assignee || '').indexOf(todoSearch) !== -1 || (todo.tags || []).toString().indexOf(todoSearch) !== -1 || (todo.flag || '').indexOf(todoSearch) !== -1" @change="updateTodo('top level')">
139+
<tr class="todo-item" v-for="todo in todos" v-if="todo.body.indexOf(todoSearch) !== -1 || (todo.assignee || '').indexOf(todoSearch) !== -1 || (todo.tags || []).toString().indexOf(todoSearch) !== -1 || (todo.flag || '').indexOf(todoSearch) !== -1" @change="updateTodo('top level')" @click="toggleTodo(todo)">
134140
<td><input type="checkbox" v-model="todo.selected"></td>
135141
<td class="todo-item-priority" >
136142
<div v-show="todo.priority !== undefined">{{ todo.priority }}</div>
137143
</td>
138144
<td class="todo-item-flag" >{{ todo.flag }}</td>
139145
<td class='todo-item-body'>
140-
<div class="todo-source-link"><a :href="'/source_file/' + todo.id + '#line-' + todo.lineNumber" target="_blank">{{ todo.sourceFile }}:{{ todo.lineNumber}}</a></div>
146+
<div class="todo-source-link" @click="stopPropagation"><a :href="'/source_file/' + todo.id + '#line-' + todo.lineNumber" target="_blank">{{ todo.sourceFile }}:{{ todo.lineNumber}}</a></div>
141147
<div>{{ todo.body }}</div>
142148
</td>
143149
<td class="todo-item-assignee" >{{ todo.assignee }}</td>

web/js/app.js

+15
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ $(document).ready(function() {
120120
console.log(name)
121121
}
122122
},
123+
124+
toggleTodo: function(todo) {
125+
todo.selected = !todo.selected
126+
},
127+
128+
stopPropagation: function(e) {
129+
e.stopPropagation()
130+
},
123131

124132
editSeletedTodos: function() {
125133
$(".modal").addClass("is-active")
@@ -159,6 +167,13 @@ $(document).ready(function() {
159167
this.hideDropdown()
160168
},
161169

170+
deselectAll: function() {
171+
this.todos.map(function(t) {
172+
t.selected = false
173+
})
174+
this.hideDropdown()
175+
},
176+
162177
toggleMenuBurger: function(ev) {
163178
$(".navbar-burger").toggleClass("is-active")
164179
$(".navbar-menu").toggleClass("is-active")

0 commit comments

Comments
 (0)