Advanced search: WIP POC, UI/UX.

SVN:b1162[5486]
This commit is contained in:
Guillaume Lajarige
2018-03-21 13:10:48 +00:00
parent cfa5163590
commit 114a340527
9 changed files with 27 additions and 19 deletions

View File

@@ -114,6 +114,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_dict_entries('UI:Search:');
$this->add_dict_entries('UI:Button:');
$this->add_dict_entries('Error:');
if (!$this->IsPrintableVersion())

View File

@@ -899,6 +899,7 @@ input.dp-applied {
.search_form_handler .sf_criterion_area .search_form_criteria .sfc_form_group .sfc_fg_operators .sfc_fg_operator .sfc_opc_multichoices .sfc_opc_mc_filter {
position: relative;
margin-top: 8px;
margin-bottom: 8px;
}
.search_form_handler .sf_criterion_area .search_form_criteria .sfc_form_group .sfc_fg_operators .sfc_fg_operator .sfc_opc_multichoices .sfc_opc_mc_filter input {
width: 100%;
@@ -918,9 +919,6 @@ input.dp-applied {
/* -5px to compensate padding and keep aligned to the filter left side */
padding: 5px;
}
.search_form_handler .sf_criterion_area .search_form_criteria .sfc_form_group .sfc_fg_operators .sfc_fg_operator .sfc_opc_multichoices .sfc_opc_mc_items .sfc_opc_mc_item:first-of-type {
margin-top: 8px;
}
.search_form_handler .sf_criterion_area .search_form_criteria .sfc_form_group .sfc_fg_operators .sfc_fg_operator .sfc_opc_multichoices .sfc_opc_mc_items .sfc_opc_mc_item:hover {
padding: 4px;
/* Normal padding - border size */

View File

@@ -1010,6 +1010,7 @@ input.dp-applied {
.sfc_opc_mc_filter{
position: relative;
margin-top: 8px;
margin-bottom: 8px;
input{
width: 100%;
@@ -1030,9 +1031,6 @@ input.dp-applied {
margin: 0px -5px 0px -5px; /* -5px to compensate padding and keep aligned to the filter left side */
padding: 5px;
&:first-of-type{
margin-top: 8px;
}
&:hover{
padding: 4px; /* Normal padding - border size */
background-color: $white;

View File

@@ -1419,9 +1419,11 @@ When associated with a trigger, each action is given an "order" number, specifyi
'UI:Search:Criteria:Title:ExternalKey:Equals' => '%1$s %2$s',
'UI:Search:Criteria:Title:ExternalKey:In' => '%1$s: %2$s',
'UI:Search:Criteria:Title:ExternalKey:In:Many' => '%1$s: %2$s and %3$s others',
'UI:Search:Criteria:Title:ExternalKey:In:All' => '%1$s: Any',
// - 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:All' => '%1$s: Any',
// -
'UI:Search:Value:Filter:Placeholder' => 'Filter...',
'UI:Search:Value:Toggler:CheckAllNone' => 'Check all / none',

View File

@@ -1221,12 +1221,16 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
'UI:Search:Criteria:Title:String:StartsWith' => '%1$s commence par %2$s',
'UI:Search:Criteria:Title:String:EndsWith' => '%1$s fini par %2$s',
// - External key widget
'UI:Search:Criteria:Title:ExternalKey:Empty' => '%1$s est rempli',
'UI:Search:Criteria:Title:ExternalKey:NotEmpty' => '%1$s n\'est pas rempli',
'UI:Search:Criteria:Title:ExternalKey:Empty' => '%1$s est renseigné',
'UI:Search:Criteria:Title:ExternalKey:NotEmpty' => '%1$s n\'est pas renseigné',
'UI:Search:Criteria:Title:ExternalKey:Equals' => '%1$s %2$s',
'UI:Search:Criteria:Title:ExternalKey:In' => '%1$s: %2$s',
'UI:Search:Criteria:Title:ExternalKey:In:Many' => '%1$s: %2$s et %3$s autres',
'UI:Search:Criteria:Title:ExternalKey:In:All' => '%1$s: Indifférent',
// - 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:All' => '%1$s: Indifférent',
// -
'UI:Search:Value:Filter:Placeholder' => 'Filter...',
'UI:Search:Value:Toggler:CheckAllNone' => 'Check all / none',

View File

@@ -124,6 +124,12 @@ $(function()
var sOpIdx = aSortable[iIdx][0];
this.operators[sOpIdx] = this.options.available_operators[sOpIdx];
}
// Fallback operator in case the current operator is not available. Should not happen.
if(this.operators[this.options.operator] === undefined)
{
this.options.operator = Object.keys(this.operators)[0];
}
},
// - Bind external events
_bindEvents: function()
@@ -509,12 +515,10 @@ $(function()
var oOpContentElem = $('<input type="text" />');
oOpContentElem.val(this._getValuesAsText());
// Events
// - Focus input on click (radio, label, ...)
oOpElem.on('click', ':not(input[type="text"], select)', function(oEvent) {
//in order to prevent from the bubling of the event from inputs so their parents, we filter on oEvent.target, we could have stoped the bubling but it would have been a little agressive.
// Stopping propagation like this instead of oEvent.stopPropagation() as the event could be used by something.
if ($(oEvent.target).is('input[type="text"], select')) {
return;
}
@@ -584,7 +588,7 @@ $(function()
// Values helpers
// - Convert values to a standard string
// - Return current values
_getValues: function()
{
return this.options.values;

View File

@@ -170,7 +170,7 @@ $(function()
});
// - Apply on check
oAllowedValuesElem.find('.sfc_opc_mc_item').on('click', function(){
oAllowedValuesElem.find('.sfc_opc_mc_item').on('click', function(oEvent){
// Uncheck toggler
oTogglersElem.find('input:checkbox').prop('checked', false);

View File

@@ -9,11 +9,6 @@ $(function()
// default options
options:
{
// Overload default operator
'operator': 'IN',
// Available operators
'available_operators': {
},
},

View File

@@ -298,6 +298,7 @@ $(function()
// Content part
var oContentElem = $('<div class="sfm_content"></div>')
.appendTo(this.elements.more_criterion);
// - Add list
var oListElem = $('<ul class="sfm_list"></ul>')
.appendTo(oContentElem);
@@ -313,6 +314,7 @@ $(function()
.text(oField.label);
oListElem.append(oFieldElem);
}
// - Others
if(this.options.search.fields.others !== undefined)
{
@@ -593,7 +595,11 @@ $(function()
// - Called on form submit failures
_onSubmitFailure: function(oData)
{
this._setErrorMessage(oData.responseText);
// Fallback message in case the server send back only HTML markup.
var oErrorElem = $(oData.responseText);
var sErrorMessage = (oErrorElem.text() !== '') ? oErrorElem.text() : Dict.Format('Error:XHR:Fail', '');
this._setErrorMessage(sErrorMessage);
},
// - Called after form submits
_onSubmitAlways: function(oData)