]> source.dussan.org Git - nextcloud-server.git/commitdiff
allow the user to set a expire date for all shares
authorBjoern Schiessle <bjoern@schiessle.org>
Mon, 27 Mar 2017 20:03:10 +0000 (22:03 +0200)
committerBjoern Schiessle <bjoern@schiessle.org>
Mon, 3 Apr 2017 08:20:47 +0000 (10:20 +0200)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
core/css/share.scss
core/js/sharedialogshareelistview.js

index 0e6eb3ccf8be8cee5b164cb5d374925bf5a161e3..3ca2e4ea6436bf11b373ca14e17b8217015f588d 100644 (file)
@@ -184,3 +184,7 @@ a {
        padding-top: 12px;
        color: rgba($color-main-text, .4);
 }
+
+.popovermenu .datepicker {
+    margin-left: 35px;
+}
index e46a761db6cec94d94e80b72d03cdeaff283b120..8f8f3dfe10f986039a70474d150e96912d7084f3 100644 (file)
                                        '{{/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>' +
                        'click .unshare': 'onUnshare',
                        'click .icon-more': 'onToggleMenu',
                        'click .permissions': 'onPermissionChange',
+                       'click .expireDate' : 'onExpireDateChange'
                },
 
                initialize: function(options) {
                                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'),
                        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();