]> source.dussan.org Git - nextcloud-server.git/commitdiff
Highlight current entry
authorLukas Reschke <lukas@statuscode.ch>
Fri, 18 Nov 2016 18:44:21 +0000 (19:44 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Mon, 21 Nov 2016 10:30:02 +0000 (11:30 +0100)
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
settings/js/federationscopemenu.js
settings/js/federationsettingsview.js

index d073478ff5f04ec3543eddb808edee7d9f4a53a9..36b720e8c45fef389b4b41c70deaa4f47de85a9b 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 /* global OC, Handlebars */
-
 (function() {
 
        var TEMPLATE_MENU =
                                        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
                                }
                        ];
                },
                 */
                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();
index e42828ca456d538316548ee0389a9aceaa547937..9b38664d2f8a9ce9ff23d975fee162950bc3759a 100644 (file)
 
                _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);