From 5acc3d3c5e8c78ee425dad1dfb3d8d057a6e7203 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Fri, 18 Nov 2016 19:44:21 +0100 Subject: [PATCH] Highlight current entry Signed-off-by: Lukas Reschke --- settings/js/federationscopemenu.js | 27 +++++++++++++++++++++++---- settings/js/federationsettingsview.js | 3 +++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/settings/js/federationscopemenu.js b/settings/js/federationscopemenu.js index d073478ff5f..36b720e8c45 100644 --- a/settings/js/federationscopemenu.js +++ b/settings/js/federationscopemenu.js @@ -9,7 +9,6 @@ */ /* global OC, Handlebars */ - (function() { var TEMPLATE_MENU = @@ -49,19 +48,22 @@ name: 'private', displayName: (this.field == 'avatar' || this.field == 'displayname') ? t('core', 'Local') : t('core', 'Private'), tooltip: (this.field == 'avatar' || this.field == 'displayname') ? t('core', 'Only visible to local users') : t('core', 'Only visible to you'), - icon: OC.imagePath('core', 'actions/password') + icon: OC.imagePath('core', 'actions/password'), + active: false }, { name: 'contacts', displayName: t('core', 'Contacts'), tooltip: t('core', 'Visible to local users and to trusted servers'), - icon: OC.imagePath('core', 'places/contacts-dark') + icon: OC.imagePath('core', 'places/contacts-dark'), + active: false }, { name: 'public', displayName: t('core', 'Public'), tooltip: t('core', 'Will be synced to a global and public address book'), - icon: OC.imagePath('core', 'places/link') + icon: OC.imagePath('core', 'places/link'), + active: false } ]; }, @@ -109,6 +111,23 @@ */ show: function(context) { this._context = context; + var currentlyActiveValue = $('#'+context.target.closest('form').id).find('.icon-checkmark > input')[0].value; + + for(var i = 0 in this._scopes) { + this._scopes[i].active = false; + } + + switch (currentlyActiveValue) { + case "private": + this._scopes[0].active = true; + break; + case "contacts": + this._scopes[1].active = true; + break; + case "public": + this._scopes[2].active = true; + break; + } var $el = $(context.target); var offsetIcon = $el.offset(); diff --git a/settings/js/federationsettingsview.js b/settings/js/federationsettingsview.js index e42828ca456..9b38664d2f8 100644 --- a/settings/js/federationsettingsview.js +++ b/settings/js/federationsettingsview.js @@ -128,6 +128,9 @@ _onScopeChanged: function(field, scope) { this._config.set(field + 'Scope', scope); + + $('#' + field).parent().find('span > input').val(scope); + // TODO: user loading/success feedback this._config.save(); this._setFieldScopeIcon(field, scope); -- 2.39.5