forked from extern/egroupware
Fix some issues with select-country widget:
- Country selection in preferences does not respect selected value - Fix missing empty labels in country selection in preferences - Remove flag image from empty labels
This commit is contained in:
parent
1e98a89bbd
commit
13f3cc5260
@ -237,8 +237,9 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
|
||||
change: function(_node, _widget, _value) {
|
||||
var valid = this._super.apply(this, arguments);
|
||||
if (!this.input) return valid;
|
||||
var selected = this.input.siblings().find('a.chzn-single');
|
||||
var val = _value && _value.selected ? _value.selected : this.value;
|
||||
var val = _value && _value.selected ? _value.selected : this.input.val();
|
||||
switch (this._type)
|
||||
{
|
||||
case 'select-country':
|
||||
@ -551,6 +552,19 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
chosen.addClass('cat_'+this.value);
|
||||
}
|
||||
}
|
||||
if (this._type == 'select-country' && this.options.tags)
|
||||
{
|
||||
var selected = this.input.siblings().find('a.chzn-single');
|
||||
if (selected && selected.length == 1 && _value)
|
||||
{
|
||||
selected.removeClass (function (index, className) {
|
||||
return (className.match (/(^|\s)flag-\S+/g) || []).join(' ');
|
||||
});
|
||||
selected.find('span.img').remove();
|
||||
selected.prepend('<span class="img"></span>');
|
||||
selected.addClass('et2_country-select flag-'+ _value.toLowerCase());
|
||||
}
|
||||
}
|
||||
this._oldValue = this.value;
|
||||
if(this.input !== null && (this.options.tags || this.options.search))
|
||||
{
|
||||
|
@ -9,6 +9,8 @@
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.et2_country-select.flag-0 span.img,
|
||||
.et2_country-select.flag- span.img,
|
||||
.et2_country-select.flag--custom- span.img{
|
||||
background-image: none;
|
||||
}
|
||||
|
@ -2881,6 +2881,12 @@ tr.dialogHeader2 td {padding-top:15px;}
|
||||
box-shadow: 0px 0px 10px 2px #888888;
|
||||
}
|
||||
|
||||
/*Posion the selected flag better*/
|
||||
a.chzn-single.et2_country-select span.img {
|
||||
color: transparent;
|
||||
top: -4px;
|
||||
}
|
||||
|
||||
.et2_avatar {
|
||||
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ class preferences_hooks
|
||||
'help' => 'In which country are you. This is used to set certain defaults for you.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
'values' => array(''),
|
||||
'default'=> strtoupper($country),
|
||||
'attributes' => array (
|
||||
'tags' => true
|
||||
|
Loading…
Reference in New Issue
Block a user