mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Added delete
This commit is contained in:
@@ -48,7 +48,8 @@
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script src="/static/js/sweetalert-dev.js"></script>
|
||||
<link rel="stylesheet" href="/static/css/sweetalert.css">
|
||||
|
||||
</head>
|
||||
|
||||
@@ -74,7 +75,9 @@
|
||||
<li class="dropdown active">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" class="active"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-header">Total time: {{ .TotalTime }}</li>
|
||||
<li class="dropdown-header">Time edited: {{ .TotalTime }}</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Other versions</li>
|
||||
<li><a href="/{{ .Title }}?version=0">First</a></li>
|
||||
{{ range .Versions }}
|
||||
<li><a href="/{{ $.Title }}?version={{ .VersionNum }}">{{ .VersionDate }}</a></li>
|
||||
@@ -126,7 +129,15 @@
|
||||
event.preventDefault();
|
||||
var deleteName = $(this).attr('id')
|
||||
var href = $(this).attr('href')
|
||||
console.log(deleteName)
|
||||
swal({
|
||||
title: "Are you sure?",
|
||||
text: "You will not be able to recover /{{ .Title }}!",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, delete it!",
|
||||
closeOnConfirm: false
|
||||
}, function() {
|
||||
$.ajax({
|
||||
url: "/deletepage" + '?' + $.param({
|
||||
"DeleteName": deleteName,
|
||||
@@ -134,10 +145,15 @@
|
||||
}),
|
||||
type: 'DELETE',
|
||||
success: function() {
|
||||
window.location.reload(true);
|
||||
swal("Deleted!", "/{{ .Title }} has been deleted.", "success");
|
||||
setTimeout(function(){ window.location.reload(true); }, 1000);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -36,7 +36,9 @@ a.deleteable {
|
||||
<li class="dropdown active">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" class="active"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-header">Total time: {{ .TotalTime }}</li>
|
||||
<li class="dropdown-header">Time edited: {{ .TotalTime }}</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Other versions</li>
|
||||
<li><a href="/{{ .Title }}/view?version=0">First</a></li>
|
||||
{{ range .Versions }}
|
||||
<li><a href="/{{ $.Title }}/view?version={{ .VersionNum }}">{{ .VersionDate }}</a></li>
|
||||
|
||||
Reference in New Issue
Block a user