From d0eefd17d3c47de8d13d41e57a2a6966af94428f Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 27 Mar 2017 22:03:10 +0200 Subject: [PATCH] allow the user to set a expire date for all shares Signed-off-by: Bjoern Schiessle --- core/css/share.scss | 4 ++++ core/js/sharedialogshareelistview.js | 34 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/core/css/share.scss b/core/css/share.scss index 0e6eb3ccf8..3ca2e4ea64 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 e46a761db6..8f8f3dfe10 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -88,6 +88,16 @@ '{{/unless}}{{/if}}' + '{{/if}}' + '
  • ' + + '' + + '' + + '' + + '
    ' + + ' ' + + ' ' + + '
    ' + + '
    ' + + '
  • ' + + '
  • ' + '{{unshareLabel}}' + '
  • ' + '' + @@ -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();