advanced search: bugfix on search criterion titles

SVN:trunk[5615]
This commit is contained in:
Bruno Da Silva
2018-04-05 10:00:08 +00:00
parent ee76eaedd6
commit a20fe37e98
3 changed files with 48 additions and 12 deletions

View File

@@ -1395,8 +1395,9 @@ When associated with a trigger, each action is given an "order" number, specifyi
// - Criteria titles
// - Default widget
'UI:Search:Criteria:Title:Default:Empty' => '%1$s is empty',
'UI:Search:Criteria:Title:Default:NotEmpty' => '%1$s is not empty',
'UI:Search:Criteria:Title:Default:Any' => '%1$s: Any',
'UI:Search:Criteria:Title:Default:Any:Empty' => '%1$s is empty',
'UI:Search:Criteria:Title:Default:Any:NotEmpty' => '%1$s is not empty',
'UI:Search:Criteria:Title:Default:Equals' => '%1$s equals %2$s',
'UI:Search:Criteria:Title:Default:Contains' => '%1$s contains %2$s',
'UI:Search:Criteria:Title:Default:StartsWith' => '%1$s starts with %2$s',
@@ -1422,6 +1423,7 @@ When associated with a trigger, each action is given an "order" number, specifyi
// - Enum widget
'UI:Search:Criteria:Title:Enum:In' => '%1$s: %2$s',
'UI:Search:Criteria:Title:Enum:In:Many' => '%1$s: %2$s and %3$s others',
'UI:Search:Criteria:Title:Enum:In:Many:Shortened' => '%1$s: %2$s selected',
'UI:Search:Criteria:Title:Enum:In:All' => '%1$s: Any',
// - External key widget
'UI:Search:Criteria:Title:ExternalKey:Empty' => '%1$s is defined',

View File

@@ -1213,8 +1213,9 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
// - Criteria titles
// - Default widget
'UI:Search:Criteria:Title:Default:Empty' => '%1$s vide',
'UI:Search:Criteria:Title:Default:NotEmpty' => '%1$s non vide',
'UI:Search:Criteria:Title:Default:Any' => '%1$s: Indifférent',
'UI:Search:Criteria:Title:Default:Any:Empty' => '%1$s vide',
'UI:Search:Criteria:Title:Default:Any:NotEmpty' => '%1$s non vide',
'UI:Search:Criteria:Title:Default:Equals' => '%1$s égal %2$s',
'UI:Search:Criteria:Title:Default:Contains' => '%1$s contient %2$s',
'UI:Search:Criteria:Title:Default:StartsWith' => '%1$s commence par %2$s',
@@ -1240,6 +1241,7 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
// - Enum widget
'UI:Search:Criteria:Title:Enum:In' => '%1$s : %2$s',
'UI:Search:Criteria:Title:Enum:In:Many' => '%1$s : %2$s et %3$s autres',
'UI:Search:Criteria:Title:Enum:In:Many:Shortened' => '%1$s: %2$s sélectionnés',
'UI:Search:Criteria:Title:Enum:In:All' => '%1$s : Indifférent',
// - External key widget
'UI:Search:Criteria:Title:ExternalKey:Empty' => '%1$s est renseigné',
@@ -1254,6 +1256,7 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
'UI:Search:Criteria:Operator:Default:Empty' => 'Vide',
'UI:Search:Criteria:Operator:Default:NotEmpty' => 'Non vide',
'UI:Search:Criteria:Operator:Default:Equals' => 'Egal',
'UI:Search:Criteria:Operator:Default:Between' => 'Compris entre',
// - String widget
'UI:Search:Criteria:Operator:String:Contains' => 'Contient',
'UI:Search:Criteria:Operator:String:StartsWith' => 'Commence par',

View File

@@ -472,21 +472,46 @@ $(function()
me[sCallback]($(this), me.options.values);
});
},
// - Set the title element
_setTitle: function(sTitle)
// - compture the title element
_computeTitle: function(sTitle)
{
if(sTitle === undefined)
{
var sValueAsText = this._getValuesAsText();
var sOperator = this.operators[this.options.operator].code;
var sDictEntry = 'UI:Search:Criteria:Title:' + this._toCamelCase(this.options.field.widget) + ':' + this._toCamelCase(sOperator);
// Fallback to default widget dict entry if none exists for the current widget
if(Dict.S(sDictEntry) === sDictEntry)
if ('' == sValueAsText)
{
sDictEntry = 'UI:Search:Criteria:Title:Default:' + this._toCamelCase(sOperator);
}
var sDictEntry = 'UI:Search:Criteria:Title:' + this._toCamelCase(this.options.field.widget) + ':Any'+ ':' + this._toCamelCase(sOperator);
var sTitle = Dict.Format(sDictEntry, this.options.field.label);
if(sTitle === sDictEntry)
{
var sDictEntry = 'UI:Search:Criteria:Title:Default:Any'+ ':' + this._toCamelCase(sOperator);
var sTitle = Dict.Format(sDictEntry, this.options.field.label);
}
sTitle = Dict.Format(sDictEntry, this.options.field.label, this._getValuesAsText());
if(sTitle === sDictEntry)
{
var sDictEntry = 'UI:Search:Criteria:Title:' + this._toCamelCase(this.options.field.widget) + ':Any';
var sTitle = Dict.Format(sDictEntry, this.options.field.label);
}
if(sTitle === sDictEntry)
{
var sTitle = Dict.Format('UI:Search:Criteria:Title:Default:Any', this.options.field.label);
}
}
else
{
var sDictEntry = 'UI:Search:Criteria:Title:' + this._toCamelCase(this.options.field.widget) + ':' + this._toCamelCase(sOperator);
var sTitle = Dict.Format(sDictEntry, this.options.field.label, sValueAsText);
// Fallback to default widget dict entry if none exists for the current widget
if(sTitle === sDictEntry)
{
sDictEntry = 'UI:Search:Criteria:Title:Default:' + this._toCamelCase(sOperator);
sTitle = Dict.Format(sDictEntry, this.options.field.label, sValueAsText);
}
}
// Last chande fallback
if(sTitle === sDictEntry)
@@ -494,6 +519,12 @@ $(function()
sTitle = this.options.label;
}
}
return sTitle;
},
// - Set the title element
_setTitle: function(sTitle)
{
sTitle = this._computeTitle(sTitle);
this.element.find('.sfc_title')
.html(sTitle)
.attr('title', sTitle);