Highlight current entry
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
a0c64044b2
commit
5acc3d3c5e
|
@ -9,7 +9,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global OC, Handlebars */
|
/* global OC, Handlebars */
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var TEMPLATE_MENU =
|
var TEMPLATE_MENU =
|
||||||
|
@ -49,19 +48,22 @@
|
||||||
name: 'private',
|
name: 'private',
|
||||||
displayName: (this.field == 'avatar' || this.field == 'displayname') ? t('core', 'Local') : t('core', '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'),
|
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',
|
name: 'contacts',
|
||||||
displayName: t('core', 'Contacts'),
|
displayName: t('core', 'Contacts'),
|
||||||
tooltip: t('core', 'Visible to local users and to trusted servers'),
|
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',
|
name: 'public',
|
||||||
displayName: t('core', 'Public'),
|
displayName: t('core', 'Public'),
|
||||||
tooltip: t('core', 'Will be synced to a global and public address book'),
|
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) {
|
show: function(context) {
|
||||||
this._context = 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 $el = $(context.target);
|
||||||
var offsetIcon = $el.offset();
|
var offsetIcon = $el.offset();
|
||||||
|
|
|
@ -128,6 +128,9 @@
|
||||||
|
|
||||||
_onScopeChanged: function(field, scope) {
|
_onScopeChanged: function(field, scope) {
|
||||||
this._config.set(field + 'Scope', scope);
|
this._config.set(field + 'Scope', scope);
|
||||||
|
|
||||||
|
$('#' + field).parent().find('span > input').val(scope);
|
||||||
|
|
||||||
// TODO: user loading/success feedback
|
// TODO: user loading/success feedback
|
||||||
this._config.save();
|
this._config.save();
|
||||||
this._setFieldScopeIcon(field, scope);
|
this._setFieldScopeIcon(field, scope);
|
||||||
|
|
Loading…
Reference in New Issue