Advanced search: WIP POC, UI/UX.

SVN:b1162[5440]
This commit is contained in:
Guillaume Lajarige
2018-03-16 08:59:29 +00:00
parent a1c6e32e28
commit f60d0b10e0
2 changed files with 18 additions and 6 deletions

View File

@@ -172,10 +172,11 @@ $(function()
// - Open it first
this.element.addClass('opened');
// - Then only check if more menu is to close to the right side (otherwise we might not have the right element's position)
var iPageWidth = $(document).width();
var iFormWidth = this.element.find('.sfc_form_group').outerWidth();
var iFormLeftPos = this.element.find('.sfc_form_group').offset().left;
if( (iFormWidth + iFormLeftPos) > (iPageWidth - 10 /* Security margin */) )
var iFormWidth = this.element.closest('.search_form_handler').outerWidth();
var iFormLeftPos = this.element.closest('.search_form_handler').offset().left;
var iContentWidth = this.element.find('.sfc_form_group').outerWidth();
var iContentLeftPos = this.element.find('.sfc_form_group').offset().left;
if( (iContentWidth + iContentLeftPos) > (iFormWidth + iFormLeftPos - 10 /* Security margin */) )
{
this.element.addClass('opened_left');
}

View File

@@ -133,6 +133,10 @@ $(function()
this.element.on('submit', function(oEvent){
oEvent.preventDefault();
});
// - Submit the search form
this.element.on('itop.search.form.submit', function(oEvent, oData){
me._onSubmit();
});
// Criteria events
this.element.on('itop.search.criteria.opening', function(oEvent, oData){
@@ -180,10 +184,11 @@ $(function()
// - Open it first
this.elements.more_criterion.addClass('opened');
// - Then only check if more menu is to close to the right side (otherwise we might not have the right element's position)
var iPageWidth = $(document).width();
var iFormWidth = this.element.outerWidth();
var iFormLeftPos = this.element.offset().left;
var iMenuWidth = this.elements.more_criterion.find('.sfm_content').outerWidth();
var iMenuLeftPos = this.elements.more_criterion.find('.sfm_content').offset().left;
if( (iMenuWidth + iMenuLeftPos) > (iPageWidth - 10 /* Security margin */) )
if( (iMenuWidth + iMenuLeftPos) > (iFormWidth + iFormLeftPos - 10 /* Security margin */) )
{
this.elements.more_criterion.addClass('opened_left');
}
@@ -480,6 +485,12 @@ $(function()
// Submit handlers
// - External event callback
_onSubmit: function()
{
this._submit();
},
// - Do the submit
_submit: function()
{
var me = this;