diff --git a/apps/files_sharing/css/sharetabview.css b/apps/files_sharing/css/sharetabview.css index c62fd6dd942d..fb709e4f0ec7 100644 --- a/apps/files_sharing/css/sharetabview.css +++ b/apps/files_sharing/css/sharetabview.css @@ -51,7 +51,6 @@ white-space : normal; } -#shareWithList .showCruds img, #shareWithList .unshare img { vertical-align: text-bottom; /* properly align icons */ diff --git a/core/css/share.css b/core/css/share.css index 22ad1125bf4b..272fa4e63dab 100644 --- a/core/css/share.css +++ b/core/css/share.css @@ -22,7 +22,6 @@ left: 20px; } } - .shareTabView .unshare.icon-loading-small { margin-top: 1px; } @@ -164,6 +163,15 @@ a.time { margin-right: -10px; } +a.toggleShareDetails { + display: inline; + float: right; + opacity: 0.5; + padding: 10px; + margin-top: -5px; + margin-right: -10px; +} + #link { border-top: 1px solid #ddd; padding-top: 8px; @@ -207,6 +215,9 @@ a.showCruds:hover, a.unshare:hover { opacity: 1; } +a.toggleShareDetails:hover { + opacity: 1; +} #defaultExpireMessage, /* fix expire message going out of box */ .reshare { @@ -293,4 +304,4 @@ a.unshare:hover { .select2-container-multi .select2-choices .select2-search-choice { padding: 3px 18px 3px 5px; -} +} \ No newline at end of file diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 91f236c5f983..96af45b4b988 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -15,86 +15,84 @@ var TEMPLATE = '
'; /** @@ -117,13 +115,15 @@ /** @type {Function} **/ _template: undefined, + _currentlyToggled: [], + events: { 'click .unshare': 'onUnshare', 'click .permissions': 'onPermissionChange', 'click .attributes': 'onPermissionChange', - 'click .showCruds': 'onCrudsToggle', 'click .mailNotification': 'onSendMailNotification', - 'click .removeExpiration' : 'onRemoveExpiration' + 'click .removeExpiration' : 'onRemoveExpiration', + 'click .toggleShareDetails' : 'onToggleShareDetails' }, initialize: function(options) { @@ -292,15 +292,32 @@ self._setDatepicker(this, { maxDate : self.configModel.getDefaultExpireDateUser(), enforced : self.configModel.isDefaultExpireDateUserEnforced() - }) - }) + }); + }); this.$el.find('.expiration-group:not(.hasDatepicker)').each(function(){ self._setDatepicker(this, { maxDate : self.configModel.getDefaultExpireDateGroup(), enforced : self.configModel.isDefaultExpireDateGroupEnforced() - }) - }) + }); + }); + + this.$el.bind("DOMNodeInserted", function(){ + // make sure to always enable toggled divs + if (!_.isUndefined(self._currentlyToggled)) { + + self.$el.find('li').each(function() + { + var $li = $(this); + var shareId = $li.data('share-id'); + if (!_.isUndefined(self._currentlyToggled[shareId])) { + self._toggleShareDivs(shareId, true); + } else { + self._toggleShareDivs(shareId, false); + } + }); + } + }); this.delegateEvents(); @@ -395,12 +412,6 @@ ); }, - onCrudsToggle: function(event) { - var $target = $(event.target); - $target.closest('li').find('.cruds').toggleClass('hidden'); - return false; - }, - onSendMailNotification: function(event) { var $target = $(event.target); var $li = $(event.target).closest('li'); @@ -434,10 +445,42 @@ }, {}); }, + onToggleShareDetails: function(event) { + this._toggleShareDetails(event); + }, + + _toggleShareDetails: function(event) { + var $li = $(event.target).closest('li'); + var shareId = $li.data('share-id'); + + if (!_.isUndefined(this._currentlyToggled[shareId])) { + this._currentlyToggled.splice(shareId, 1); + this._toggleShareDivs(shareId, false); + } else { + this._currentlyToggled[shareId] = true; + this._toggleShareDivs(shareId, true); + } + }, + + _toggleShareDivs: function(shareId, enabled) { + var $li = this.$el.find('li[data-share-id=' + shareId + ']'); + $li.children("div").each(function() + { + var $div = $(this); + if (!$div.hasClass( "avatar" )) { + if (enabled) { + $div.css('display', 'block'); + } else { + $div.css('display', 'none'); + } + } + }); + }, + _onExpirationChange: function(el) { - var $el = $(el) + var $el = $(el); var shareId = $el.closest('li').data('share-id'); - var expiration = moment($el.val(), 'DD-MM-YYYY').format() + var expiration = moment($el.val(), 'DD-MM-YYYY').format(); this.model.updateShare( shareId, { expireDate: expiration @@ -452,7 +495,7 @@ minDate: "+1d", dateFormat : 'dd-mm-yy', onSelect : function() { - self._onExpirationChange(el) + self._onExpirationChange(el); } });