Fix position of menu
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
a15809ceed
commit
845f0bd401
|
@ -109,10 +109,24 @@
|
||||||
show: function(context) {
|
show: function(context) {
|
||||||
this._context = context;
|
this._context = context;
|
||||||
|
|
||||||
|
var $el = $(context.target);
|
||||||
|
var offsetIcon = $el.offset();
|
||||||
|
var offsetHeading = $el.closest('h2').offset();
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
this.$el.removeClass('hidden');
|
this.$el.removeClass('hidden');
|
||||||
|
|
||||||
OC.showMenu(null, this.$el);
|
OC.showMenu(null, this.$el);
|
||||||
|
|
||||||
|
//Set the menuwidth
|
||||||
|
var menuWidth = this.$el.width();
|
||||||
|
this.$el.css('width', menuWidth);
|
||||||
|
|
||||||
|
//Calculate menu position
|
||||||
|
var l = offsetIcon.left - offsetHeading.left;
|
||||||
|
l = l - (menuWidth / 2) + ($el.width()/2);
|
||||||
|
this.$el.css('left', l);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -72,12 +72,6 @@
|
||||||
$heading.append(scopeMenu.$el);
|
$heading.append(scopeMenu.$el);
|
||||||
$icon.on('click', _.bind(scopeMenu.show, scopeMenu));
|
$icon.on('click', _.bind(scopeMenu.show, scopeMenu));
|
||||||
|
|
||||||
// Fix absolute position according to the heading text length
|
|
||||||
// TODO: find alternative to those magic number
|
|
||||||
var diff = field === 'avatar' ? 104 : 68;
|
|
||||||
var pos = ($heading.width() - $heading.find('label').width()) - diff;
|
|
||||||
scopeMenu.$el.css('right', pos);
|
|
||||||
|
|
||||||
// Restore initial state
|
// Restore initial state
|
||||||
self._setFieldScopeIcon(field, self._config.get(field + 'Scope'));
|
self._setFieldScopeIcon(field, self._config.get(field + 'Scope'));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue