Fix taglist widget:

- Fix taglist single styling
- Fix toggle to single not working when there're multiple selected
This commit is contained in:
Hadi Nategh 2016-05-13 18:44:37 +02:00
parent 2c43d7d24b
commit 4b0bc10900
3 changed files with 15 additions and 10 deletions

View File

@ -2034,14 +2034,14 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
// Defer the printing to ask about columns & rows // Defer the printing to ask about columns & rows
var defer = jQuery.Deferred(); var defer = jQuery.Deferred();
var pref = this.options.settings.columnselection_pref; var pref = this.options.settings.columnselection_pref;
if(pref.indexOf('nextmatch') == 0) if(pref.indexOf('nextmatch') == 0)
{ {
pref = 'nextmatch-'+pref; pref = 'nextmatch-'+pref;
} }
var app = this.getInstanceManager().app; var app = this.getInstanceManager().app;
var columns = {}; var columns = {};
var columnMgr = this.dataview.getColumnMgr(); var columnMgr = this.dataview.getColumnMgr();
pref += '_print'; pref += '_print';
@ -2200,7 +2200,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
window.setTimeout(function() {defer.resolve();}, 0); window.setTimeout(function() {defer.resolve();}, 0);
} }
},this); },this);
var dialog = et2_createWidget("dialog",{ var dialog = et2_createWidget("dialog",{
// If you use a template, the second parameter will be the value of the template, as if it were submitted. // If you use a template, the second parameter will be the value of the template, as if it were submitted.
callback: callback, // return false to prevent dialog closing callback: callback, // return false to prevent dialog closing
@ -2953,7 +2953,7 @@ var et2_nextmatch_header = (function(){ "use strict"; return et2_baseWidget.exte
this.label = _value; this.label = _value;
this.labelNode.text(_value); this.labelNode.text(_value);
// add class if label is empty // add class if label is empty
this.labelNode.toggleClass('et2_label_empty', !_value); this.labelNode.toggleClass('et2_label_empty', !_value);
} }
@ -3275,7 +3275,8 @@ var et2_nextmatch_filterheader = (function(){ "use strict"; return et2_taglist.e
this.nextmatch.applyFilters({col_filter: col_filter}); this.nextmatch.applyFilters({col_filter: col_filter});
} }
}, },
rows: { default: 2} rows: { default: 2},
class: {default: 'nm_filterheader_taglist'},
}, },
/** /**
@ -3420,7 +3421,7 @@ var et2_nextmatch_entryheader = (function(){ "use strict"; return et2_link_entry
col_filter[this.id] = this.get_value(); col_filter[this.id] = this.get_value();
this.nextmatch.applyFilters.call(this.nextmatch, {col_filter: col_filter}); this.nextmatch.applyFilters.call(this.nextmatch, {col_filter: col_filter});
}, },
/** /**
* Override to always return a string appname:id (or just id) for simple (one real selection) * Override to always return a string appname:id (or just id) for simple (one real selection)
* cases, parent returns an object. If multiple are selected, or anything other than app and * cases, parent returns an object. If multiple are selected, or anything other than app and

View File

@ -650,7 +650,7 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR
this.taglist.setMaxSelection(this._multiple ? this.options.maxSelection : 1); this.taglist.setMaxSelection(this._multiple ? this.options.maxSelection : 1);
if(!this._multiple && this.taglist.getValue().length > 1) if(!this._multiple && this.taglist.getValue().length > 1)
{ {
this.set_value(this.taglist.getValue()); this.set_value(multiple?this.taglist.getValue():this.taglist.getValue()[0]);
} }
// This changes sizes, so // This changes sizes, so
@ -829,9 +829,9 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR
min_width += this.taglist.trigger ? this.taglist.trigger.outerWidth(true) : 0; min_width += this.taglist.trigger ? this.taglist.trigger.outerWidth(true) : 0;
// Not enough for one // Not enough for one
if(min_width > this.div.width() || if(this.options.multiple && (min_width > this.div.width() ||
this.taglist.container.width() > this.div.width() || this.taglist.container.height() > this.div.height() this.taglist.container.width() > this.div.width() || this.taglist.container.height() > this.div.height()
) ))
{ {
this._setup_small(); this._setup_small();
} }

View File

@ -1110,7 +1110,7 @@ div .et2_taglist_single div.ms-sel-ctn div.ms-sel-item {
overflow: hidden; overflow: hidden;
} }
div .et2_taglist_single:not(.et2_taglist_small) div.ms-sel-ctn div.ms-sel-item { div .et2_taglist_single:not(.et2_taglist_small) div.ms-sel-ctn div.ms-sel-item {
width: calc(100% - 43px); width: calc(100% - 30px);
} }
.et2_taglist_single div.ms-sel-item > span:first-child { .et2_taglist_single div.ms-sel-item > span:first-child {
max-width: 100%; max-width: 100%;
@ -1185,6 +1185,10 @@ div .et2_taglist_small.et2_taglist_single div.ms-sel-ctn div.ms-sel-item {
overflow: hidden; overflow: hidden;
} }
.et2_taglist.et2_taglist_single.nm_filterheader_taglist div.ms-ctn input {
min-width: calc(100% - 30px);
}
/* Taglist category */ /* Taglist category */
.et2_taglist_category span[class*="cat_"] { .et2_taglist_category span[class*="cat_"] {
height: 1.7em; height: 1.7em;