From b668708a6d0ec5747725c40a26dc2703ab333062 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 8 Feb 2019 15:15:51 +0100 Subject: [PATCH] W.I.P of cats, versions or trackers categories color code --- api/categories.php | 2 +- api/js/etemplate/et2_widget_selectbox.js | 13 +++++++++++++ pixelegg/css/modern.css | 4 +++- pixelegg/css/modern.less | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/api/categories.php b/api/categories.php index 3a8c57529c..578d6f1c7b 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.row_category.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']};} .cat_{$cat['id']}.fullline_cat_bg, div.cat_{$cat['id']}, span.cat_{$cat['id']} { background-color: {$cat['data']['color']};} /*{$cat['name']}*/\n"; + $content .= ".egwGridView_scrollarea tr.row_category.cat_{$cat['id']} > td:first-child, .select-cat li.cat_{$cat['id']}, .et2_selectbox ul.chzn-results li.cat_{$cat['id']}, .et2_selectbox ul.chzn-choices li.cat_{$cat['id']}, .nextmatch_header_row .et2_selectbox.select-cat.cat_{$cat['id']} a.chzn-single {border-left-color: {$cat['data']['color']};} .cat_{$cat['id']}.fullline_cat_bg, 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_widget_selectbox.js b/api/js/etemplate/et2_widget_selectbox.js index 951ec5c262..d992c30ebd 100644 --- a/api/js/etemplate/et2_widget_selectbox.js +++ b/api/js/etemplate/et2_widget_selectbox.js @@ -580,6 +580,14 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend( // Value must be a real Array, not an object this.input.val(typeof _value == 'object' && _value != null ? jQuery.map(_value,function(value,index){return [value];}) : _value); this.input.trigger("liszt:updated"); + var self = this; + if (this._type == 'listbox' && this.value_class != '') + { + var chosen = this.input.next(); + chosen.find('.search-choice-close').each((i,v)=>{ + jQuery(v).parent().addClass(self.value_class + self.options.select_options[v.rel]['value']); + }); + } this.value = _value; return; } @@ -771,6 +779,11 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend( // Properly size chosen, even if on a hidden tab var size = egw.getHiddenDimensions(this.input); + if (this._type == 'listbox' && this.value_class != '') + { + var self = this; + this.input.find('option').each((i,v) => {jQuery(v).addClass(self.value_class+v.value)}); + } this.input.chosen({ inherit_select_classes: true, search_contains: true, diff --git a/pixelegg/css/modern.css b/pixelegg/css/modern.css index 61ecf4c37a..e73903ce13 100644 --- a/pixelegg/css/modern.css +++ b/pixelegg/css/modern.css @@ -6761,7 +6761,9 @@ div.dhtmlxMenu_egw_SubLevelArea_Polygon table.dhtmlxMebu_SubLevelArea_Tbl tr.sub filter: none; } .egwGridView_scrollarea tr.row_category > td:first-child, -.select-cat li { +.select-cat li, +.et2_selectbox .chzn-results li, +.et2_selectbox ul.chzn-choices li.search-choice { border-left: 4px solid transparent; } .et2_taglist_category span[class*="cat_"] { diff --git a/pixelegg/css/modern.less b/pixelegg/css/modern.less index 8e90c74160..417acac863 100644 --- a/pixelegg/css/modern.less +++ b/pixelegg/css/modern.less @@ -198,7 +198,8 @@ div.dhtmlxMenu_egw_SubLevelArea_Polygon table.dhtmlxMebu_SubLevelArea_Tbl tr.sub filter: none; } -.egwGridView_scrollarea tr.row_category > td:first-child, .select-cat li { +.egwGridView_scrollarea tr.row_category > td:first-child, .select-cat li, +.et2_selectbox .chzn-results li, .et2_selectbox ul.chzn-choices li.search-choice{ border-left: 4px solid transparent; }