diff --git a/api/categories.php b/api/categories.php index ea2f1ebe2b..9be37f2f22 100644 --- a/api/categories.php +++ b/api/categories.php @@ -41,7 +41,7 @@ foreach($categories as $cat) { // Use slightly more specific selector that just class, to allow defaults // if the category has no color - $content .= ".egwGridView_scrollarea tr.cat_{$cat['id']} > td:first-child {border-left-color: {$cat['data']['color']};} div.cat_{$cat['id']}, span.cat_{$cat['id']} { background-color: {$cat['data']['color']};} /*{$cat['name']}*/\n"; + $content .= ".egwGridView_scrollarea tr.cat_{$cat['id']} > td:first-child, .select-cat li.cat_{$cat['id']}, .nextmatch_header_row .et2_selectbox.select-cat.cat_{$cat['id']} a.chzn-single {border-left-color: {$cat['data']['color']};} div.cat_{$cat['id']}, span.cat_{$cat['id']} { background-color: {$cat['data']['color']};} /*{$cat['name']}*/\n"; } if (!empty($cat['data']['icon'])) { diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index ef69829969..053475050c 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -2677,7 +2677,14 @@ var et2_nextmatch_header_bar = (function(){ "use strict"; return et2_DOMWidget.e this.egw().debug('warn', 'Nextmatch filter options in a weird place - "%s". Should be in sel_options[%s].',row_id,name); } } - + if (name == 'cat_id') + { + jQuery.extend(widget_options, { + multiple: false, + tags: true, + class: "select-cat" + }); + } // Legacy: Add in 'All' option for cat_id, if not provided. if(name == 'cat_id' && options != null && (typeof options[''] == 'undefined' && typeof options[0] != 'undefined' && options[0].value != '')) { diff --git a/api/js/etemplate/et2_widget_selectbox.js b/api/js/etemplate/et2_widget_selectbox.js index 17c00b2620..e62487aa0d 100644 --- a/api/js/etemplate/et2_widget_selectbox.js +++ b/api/js/etemplate/et2_widget_selectbox.js @@ -248,7 +248,10 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend( var option = jQuery(document.createElement("option")) .attr("value", _value) .text(_label+""); - + if (this.options.tags && this._type == 'select-cat') + { + option.addClass('cat_'+_value); + } if (typeof _title != "undefined" && _title) { option.attr("title", _title); @@ -492,6 +495,16 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend( // No options set yet this.set_select_options(this.options.select_options); } + // select-cat set/unset right cat_ color for selected value + if (this._type == 'select-cat' && this.options.tags) { + var chosen = this.input.siblings(); + this.input.removeClass('cat_'+this._oldValue); + this.input.addClass('cat_'+this.value); + if (chosen.length > 0) { + chosen.removeClass('cat_'+this._oldValue); + chosen.addClass('cat_'+this.value); + } + } this._oldValue = this.value; if(this.input !== null && (this.options.tags || this.options.search)) { diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index 255ad68d7c..e09d86bee3 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -1390,7 +1390,8 @@ div.message.floating { .et2_nextmatch .egwGridView_outer thead tr > th:first-child { border-left: 6px solid transparent; } -.egwGridView_scrollarea tr.row_category > td:first-child { +.egwGridView_scrollarea tr.row_category > td:first-child, +.select-cat li{ border-left: 6px solid transparent; } .et2_nextmatch .egwGridView_grid, .et2_nextmatch .egwGridView_outer { @@ -2677,4 +2678,33 @@ tr.dialogHeader2 td {padding-top:15px;} background-color: initial !important; box-shadow: none !important; cursor: default !important; -} \ No newline at end of file +} + +/*et2_selectbox select-cat chosen (cats selectbox with colors) */ +.nextmatch_header_row .et2_selectbox.select-cat .chzn-single +{ + border: none; + padding-left: 3px; + background: transparent; + box-shadow: none; + margin-top: 0px; + border-radius: 3px; + height: 22px; + border-left: 6px solid transparent; +} +.nextmatch_header_row .et2_selectbox.select-cat +{ + padding-right: 3px !important; + -webkit-appearance: none; + height: 22px !important; + margin: 1px 4px 1px 0; + background-color: #fafafa; + border: 1px solid silver; + border-radius: 3px; + padding-left: 0px; + display: inline-block; + float: left; + min-height: 20px; + min-width: 160px; +} +.nextmatch_header_row .et2_selectbox.select-cat.chzn-container .chzn-results {max-height: 340px;} \ No newline at end of file