summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-11-16 16:03:11 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2016-11-21 11:29:58 +0100
commit845f0bd401078e0450f170ff9c379da3bcba55a9 (patch)
treecf27468b6243a2c9bd9eda6bcebd8cccb8f72c47
parenta15809ceed0125cf9a5dbc94d09d56816bcdd32c (diff)
downloadnextcloud-server-845f0bd401078e0450f170ff9c379da3bcba55a9.tar.gz
nextcloud-server-845f0bd401078e0450f170ff9c379da3bcba55a9.zip
Fix position of menu
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--settings/js/federationscopemenu.js14
-rw-r--r--settings/js/federationsettingsview.js6
2 files changed, 14 insertions, 6 deletions
diff --git a/settings/js/federationscopemenu.js b/settings/js/federationscopemenu.js
index 45937911f09..e129f69fe9e 100644
--- a/settings/js/federationscopemenu.js
+++ b/settings/js/federationscopemenu.js
@@ -109,10 +109,24 @@
show: function(context) {
this._context = context;
+ var $el = $(context.target);
+ var offsetIcon = $el.offset();
+ var offsetHeading = $el.closest('h2').offset();
+
this.render();
this.$el.removeClass('hidden');
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);
+
}
});
diff --git a/settings/js/federationsettingsview.js b/settings/js/federationsettingsview.js
index 1054f13acff..7aaa225a861 100644
--- a/settings/js/federationsettingsview.js
+++ b/settings/js/federationsettingsview.js
@@ -72,12 +72,6 @@
$heading.append(scopeMenu.$el);
$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
self._setFieldScopeIcon(field, self._config.get(field + 'Scope'));
});