Advanced search: WIP POC, UI/UX.

SVN:b1162[5425]
This commit is contained in:
Guillaume Lajarige
2018-03-14 13:00:08 +00:00
parent 5bc756716e
commit afdd43c5e3
3 changed files with 18 additions and 24 deletions

View File

@@ -95,8 +95,9 @@
<option name="FLAG_EXPLICIT_CONVERSION" value="true" />
<option name="IGNORE_NODESET_TO_BOOLEAN_VIA_STRING" value="true" />
</inspection_tool>
<inspection_tool class="InconsistentLineSeparators" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="IndexZeroUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSLastCommaInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSLastCommaInObjectLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="LossyEncoding" enabled="false" level="WARNING" enabled_by_default="false" />

View File

@@ -178,7 +178,6 @@ $(function()
// Update widget
this.options.operator = oActiveOpElem.find('.sfc_op_radio').val();
this.options.values = aValues;
// TODO: Update title
this._setTitle();
// Trigger event to handler
@@ -339,7 +338,7 @@ $(function()
if(sTitle === undefined)
{
// TODO: Make nice label
sTitle = this.options.field.label + ': ' + this._getValuesAsText();
sTitle = this.options.field.label + ' ' + this.operators[this.options.operator].label + ' ' + this._getValuesAsText();
}
this.element.find('.sfc_title').text(sTitle);
},
@@ -381,9 +380,24 @@ $(function()
oOpContentElem.val(this._getValuesAsText());
// Events
// - Focus input on click (radio, label, ...)
oOpElem.on('click', ':not(input[type="text"])', function(){
oOpContentElem.focus();
});
// - Apply on "enter" key hit
oOpContentElem.on('keyup', function(oEvent){
// Check operator's radio if not already
if(oOpElem.find('.sfc_op_radio').prop('checked') === false)
{
oOpElem.find('.sfc_op_radio').prop('checked', true)
}
// Apply if enter key
if(oEvent.key === 'Enter')
{
me._apply();
}
});
oOpElem.find('.sfc_op_content').append(oOpContentElem);
},

View File

@@ -70,26 +70,5 @@ $(function()
//------------------
// DOM element helpers
// _prepareElement: function()
// {
// var me = this;
//
// this._super();
//
// // TODO: Refactor this after UI mockups
// var oInputElem = $('<input type="text" />');
// oInputElem.on('change', function(){
// var sValue = $(this).val();
//
// me.options.values = [{
// value: sValue,
// label: sValue,
// }];
// me._setTitle();
//
// me.handler.triggerHandler('itop.search.criteria.value_changed');
// })
// .appendTo(this.element.find('.sfc_form_group'));
// },
});
});