mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 01:58:47 +02:00
Advanced search: UI/UX WIP, integration with endpoint.
SVN:b1162[5543]
This commit is contained in:
@@ -476,6 +476,12 @@ $(function()
|
||||
}
|
||||
|
||||
sTitle = Dict.Format(sDictEntry, this.options.field.label, this._getValuesAsText());
|
||||
|
||||
// Last chande fallback
|
||||
if(sTitle === sDictEntry)
|
||||
{
|
||||
sTitle = this.options.label;
|
||||
}
|
||||
}
|
||||
this.element.find('.sfc_title')
|
||||
.html(sTitle)
|
||||
@@ -589,6 +595,26 @@ $(function()
|
||||
|
||||
|
||||
// Values helpers
|
||||
// - Check if criteria has allowed values
|
||||
_hasAllowedValues: function()
|
||||
{
|
||||
return ( (this.options.field.allowed_values !== undefined) && (this.options.field.allowed_values !== null) );
|
||||
},
|
||||
// - Check if criteria has preloaded allowed values (as opposed to autocomplete)
|
||||
_hasPreloadedAllowedValues: function()
|
||||
{
|
||||
if(this._hasAllowedValues() && (this.options.field.allowed_values.values !== undefined) && (this.options.field.allowed_values.values !== null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
// - Return the preloaded allowed values (not coming from autocomplete)
|
||||
_getPreloadedAllowedValues: function()
|
||||
{
|
||||
return (this._hasPreloadedAllowedValues()) ? this.options.field.allowed_values.values : {};
|
||||
},
|
||||
// - Return current values
|
||||
_getValues: function()
|
||||
{
|
||||
@@ -631,6 +657,11 @@ $(function()
|
||||
// - Converts a snake_case string to CamelCase
|
||||
_toCamelCase: function(sString)
|
||||
{
|
||||
if( (sString === undefined) || (sString === null) )
|
||||
{
|
||||
return sString;
|
||||
}
|
||||
|
||||
var aParts = sString.split('_');
|
||||
|
||||
for(var i in aParts)
|
||||
|
||||
@@ -118,20 +118,20 @@ $(function()
|
||||
}
|
||||
|
||||
// - Regular allowed values
|
||||
if(this.options.field.allowed_values.values !== undefined)
|
||||
if (this._hasPreloadedAllowedValues())
|
||||
{
|
||||
var aSortedValues = this._sortValuesByLabel(this.options.field.allowed_values.values);
|
||||
for(var i in aSortedValues)
|
||||
var aSortedValues = this._sortValuesByLabel(this._getPreloadedAllowedValues());
|
||||
for (var i in aSortedValues)
|
||||
{
|
||||
var sValCode = aSortedValues[i][0];
|
||||
var sValLabel = aSortedValues[i][1];
|
||||
var oValueElem = $('<div></div>')
|
||||
.addClass('sfc_opc_mc_item')
|
||||
.attr('data-value-code', sValCode)
|
||||
.append('<label><input type="checkbox" value="' + sValCode + '"/>' + sValLabel + '</label>')
|
||||
.append('<label><input type="checkbox" value="'+sValCode+'"/>'+sValLabel+'</label>')
|
||||
.appendTo(oAllowedValuesElem);
|
||||
|
||||
if(this._isSelectedValues(sValCode))
|
||||
if (this._isSelectedValues(sValCode))
|
||||
{
|
||||
oValueElem.find(':checkbox').prop('checked', true);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ $(function()
|
||||
{
|
||||
var iValLimit = 3;
|
||||
var iValCount = Object.keys(this.options.values).length;
|
||||
var iAllowedValuesCount = (this.options.field.allowed_values.values !== undefined) ? Object.keys(this.options.field.allowed_values.values).length : 0;
|
||||
var iAllowedValuesCount = Object.keys(this._getPreloadedAllowedValues()).length;
|
||||
|
||||
// Manually increase allowed values count if null is allowed
|
||||
if(this.options.field.is_null_allowed === true)
|
||||
|
||||
Reference in New Issue
Block a user