Skip to content

Commit

Permalink
add confirmation message on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragatlas committed May 5, 2017
1 parent 028aa1c commit 87efd7a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions public/javascripts/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function confimrDelete(id) {
var r = confirm("Are you sure what to delete?");
if (r == true) {
window.location.href='/profiles/delete/'+id;
return;
} else {
return false;
}
}
1 change: 1 addition & 0 deletions views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ html
script(src="https://code.jquery.com/jquery-3.1.1.slim.min.js")
script(src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js")
script(src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js")
script(src="/javascripts/all.js")
2 changes: 1 addition & 1 deletion views/profile-lists.pug
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ block content
p.card-text.font-weight-bold.text-center
.alert.alert-success(role='alert') #[strong No Data Available]
a.card-link(href='../profiles/edit/'+profile.id) Edit Profile
a.card-link(href='../profiles/delete/'+profile.id) Delete Profile
a.card-link(href='javascript:void(0);', onclick="confimrDelete(" + profile.id + ")") Delete Profile
a.card-link(href='../profiles/view/'+profile.id) View Profile
.card-footer.text-muted= profile.profile_create
else
Expand Down
2 changes: 1 addition & 1 deletion views/profile-view.pug
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ block content
.alert.alert-success(role='alert') #[strong No Data Available]
.mt-5
a.card-link(href='/profiles/edit/'+profiles[0].id) Edit Profile
a.card-link(href='/profiles/delete/'+profiles[0].id) Delete Profile
a.card-link(href='javascript:void(0);', onclick="confimrDelete("+ profiles[0].id +")") Delete Profile
.card-footer.text-muted= profiles[0].profile_create
else
h3 No Profile Created

0 comments on commit 87efd7a

Please sign in to comment.