mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
add confirm logic when delete share link
This commit is contained in:
@@ -1274,7 +1274,13 @@
|
||||
{% if user.permissions.can_send_share_link_mail %}
|
||||
<button id="send-download-link">{% trans 'Send' %}</button>
|
||||
{% endif %}
|
||||
<p id="delete-download-link-msg" class="error hide">
|
||||
<span>{% trans "Are you sure to remove the share link?"%}</span><br />
|
||||
<span>{% trans "If the share link is removed, no one will be able to access the file any more with the link."%}</span><br />
|
||||
</p>
|
||||
<button id="delete-download-link">{% trans 'Delete' %}</button>
|
||||
<button id="delete-download-link-confirm" class="hide">{% trans 'Yes' %}</button>
|
||||
<button id="delete-download-link-cancel" class="hide">{% trans 'No' %}</button>
|
||||
<form id="send-download-link-form" action="" class="hide">
|
||||
<label for="email">{% trans "Send to:"%}</label><br />
|
||||
<input type="text" class="input" name="email" placeholder="{% trans "Emails, separated by ','"%}" title="{% trans "Emails, separated by ','"%}" id="email" /><br />
|
||||
|
@@ -41,24 +41,32 @@ define([
|
||||
},
|
||||
|
||||
removeLink: function() {
|
||||
|
||||
var _this = this;
|
||||
|
||||
$.ajax({
|
||||
url: Common.getUrl({
|
||||
'name': 'share_admin_share_link',
|
||||
'token': this.model.get('token')
|
||||
}),
|
||||
type: 'DELETE',
|
||||
beforeSend: Common.prepareCSRFToken,
|
||||
success: function() {
|
||||
_this.remove();
|
||||
Common.feedback(gettext("Successfully deleted 1 item"), 'success');
|
||||
},
|
||||
error: function(xhr) {
|
||||
Common.ajaxErrorHandler(xhr);
|
||||
}
|
||||
});
|
||||
|
||||
var popupTitle = gettext("Are you sure to remove the share link?");
|
||||
var popupContent = gettext("If the share link is removed, no one will be able to access the file any more with the link.");
|
||||
var yesCallback = function() {
|
||||
$.ajax({
|
||||
url: Common.getUrl({
|
||||
'name': 'share_admin_share_link',
|
||||
'token': _this.model.get('token')
|
||||
}),
|
||||
type: 'DELETE',
|
||||
beforeSend: Common.prepareCSRFToken,
|
||||
success: function() {
|
||||
_this.remove();
|
||||
Common.feedback(gettext("Successfully deleted 1 item"), 'success');
|
||||
},
|
||||
error: function(xhr) {
|
||||
Common.ajaxErrorHandler(xhr);
|
||||
},
|
||||
complete: function() {
|
||||
$.modal.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
Common.showConfirm(popupTitle, popupContent, yesCallback);
|
||||
return false;
|
||||
},
|
||||
|
||||
|
@@ -115,6 +115,8 @@ define([
|
||||
'submit #send-download-link-form': 'sendDownloadLink',
|
||||
'click #cancel-share-download-link': 'cancelShareDownloadLink',
|
||||
'click #delete-download-link': 'deleteDownloadLink',
|
||||
'click #delete-download-link-confirm': 'deleteDownloadLinkConfirm',
|
||||
'click #delete-download-link-cancel': 'deleteDownloadLinkCancel',
|
||||
'click #generate-download-link-form .generate-random-password': 'generateRandomDownloadPassword',
|
||||
'keydown #generate-download-link-form .generate-random-password': 'generateRandomDownloadPassword',
|
||||
'click #generate-download-link-form .show-or-hide-password': 'showOrHideDownloadPassword',
|
||||
@@ -560,6 +562,13 @@ define([
|
||||
},
|
||||
|
||||
deleteDownloadLink: function() {
|
||||
$('#delete-download-link').addClass('hide');
|
||||
$('#delete-download-link-msg').removeClass('hide');
|
||||
$('#delete-download-link-confirm').removeClass('hide');
|
||||
$('#delete-download-link-cancel').removeClass('hide');
|
||||
},
|
||||
|
||||
deleteDownloadLinkConfirm: function() {
|
||||
var _this = this;
|
||||
$.ajax({
|
||||
url: Common.getUrl({
|
||||
@@ -573,10 +582,20 @@ define([
|
||||
success: function(data) {
|
||||
_this.$('#generate-download-link-form').removeClass('hide');
|
||||
_this.$('#download-link-operations').addClass('hide');
|
||||
},
|
||||
complete: function() {
|
||||
_this.deleteDownloadLinkCancel();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
deleteDownloadLinkCancel: function() {
|
||||
$('#delete-download-link').removeClass('hide');
|
||||
$('#delete-download-link-msg').addClass('hide');
|
||||
$('#delete-download-link-confirm').addClass('hide');
|
||||
$('#delete-download-link-cancel').addClass('hide');
|
||||
},
|
||||
|
||||
uploadLinkPanelInit: function() {
|
||||
var $panel = $('#dir-upload-link-share');
|
||||
var $loadingTip = this.$('.loading-tip').show();
|
||||
|
Reference in New Issue
Block a user