mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 11:21:29 +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 %}
|
{% if user.permissions.can_send_share_link_mail %}
|
||||||
<button id="send-download-link">{% trans 'Send' %}</button>
|
<button id="send-download-link">{% trans 'Send' %}</button>
|
||||||
{% endif %}
|
{% 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">{% 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">
|
<form id="send-download-link-form" action="" class="hide">
|
||||||
<label for="email">{% trans "Send to:"%}</label><br />
|
<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 />
|
<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() {
|
removeLink: function() {
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
$.ajax({
|
var popupTitle = gettext("Are you sure to remove the share link?");
|
||||||
url: Common.getUrl({
|
var popupContent = gettext("If the share link is removed, no one will be able to access the file any more with the link.");
|
||||||
'name': 'share_admin_share_link',
|
var yesCallback = function() {
|
||||||
'token': this.model.get('token')
|
$.ajax({
|
||||||
}),
|
url: Common.getUrl({
|
||||||
type: 'DELETE',
|
'name': 'share_admin_share_link',
|
||||||
beforeSend: Common.prepareCSRFToken,
|
'token': _this.model.get('token')
|
||||||
success: function() {
|
}),
|
||||||
_this.remove();
|
type: 'DELETE',
|
||||||
Common.feedback(gettext("Successfully deleted 1 item"), 'success');
|
beforeSend: Common.prepareCSRFToken,
|
||||||
},
|
success: function() {
|
||||||
error: function(xhr) {
|
_this.remove();
|
||||||
Common.ajaxErrorHandler(xhr);
|
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;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -115,6 +115,8 @@ define([
|
|||||||
'submit #send-download-link-form': 'sendDownloadLink',
|
'submit #send-download-link-form': 'sendDownloadLink',
|
||||||
'click #cancel-share-download-link': 'cancelShareDownloadLink',
|
'click #cancel-share-download-link': 'cancelShareDownloadLink',
|
||||||
'click #delete-download-link': 'deleteDownloadLink',
|
'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',
|
'click #generate-download-link-form .generate-random-password': 'generateRandomDownloadPassword',
|
||||||
'keydown #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',
|
'click #generate-download-link-form .show-or-hide-password': 'showOrHideDownloadPassword',
|
||||||
@@ -560,6 +562,13 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteDownloadLink: function() {
|
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;
|
var _this = this;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Common.getUrl({
|
url: Common.getUrl({
|
||||||
@@ -573,10 +582,20 @@ define([
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
_this.$('#generate-download-link-form').removeClass('hide');
|
_this.$('#generate-download-link-form').removeClass('hide');
|
||||||
_this.$('#download-link-operations').addClass('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() {
|
uploadLinkPanelInit: function() {
|
||||||
var $panel = $('#dir-upload-link-share');
|
var $panel = $('#dir-upload-link-share');
|
||||||
var $loadingTip = this.$('.loading-tip').show();
|
var $loadingTip = this.$('.loading-tip').show();
|
||||||
|
Reference in New Issue
Block a user