summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-04-21 10:33:03 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-11-21 11:29:33 +0100
commit78f6e29954ed3c0e868d4eccdc95e4b6e8febdea (patch)
tree737dfeae036156db3b29fec0ebfb61e403ca83d9 /settings/js
parent20739c93a680d7085d0e71c0e4f9c0bb24018fb9 (diff)
downloadnextcloud-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')
-rw-r--r--settings/js/federationsettingsview.js29
-rw-r--r--settings/js/personal.js6
2 files changed, 23 insertions, 12 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));
});
},
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 7a8d43d1475..9045851ba0c 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -192,7 +192,7 @@ function avatarResponseHandler (data) {
if (typeof data === 'string') {
data = JSON.parse(data);
}
- var $warning = $('#avatar .warning');
+ var $warning = $('#avatarform .warning');
$warning.hide();
if (data.status === "success") {
updateAvatar();
@@ -271,7 +271,7 @@ $(document).ready(function () {
});
var federationSettingsView = new OC.Settings.FederationSettingsView({
- el: '#personal-settings-container'
+ el: '#personal-settings'
});
federationSettingsView.render();
@@ -412,7 +412,7 @@ $(document).ready(function () {
// Load the big avatar
if (oc_config.enable_avatars) {
- $('#avatar .avatardiv').avatar(OC.currentUser, 145);
+ $('#avatarform .avatardiv').avatar(OC.currentUser, 145);
}
// Show token views