Skip to content

Added a confirmation for delete #23

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions flask_admin/static/js/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ window.log = function(){

// place any jQuery/helper plugins in here, instead of separate, slower script files.

$(document).ready(function() {
$('.delete-button').click(function() {
var answer = confirm("Are you sure you want delete this item?");
if (answer) {
return true;
} else {
return false;
}
});
});
2 changes: 1 addition & 1 deletion flask_admin/templates/admin/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2>{{ model_name }}</h2>
{% set model_url_key = get_model_url_key(model_instance) %}
<li>
<a href="{{ url_for('.edit', model_name=model_name, model_url_key=model_url_key) }}">{{ model_instance }}</a>
<a href="{{ url_for('.delete', model_name=model_name, model_url_key=model_url_key) }}" title="delete">
<a href="{{ url_for('.delete', model_name=model_name, model_url_key=model_url_key) }}" title="delete" class="delete-button">
<div class="ui-widget ui-state-default ui-corner-all" title="delete"><span class="ui-icon ui-icon-trash"></span></div>
</a>
<a href="{{ url_for('.edit', model_name=model_name, model_url_key=model_url_key) }}" title="edit">
Expand Down