Skip to content

Commit d3f42bc

Browse files
authored
RK-14201-remove-all-option (#70)
* RK-14201-remove-all-optio * Update jenkins test file
1 parent 5741b4e commit d3f42bc

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

.jenkins/Jenkinsfile.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
regressionTest {
22
FILE_PATH = "app.py"
3-
LINE_NUM = "114"
4-
SHA = "6833c3840a3542adddde98bceaa1aa715d49cf29b5295b6b3e84817a0b967129"
3+
LINE_NUM = "118"
4+
SHA = "5fcb058ac94ae67512e5c48d720980c6796152fd6f822aea80dfd7cf3c6008cd"
55
LANG = "Python"
66
BACKGROUND_IMAGE_CMD = "python /app/app.py &"
77
URL_FOR_TRIGGER = "http://localhost:5000/todos"

app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ def clear_completed():
7474
todo = [t for t in todos if not t['completed']]
7575
return '', 204
7676

77+
@app.route('/todos/remove_all', methods=['DELETE'])
78+
def remove_all():
79+
Store.getInstance().todos = []
80+
return '', 204
7781

7882
@app.route('/todos', methods=['UPDATE'])
7983
def update_todo():

static/css/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ html .clear-completed:active {
373373
text-decoration: underline;
374374
}
375375

376+
.clear-all-items {
377+
cursor: pointer;
378+
}
379+
380+
376381
/*
377382
Hack to remove background from Mobile Safari.
378383
Can't use it globally since it destroys checkboxes in Firefox

static/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ <h1>todos</h1>
4242
</section>
4343
<footer class="info">
4444
<p>Double-click to edit a todo</p>
45+
<p v-on:click="removeAll" class="clear-all-items">Click here to remove all items</p>
4546
</footer>
4647

4748
</div>

static/js/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ $().ready(() => {
6161
method: 'DELETE'
6262
});
6363
this.reloadOnFinish(action);
64+
},
65+
removeAll() {
66+
const action = $.ajax('/todos/remove_all', {
67+
method: 'DELETE'
68+
});
69+
this.reloadOnFinish(action);
6470
},
6571
updateTodo(todo) {
6672
const action = $.ajax('/todos', {

0 commit comments

Comments
 (0)