Advanced search: WIP POC, integration with endpoint.

SVN:b1162[5402]
This commit is contained in:
Guillaume Lajarige
2018-03-09 13:34:04 +00:00
parent 1d96cbeb07
commit 767507d195
6 changed files with 31 additions and 10 deletions

View File

@@ -784,16 +784,23 @@ div.HRDrawer {
.search_form_handler .sf_criterion_area .search_form_criteria {
display: inline-block;
margin-right: 3px;
/* Special criterion processing */
}
.search_form_handler .sf_criterion_area .search_form_criteria.locked {
background-color: #f1f1f1;
}
.search_form_handler .sf_criterion_area .search_form_criteria .sfc_title {
cursor: pointer;
}
.search_form_handler .sf_criterion_area .search_form_criteria .sfc_form_group {
display: none;
}
.search_form_handler .sf_criterion_area .search_form_criteria .sfc_form_group.opened {
display: block;
}
.search_form_handler .sf_criterion_area .search_form_criteria.search_form_criteria_raw .sfc_title {
cursor: initial;
}
.search_form_handler .sf_criterion_area .sf_more_criterion .sf_mc_list {
position: absolute;
margin: 0px;

View File

@@ -885,7 +885,7 @@ div.HRDrawer {
}
}
.sfc_title{
cursor: pointer;
}
.sfc_form_group{
display: none;
@@ -894,6 +894,13 @@ div.HRDrawer {
display: block;
}
}
/* Special criterion processing */
&.search_form_criteria_raw{
.sfc_title{
cursor: initial;
}
}
}
/* More criterion */

View File

@@ -141,27 +141,31 @@ $(function()
// Fill criteria
this._setTitle();
},
// - Set the title element
_setTitle: function(sTitle)
{
if(sTitle === undefined)
{
// TODO: Make nice label
sTitle = this.options.field.label + ': ' + this._getValuesAsText();
}
this.element.find('.sfc_title').text(sTitle);
},
// Values helpers
// - Convert values to a standard string
_getValuesAsText: function()
{
var aValues = [];
for(var iValueIdx in this.options.values)
{
aValues.push(this.options.values[iValueIdx].value);
aValues.push(this.options.values[iValueIdx].label);
}
return aValues.join(', ');
},
// - Make an OQL expression from the criteria values and operator
_makeOQLExpression: function()
{
var aValues = [];

View File

@@ -43,6 +43,10 @@ $(function()
this._super( key, value );
},
//------------------
// Inherited methods
//------------------
// DOM element helpers
_prepareElement: function()
{

View File

@@ -9,6 +9,7 @@ $(function()
// default options
options:
{
operator: 'contains',
},
// the constructor
@@ -43,6 +44,10 @@ $(function()
this._super( key, value );
},
//------------------
// Inherited methods
//------------------
// DOM element helpers
_prepareElement: function()
{
@@ -65,13 +70,5 @@ $(function()
})
.appendTo(this.element.find('.sfc_form_group'));
},
_setTitle: function(sTitle)
{
if(sTitle === undefined)
{
sTitle = this.options.field.label + ': ' + this._getValuesAsText();
}
this._super(sTitle);
},
});
});

View File

@@ -339,6 +339,8 @@ $(function()
// Show loader
this._showLoader();
// TODO: Make a throttle mecanism or cancel previous call when a newer is made.
// Do submit
$.post(
this.options.endpoint,