allow the user to set a expire date for all shares

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2017-03-27 22:03:10 +02:00
parent d56f6399eb
commit d0eefd17d3
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
2 changed files with 38 additions and 0 deletions

View File

@ -184,3 +184,7 @@ a {
padding-top: 12px;
color: rgba($color-main-text, .4);
}
.popovermenu .datepicker {
margin-left: 35px;
}

View File

@ -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();