1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00

show expire date info when render share link

This commit is contained in:
lian 2018-11-27 17:24:02 +08:00 committed by llj
parent 5ff7743df6
commit 37ed51bd4a
2 changed files with 11 additions and 2 deletions

View File

@ -1257,6 +1257,7 @@
<div id="download-link-operations" class="hide">
<dl>
<dt>{% trans "Link: " %}</dt>
<dt class="share-link-expire-date-info hide"></dt>
<dd id="download-link">
<span class="link-placeholder"></span>
<input type="text" readonly="readonly" value="" class="shared-link hide" />
@ -1264,6 +1265,7 @@
</dd>
<% if (!is_dir) { %>
<dt>{% trans "Direct Download Link: " %}</dt>
<dt class="share-link-expire-date-info hide"></dt>
<dd id="direct-dl-link">
<span class="link-placeholder"></span>
<input type="text" readonly="readonly" value="" class="shared-link hide" />

View File

@ -4,8 +4,9 @@ define([
'underscore',
'backbone',
'common',
'moment',
'app/views/folder-share-item'
], function($, jQueryUI, _, Backbone, Common, FolderShareItemView) {
], function($, jQueryUI, _, Backbone, Common, Moment, FolderShareItemView) {
'use strict';
var SharePopupView = Backbone.View.extend({
@ -187,6 +188,11 @@ define([
this.$('#download-link-operations .shared-link-copy-icon').addClass('hide');
this.$('#download-link, #direct-dl-link').append(' <span class="error">(' + gettext('Expired') + ')</span>');
} else {
if (link_data.expire_date) {
var expire_date = Moment(link_data.expire_date).format('YYYY-MM-DD');
var info = gettext("This share link will be expired at %s").replace('%s', expire_date);
this.$('.share-link-expire-date-info').html(info).removeClass('hide');
}
this.$('#send-download-link').removeClass('hide');
this.$('#download-link-operations .shared-link-copy-icon').removeClass('hide');
this.$('#download-link .error, #direct-dl-link .error').remove('');
@ -477,7 +483,7 @@ define([
window.getSelection().removeAllRanges();
var range = document.createRange();
range.selectNode(targetDom[0]);
window.getSelection().addRange(range);
window.getSelection().addRange(range);
} else {
targetDom.select();
}
@ -585,6 +591,7 @@ define([
},
complete: function() {
_this.deleteDownloadLinkCancel();
_this.$('.share-link-expire-date-info').html('').addClass('hide')
}
});
},