Skip to content

RK-14201-remove-all-option #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .jenkins/Jenkinsfile.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
regressionTest {
FILE_PATH = "app.py"
LINE_NUM = "114"
SHA = "6833c3840a3542adddde98bceaa1aa715d49cf29b5295b6b3e84817a0b967129"
LINE_NUM = "118"
SHA = "5fcb058ac94ae67512e5c48d720980c6796152fd6f822aea80dfd7cf3c6008cd"
LANG = "Python"
BACKGROUND_IMAGE_CMD = "python /app/app.py &"
URL_FOR_TRIGGER = "http://localhost:5000/todos"
Expand Down
4 changes: 4 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def clear_completed():
todo = [t for t in todos if not t['completed']]
return '', 204

@app.route('/todos/remove_all', methods=['DELETE'])
def remove_all():
Store.getInstance().todos = []
return '', 204

@app.route('/todos', methods=['UPDATE'])
def update_todo():
Expand Down
5 changes: 5 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ html .clear-completed:active {
text-decoration: underline;
}

.clear-all-items {
cursor: pointer;
}


/*
Hack to remove background from Mobile Safari.
Can't use it globally since it destroys checkboxes in Firefox
Expand Down
1 change: 1 addition & 0 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ <h1>todos</h1>
</section>
<footer class="info">
<p>Double-click to edit a todo</p>
<p v-on:click="removeAll" class="clear-all-items">Click here to remove all items</p>
</footer>

</div>
Expand Down
6 changes: 6 additions & 0 deletions static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ $().ready(() => {
method: 'DELETE'
});
this.reloadOnFinish(action);
},
removeAll() {
const action = $.ajax('/todos/remove_all', {
method: 'DELETE'
});
this.reloadOnFinish(action);
},
updateTodo(todo) {
const action = $.ajax('/todos', {
Expand Down