move unshare button out of popover menu; keep menu opened on re-render

This commit is contained in:
Christoph Wurst 2016-07-28 10:46:00 +02:00
parent 1181ac14f7
commit 7533fcb977
No known key found for this signature in database
GPG key ID: CC42AC2A7F0E56D8
2 changed files with 15 additions and 9 deletions

View file

@ -105,7 +105,6 @@ a.showCruds {
a.unshare { a.unshare {
display:inline; display:inline;
float:right;
opacity:.5; opacity:.5;
padding: 10px; padding: 10px;
margin-top: -5px; margin-top: -5px;

View file

@ -75,14 +75,9 @@
'</li>' + '</li>' +
'{{/if}}' + '{{/if}}' +
'{{/if}}' + '{{/if}}' +
'<li>' +
'<a href="#" class="menuitem action action-delete permanent unshare">' +
'<span class="icon icon-delete"></span>' +
'<span>{{unshareLabel}}</span>' +
'</a>' +
'</li>' +
'</ul>' + '</ul>' +
'</div>' + '</div>' +
'<a href="#" class="unshare"><span class="icon-loading-small hidden"></span><span class="icon icon-delete"></span><span class="hidden-visually">{{unshareLabel}}</span></a>' +
'</span>' + '</span>' +
'</li>' + '</li>' +
'{{/each}}' + '{{/each}}' +
@ -108,6 +103,8 @@
/** @type {Function} **/ /** @type {Function} **/
_template: undefined, _template: undefined,
_menuOpen: false,
events: { events: {
'click .unshare': 'onUnshare', 'click .unshare': 'onUnshare',
'click .icon-more': 'onToggleMenu', 'click .icon-more': 'onToggleMenu',
@ -210,7 +207,7 @@
})); }));
if(this.configModel.areAvatarsEnabled()) { if(this.configModel.areAvatarsEnabled()) {
this.$el.find('.avatar').each(function() { this.$('.avatar').each(function() {
var $this = $(this); var $this = $(this);
if ($this.hasClass('imageplaceholderseed')) { if ($this.hasClass('imageplaceholderseed')) {
$this.css({width: 32, height: 32}); $this.css({width: 32, height: 32});
@ -221,10 +218,19 @@
}); });
} }
this.$el.find('.has-tooltip').tooltip({ this.$('.has-tooltip').tooltip({
placement: 'bottom' placement: 'bottom'
}); });
var _this = this;
this.$('.popovermenu').on('afterHide', function() {
_this._menuOpen = false;
});
if (this._menuOpen) {
// Open menu again if it was opened before
OC.showMenu(null, this.$('.popovermenu'));
}
this.delegateEvents(); this.delegateEvents();
return this; return this;
@ -280,6 +286,7 @@
var $menu = $li.find('.popovermenu'); var $menu = $li.find('.popovermenu');
OC.showMenu(null, $menu); OC.showMenu(null, $menu);
this._menuOpen = true;
}, },
onPermissionChange: function(event) { onPermissionChange: function(event) {