diff --git a/api/js/etemplate/et2_widget_selectbox.js b/api/js/etemplate/et2_widget_selectbox.js index 86d43652b7..a0e035949c 100644 --- a/api/js/etemplate/et2_widget_selectbox.js +++ b/api/js/etemplate/et2_widget_selectbox.js @@ -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(''); + selected.addClass('et2_country-select flag-'+ _value.toLowerCase()); + } + } this._oldValue = this.value; if(this.input !== null && (this.options.tags || this.options.search)) { diff --git a/api/templates/default/css/flags.css b/api/templates/default/css/flags.css index f141a08f25..a4c2ea9290 100644 --- a/api/templates/default/css/flags.css +++ b/api/templates/default/css/flags.css @@ -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; } diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index 74b6e398e9..b1ab619450 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -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 { } diff --git a/preferences/inc/class.preferences_hooks.inc.php b/preferences/inc/class.preferences_hooks.inc.php index 4750c3fa2d..42f8126009 100644 --- a/preferences/inc/class.preferences_hooks.inc.php +++ b/preferences/inc/class.preferences_hooks.inc.php @@ -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