1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +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"> <div id="download-link-operations" class="hide">
<dl> <dl>
<dt>{% trans "Link: " %}</dt> <dt>{% trans "Link: " %}</dt>
<dt class="share-link-expire-date-info hide"></dt>
<dd id="download-link"> <dd id="download-link">
<span class="link-placeholder"></span> <span class="link-placeholder"></span>
<input type="text" readonly="readonly" value="" class="shared-link hide" /> <input type="text" readonly="readonly" value="" class="shared-link hide" />
@@ -1264,6 +1265,7 @@
</dd> </dd>
<% if (!is_dir) { %> <% if (!is_dir) { %>
<dt>{% trans "Direct Download Link: " %}</dt> <dt>{% trans "Direct Download Link: " %}</dt>
<dt class="share-link-expire-date-info hide"></dt>
<dd id="direct-dl-link"> <dd id="direct-dl-link">
<span class="link-placeholder"></span> <span class="link-placeholder"></span>
<input type="text" readonly="readonly" value="" class="shared-link hide" /> <input type="text" readonly="readonly" value="" class="shared-link hide" />

View File

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