summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-03-27 22:03:10 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2017-04-03 10:20:47 +0200
commitd0eefd17d3c47de8d13d41e57a2a6966af94428f (patch)
tree36663f92d172c0d1c9aa98198f2f826f4552844a
parentd56f6399eb925e50f2a7556710bb99424c2b4316 (diff)
downloadnextcloud-server-d0eefd17d3c47de8d13d41e57a2a6966af94428f.tar.gz
nextcloud-server-d0eefd17d3c47de8d13d41e57a2a6966af94428f.zip
allow the user to set a expire date for all shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
-rw-r--r--core/css/share.scss4
-rw-r--r--core/js/sharedialogshareelistview.js34
2 files changed, 38 insertions, 0 deletions
diff --git a/core/css/share.scss b/core/css/share.scss
index 0e6eb3ccf8b..3ca2e4ea643 100644
--- a/core/css/share.scss
+++ b/core/css/share.scss
@@ -184,3 +184,7 @@ a {
padding-top: 12px;
color: rgba($color-main-text, .4);
}
+
+.popovermenu .datepicker {
+ margin-left: 35px;
+}
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
index e46a761db6c..8f8f3dfe10f 100644
--- a/core/js/sharedialogshareelistview.js
+++ b/core/js/sharedialogshareelistview.js
@@ -88,6 +88,16 @@
'{{/unless}}{{/if}}' +
'{{/if}}' +
'<li>' +
+ '<span class="shareOption menuitem">' +
+ '<input id="expireDate-{{cid}}-{{shareId}}" type="checkbox" name="expirationDate" class="expireDate checkbox" {{#if hasExpireDate}}checked="checked"{{/if}} data-permissions="{{expireDate}}" />' +
+ '<label for="expireDate-{{cid}}-{{shareId}}">{{expireDateLabel}}</label>' +
+ '<div class="expirationDateContainer-{{cid}}-{{shareId}} {{#unless isExpirationSet}}hidden{{/unless}}">' +
+ ' <label for="expirationDatePicker-{{cid}}-{{shareId}}" class="hidden-visually" value="{{expirationDate}}">{{expirationLabel}}</label>' +
+ ' <input id="expirationDatePicker-{{cid}}-{{shareId}}" class="datepicker" type="text" placeholder="{{expirationDatePlaceholder}}" value="{{expirationValue}}" />' +
+ '</div>' +
+ '</span>' +
+ '</li>' +
+ '<li>' +
'<a href="#" class="unshare"><span class="icon-loading-small hidden"></span><span class="icon icon-delete"></span><span>{{unshareLabel}}</span></a>' +
'</li>' +
'</ul>' +
@@ -125,6 +135,7 @@
'click .unshare': 'onUnshare',
'click .icon-more': 'onToggleMenu',
'click .permissions': 'onPermissionChange',
+ 'click .expireDate' : 'onExpireDateChange'
},
initialize: function(options) {
@@ -199,6 +210,7 @@
createPermissionLabel: t('core', 'can create'),
updatePermissionLabel: t('core', 'can change'),
deletePermissionLabel: t('core', 'can delete'),
+ expireDateLabel: t('core', 'set expiration data'),
crudsLabel: t('core', 'access control'),
triangleSImage: OC.imagePath('core', 'actions/triangle-s'),
isResharingAllowed: this.configModel.get('isResharingAllowed'),
@@ -401,6 +413,28 @@
this._menuOpen = $li.data('share-id');
},
+ onExpireDateChange: function(event) {
+ var element = $(event.target);
+ var li = element.closest('li[data-share-id]');
+ var shareId = li.data('share-id');
+ var datePickerClass = '.expirationDateContainer-' + this.cid + '-' + shareId;
+ var datePicker = $(datePickerClass);
+ var state = element.prop('checked');
+ datePicker.toggleClass('hidden', !state);
+ if (!state) {
+ // discard expiration date
+ this.model.get('linkShare').expiration = '';
+ /*
+ this.model.saveLinkShare({
+ expireDate: ''
+ });
+ */
+ } else {
+ var expirationDatePicker = '#expirationDatePicker-' + this.cid + '-' + shareId;
+ this.$(expirationDatePicker).focus();
+ }
+ },
+
onPermissionChange: function(event) {
event.preventDefault();
event.stopPropagation();