diff options
author | Christoph Wurst <christoph@owncloud.com> | 2016-04-21 10:33:03 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-11-21 11:29:33 +0100 |
commit | 78f6e29954ed3c0e868d4eccdc95e4b6e8febdea (patch) | |
tree | 737dfeae036156db3b29fec0ebfb61e403ca83d9 /settings/js/federationsettingsview.js | |
parent | 20739c93a680d7085d0e71c0e4f9c0bb24018fb9 (diff) | |
download | nextcloud-server-78f6e29954ed3c0e868d4eccdc95e4b6e8febdea.tar.gz nextcloud-server-78f6e29954ed3c0e868d4eccdc95e4b6e8febdea.zip |
Add federation scope to the user avatar
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'settings/js/federationsettingsview.js')
-rw-r--r-- | settings/js/federationsettingsview.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/settings/js/federationsettingsview.js b/settings/js/federationsettingsview.js index 6a10d9f7f7e..997f4fef3f1 100644 --- a/settings/js/federationsettingsview.js +++ b/settings/js/federationsettingsview.js @@ -30,19 +30,26 @@ 'phone', 'email', 'website', - 'address' + 'address', + 'avatar' ]; var self = this; _.each(this._inputFields, function(field) { + var scopeOnly = field === 'avatar'; + // Initialize config model - self._config.set(field, $('#' + field).val()); + if (!scopeOnly) { + self._config.set(field, $('#' + field).val()); + } self._config.set(field + 'Scope', $('#' + field + 'scope').val()); // Set inputs whenever model values change - self.listenTo(self._config, 'change:' + field, function () { - self.$('#' + field).val(self._config.get(field)); - }); + if (!scopeOnly) { + self.listenTo(self._config, 'change:' + field, function () { + self.$('#' + field).val(self._config.get(field)); + }); + } self.listenTo(self._config, 'change:' + field + 'Scope', function () { self._onScopeChanged(field, self._config.get(field + 'Scope')); }); @@ -54,8 +61,8 @@ render: function() { var self = this; _.each(this._inputFields, function(field) { - var $heading = self.$('#' + field + 'form > h2'); - var $icon = self.$('#' + field + 'form > h2 > span'); + var $heading = self.$('#' + field + 'form h2'); + var $icon = self.$('#' + field + 'form h2 > span'); var scopeMenu = new OC.Settings.FederationScopeMenu(); self.listenTo(scopeMenu, 'select:scope', function(scope) { @@ -65,8 +72,9 @@ $icon.on('click', _.bind(scopeMenu.show, scopeMenu)); // Fix absolute position according to the heading text length - // TODO: fix position without magic numbers - var pos = ($heading.width() - $heading.find('label').width()) - 68; + // 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); self._onScopeChanged(field, self._config.get(field + 'Scope')); @@ -76,6 +84,9 @@ _registerEvents: function() { var self = this; _.each(this._inputFields, function(field) { + if (field === 'avatar') { + return; + } self.$('#' + field).keyUpDelayedOrEnter(_.bind(self._onInputChanged, self)); }); }, |