started to mix search form and advanced search form into one unique block, the idea is to switch to one from an other with tabs
This commit is contained in:
parent
9bfbd861ca
commit
55700094a2
@ -618,17 +618,17 @@ function materio_search_api_search_form($form, &$form_state){
|
||||
$args = arg();
|
||||
$path = array_shift($args);
|
||||
// dsm($args, 'args');
|
||||
if(isset($args[0]) && $args[0] == "advanced"){
|
||||
$advanced = true;
|
||||
array_shift($args);
|
||||
// dsm($args, 'shifted arsg');
|
||||
// foreach ($args as $arg) {
|
||||
// $typed[] = $arg;//(integer)$arg;
|
||||
// }
|
||||
$keys = implode(' +', $args);
|
||||
}else{
|
||||
// if(isset($args[0]) && $args[0] == "advanced"){
|
||||
// $advanced = true;
|
||||
// array_shift($args);
|
||||
// // dsm($args, 'shifted arsg');
|
||||
// // foreach ($args as $arg) {
|
||||
// // $typed[] = $arg;//(integer)$arg;
|
||||
// // }
|
||||
// $keys = implode(' +', $args);
|
||||
// }else{
|
||||
$keys = implode('/', $args);
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@ -643,20 +643,6 @@ function materio_search_api_search_form($form, &$form_state){
|
||||
$default_value = '';
|
||||
}
|
||||
|
||||
// add a back to search/base home bouton if on explore/foo
|
||||
if ($path == 'explore' || $path == 'bookmarks' || $path == 'lists' ) {
|
||||
$link = l('<i class="fi-home"></i>', base_path().'actuality', array(
|
||||
'html'=>true,
|
||||
'attributes'=>array('class'=>'back-search-home')
|
||||
));
|
||||
|
||||
$form['actu'] = array(
|
||||
'#type' => 'markup',
|
||||
'#markup' => $link,
|
||||
//'<a href="'.base_path().'actuality" class="back-search-home"><i class="fi-home"></i></a>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$form['searchfield'] = array(
|
||||
'#type' => 'textfield',
|
||||
@ -693,6 +679,27 @@ function materio_search_api_search_form($form, &$form_state){
|
||||
'#src' => drupal_get_path('module', 'materio_search_api') . '/images/search.png',
|
||||
'#value' => t('Search'),
|
||||
);
|
||||
|
||||
// add a back to search/base home bouton if on explore/foo
|
||||
if ($path == 'explore' || $path == 'bookmarks' || $path == 'lists' ) {
|
||||
|
||||
// buttons form container
|
||||
$form['rightcol'] = array(
|
||||
'#type' => 'container',
|
||||
);
|
||||
|
||||
$link = l('<i class="fi-home"></i>', base_path().'actuality', array(
|
||||
'html'=>true,
|
||||
'attributes'=>array('class'=>'back-search-home')
|
||||
));
|
||||
|
||||
$form['rightcol']['actu'] = array(
|
||||
'#type' => 'markup',
|
||||
'#markup' => $link,
|
||||
//'<a href="'.base_path().'actuality" class="back-search-home"><i class="fi-home"></i></a>'
|
||||
);
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@ -742,7 +749,7 @@ function materio_search_api_search_form_submit($form, &$form_state){
|
||||
* materio_search_api_advanced_search_form()
|
||||
*/
|
||||
function materio_search_api_advanced_search_form($form, &$form_state){
|
||||
dsm($form_state, 'form_state');
|
||||
// dsm($form_state, 'form_state');
|
||||
// dsm($form, 'form');
|
||||
// global $user;
|
||||
// $form = array();
|
||||
@ -858,7 +865,7 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
||||
}else{
|
||||
$ll = $l;
|
||||
}
|
||||
dsm("l : ".$l." | ll : ".$ll);
|
||||
// dsm("l : ".$l." | ll : ".$ll);
|
||||
|
||||
$form['filters']['filterline-'.$ll] = array(
|
||||
'#type' => 'container',
|
||||
@ -877,7 +884,7 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
||||
}elseif(isset($args_values[$l][0])){
|
||||
$default0 = $args_values[$l][0];
|
||||
}
|
||||
dsm($default0, "default 0");
|
||||
// dsm($default0, "default 0");
|
||||
|
||||
// form select element for first level
|
||||
$form['filters']['filterline-'.$ll]['filter-'.$ll.'-0'] = array(
|
||||
@ -916,7 +923,7 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
||||
}elseif(isset($args_values[$l][1])){
|
||||
$default1 = $args_values[$l][1];
|
||||
}
|
||||
dsm($default1, "default 1");
|
||||
// dsm($default1, "default 1");
|
||||
|
||||
// form select element for second level
|
||||
$form['filters']['filterline-'.$ll]['filter-'.$ll.'-1'] = array(
|
||||
@ -947,7 +954,7 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
||||
}elseif(isset($args_values[$l][2])){
|
||||
$default2 = $args_values[$l][2];
|
||||
}
|
||||
dsm($default2, "default 2");
|
||||
// dsm($default2, "default 2");
|
||||
|
||||
$level_2_ops = array();
|
||||
foreach ($taxotree2 as $index => $term) {
|
||||
@ -1008,7 +1015,7 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
||||
),
|
||||
);
|
||||
|
||||
// filters form container
|
||||
// buttons form container
|
||||
$form['rightcol'] = array(
|
||||
'#type' => 'container',
|
||||
);
|
||||
@ -1033,29 +1040,29 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
||||
'#return_value' => "search",
|
||||
);
|
||||
|
||||
dsm($form, 'form');
|
||||
// dsm($form, 'form');
|
||||
return $form;
|
||||
}
|
||||
|
||||
function materio_search_api_advanced_search_select_callback($form, &$form_state) {
|
||||
return $form['filters'];
|
||||
}
|
||||
|
||||
function materio_search_api_advanced_search_addfilter_callback($form, &$form_state) {
|
||||
return $form['filters'];
|
||||
}
|
||||
|
||||
function materio_search_api_advanced_search_rmline_callback($form, &$form_state) {
|
||||
return $form['filters'];
|
||||
}
|
||||
|
||||
function materio_search_api_advanced_search_form_validate($form, &$form_state){
|
||||
// dsm($form, '$form');
|
||||
// dsm($form_state, '$form_state');
|
||||
// dsm(strlen($form_state['values']['searchfield']));
|
||||
// if (strlen(trim($form_state['values']['searchfield'])) <= 1) {
|
||||
// form_set_error('searchfield', 'Please enter at least 2 characters keyword.');
|
||||
// }
|
||||
if($form_state['triggering_element']['#name'] == 'search'){
|
||||
// dsm($form, '$form');
|
||||
dsm($form_state, 'form_state');
|
||||
|
||||
if (!isset($form_state['values']['filter-0-1']) || $form_state['values']['filter-0-1'] == '') {
|
||||
form_set_error('filters', 'Please choose at least 1 keyword.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function materio_search_api_advanced_search_form_submit($form, &$form_state){
|
||||
@ -1190,7 +1197,11 @@ function materio_search_api_theme($existing, $type, $theme, $path) {
|
||||
*/
|
||||
function template_preprocess_materio_search_api_search_block(&$vars){
|
||||
// dsm($vars, '$vars');
|
||||
$vars['search_title'] = t("Text search");
|
||||
$vars['searchform'] = drupal_get_form("materio_search_api_search_form");
|
||||
|
||||
$vars['advanced_search_title'] = t("Filtered search");
|
||||
$vars['advanced_searchform'] = drupal_get_form("materio_search_api_advanced_search_form");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,11 @@
|
||||
<div class="inner">
|
||||
<div class="msa-search">
|
||||
<h4><?php print $search_title; ?></h4>
|
||||
<?php print render($searchform); ?>
|
||||
</div>
|
||||
<div class="msa-advanced-search">
|
||||
<h4><?php print $advanced_search_title; ?></h4>
|
||||
<?php print render($advanced_searchform); ?>
|
||||
</div>
|
||||
|
||||
<?php print render($searchform); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3824,6 +3824,14 @@ body.home-v2 #main {
|
||||
#tool-bar #block-materio-search-api-materio-search-api-search > .inner:active {
|
||||
transition: box-shadow 0s ease-out;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4); }
|
||||
#tool-bar #block-materio-search-api-materio-search-api-search > .inner > div {
|
||||
padding-top: 0.5em; }
|
||||
#tool-bar #block-materio-search-api-materio-search-api-search > .inner > div h4 {
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
font-size: 14px; }
|
||||
#tool-bar #block-materio-search-api-materio-search-api-search > .inner > div:not(:first-of-type) {
|
||||
margin-top: 0.5em; }
|
||||
#tool-bar #materio-search-api-search-form {
|
||||
text-align: right;
|
||||
display: moz-inline-stack;
|
||||
@ -3832,7 +3840,7 @@ body.home-v2 #main {
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
margin: 0; }
|
||||
#tool-bar #materio-search-api-search-form .form-item, #tool-bar #materio-search-api-search-form input, #tool-bar #materio-search-api-search-form .form-checkboxes {
|
||||
#tool-bar #materio-search-api-search-form .form-item, #tool-bar #materio-search-api-search-form input, #tool-bar #materio-search-api-search-form .form-checkboxes, #tool-bar #materio-search-api-search-form .form-wrapper {
|
||||
display: moz-inline-stack;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
@ -3848,11 +3856,14 @@ body.home-v2 #main {
|
||||
margin: 0 5px; }
|
||||
#tool-bar #materio-search-api-search-form .form-checkboxes .form-item label {
|
||||
font-size: 10px; }
|
||||
#tool-bar #materio-search-api-search-form #edit-rightcol {
|
||||
padding-left: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
border-left: 1px solid #ccc; }
|
||||
#tool-bar #materio-search-api-search-form a.back-search-home {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
color: #000;
|
||||
padding: 0 0.5em 0 0.2em; }
|
||||
color: #000; }
|
||||
#tool-bar #materio-search-api-search-form a.back-search-home i:before {
|
||||
font-size: 1.3em; }
|
||||
#tool-bar #materio-search-api-search-form input#edit-searchfield {
|
||||
@ -3880,43 +3891,23 @@ body.home-v2 #main {
|
||||
width: 16em; }
|
||||
#tool-bar #materio-search-api-search-form #edit-bundles-filter {
|
||||
display: none; } }
|
||||
#tool-bar #block-materio-search-api-mo-searchapi-advanced-search {
|
||||
float: right; }
|
||||
#tool-bar #block-materio-search-api-mo-searchapi-advanced-search > .inner {
|
||||
display: moz-inline-stack;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
margin: 0 0 0 10px;
|
||||
padding: 3px 10px;
|
||||
background-color: #fff;
|
||||
border-radius: 3px;
|
||||
background-clip: padding-box;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
|
||||
transition: box-shadow 0.3s ease-out; }
|
||||
#tool-bar #block-materio-search-api-mo-searchapi-advanced-search > .inner:hover, #tool-bar #block-materio-search-api-mo-searchapi-advanced-search > .inner:focus {
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.7); }
|
||||
#tool-bar #block-materio-search-api-mo-searchapi-advanced-search > .inner:active {
|
||||
transition: box-shadow 0s ease-out;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4); }
|
||||
#tool-bar #materio-search-api-advanced-search-form > div {
|
||||
position: relative; }
|
||||
#tool-bar #materio-search-api-advanced-search-form #advancedsearch-filters, #tool-bar #materio-search-api-advanced-search-form #edit-rightcol {
|
||||
display: inline-block;
|
||||
vertical-align: top; }
|
||||
#tool-bar #materio-search-api-advanced-search-form #edit-rightcol {
|
||||
position: relative;
|
||||
text-align: center; }
|
||||
#tool-bar #materio-search-api-advanced-search-form #edit-rightcol > * {
|
||||
display: block; }
|
||||
#tool-bar #materio-search-api-advanced-search-form #edit-rightcol a.back-search-home {
|
||||
color: #000;
|
||||
padding-top: 0.45em; }
|
||||
#tool-bar #materio-search-api-advanced-search-form #edit-rightcol a.back-search-home i:before {
|
||||
font-size: 1.3em; }
|
||||
#tool-bar #materio-search-api-advanced-search-form #edit-rightcol #edit-search {
|
||||
margin: 1em 0 0.5em; }
|
||||
#tool-bar #materio-search-api-advanced-search-form > div #advancedsearch-filters, #tool-bar #materio-search-api-advanced-search-form > div > .form-wrapper {
|
||||
display: inline-block;
|
||||
vertical-align: top; }
|
||||
#tool-bar #materio-search-api-advanced-search-form > div > .form-wrapper {
|
||||
position: relative;
|
||||
text-align: center; }
|
||||
#tool-bar #materio-search-api-advanced-search-form > div > .form-wrapper > * {
|
||||
display: block; }
|
||||
#tool-bar #materio-search-api-advanced-search-form > div > .form-wrapper a.back-search-home {
|
||||
color: #000;
|
||||
padding-top: 0.45em; }
|
||||
#tool-bar #materio-search-api-advanced-search-form > div > .form-wrapper a.back-search-home i:before {
|
||||
font-size: 1.3em; }
|
||||
#tool-bar #materio-search-api-advanced-search-form > div > .form-wrapper #edit-search {
|
||||
margin: 1em 0 0.5em; }
|
||||
#tool-bar #materio-search-api-advanced-search-form #advancedsearch-filters {
|
||||
padding-right: 0.5em;
|
||||
margin-right: 0.5em;
|
||||
|
@ -1030,12 +1030,12 @@ $headerouterheight:$headerheight+$headerpaddingtop+$headerpaddingbottom;
|
||||
}
|
||||
}
|
||||
|
||||
// _____ __
|
||||
// / ___/___ ____ ___________/ /_
|
||||
// \__ \/ _ \/ __ `/ ___/ ___/ __ \
|
||||
// ___/ / __/ /_/ / / / /__/ / / /
|
||||
// /____/\___/\__,_/_/ \___/_/ /_/
|
||||
|
||||
// _____ __ ____ __ __
|
||||
// / ___/___ ____ ___________/ /_ / __ )/ /___ _____/ /__
|
||||
// \__ \/ _ \/ __ `/ ___/ ___/ __ \ / __ / / __ \/ ___/ //_/
|
||||
// ___/ / __/ /_/ / / / /__/ / / / / /_/ / / /_/ / /__/ ,<
|
||||
// /____/\___/\__,_/_/ \___/_/ /_/ /_____/_/\____/\___/_/|_|
|
||||
#block-materio-search-api-materio-search-api-search{
|
||||
// @include inlineblock(); vertical-align: middle ;
|
||||
// position:absolute; top:10px; right:0;
|
||||
@ -1044,14 +1044,33 @@ $headerouterheight:$headerheight+$headerpaddingtop+$headerpaddingbottom;
|
||||
@include inlineblock(); margin:0 0 0 10px;
|
||||
padding: 3px 10px; background-color:#fff; @include rounded(3px);
|
||||
@include shadowBtn(); text-align: right;
|
||||
|
||||
>div{
|
||||
h4{
|
||||
margin:0;
|
||||
text-align: left;
|
||||
@include fs14;
|
||||
}
|
||||
padding-top: 0.5em;
|
||||
&:not(:first-of-type){
|
||||
margin-top: 0.5em;
|
||||
// border-top: 1px solid #ccc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// _____ __
|
||||
// / ___/___ ____ ___________/ /_
|
||||
// \__ \/ _ \/ __ `/ ___/ ___/ __ \
|
||||
// ___/ / __/ /_/ / / / /__/ / / /
|
||||
// /____/\___/\__,_/_/ \___/_/ /_/
|
||||
|
||||
#materio-search-api-search-form{
|
||||
text-align: right;
|
||||
@include inlineblock(); margin: 0;
|
||||
|
||||
.form-item, input, .form-checkboxes{@include inlineblock(); margin:0; vertical-align:middle; padding:0;}
|
||||
.form-item, input, .form-checkboxes, .form-wrapper{@include inlineblock(); margin:0; vertical-align:middle; padding:0;}
|
||||
|
||||
.form-checkboxes{
|
||||
padding: 3px; @include fs12;
|
||||
@ -1061,11 +1080,18 @@ $headerouterheight:$headerheight+$headerpaddingtop+$headerpaddingbottom;
|
||||
}
|
||||
}
|
||||
|
||||
#edit-rightcol{
|
||||
padding-left: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
a.back-search-home{
|
||||
display:inline-block;
|
||||
vertical-align: middle;
|
||||
color:#000;
|
||||
padding: 0 0.5em 0 0.2em;
|
||||
// padding: 0 0.2em 0 0.5em;
|
||||
// margin-left: 0.5em;
|
||||
// border-left: 1px solid #ccc;
|
||||
i:before{
|
||||
font-size:1.3em;
|
||||
}
|
||||
@ -1086,7 +1112,9 @@ $headerouterheight:$headerheight+$headerpaddingtop+$headerpaddingbottom;
|
||||
}
|
||||
};
|
||||
|
||||
input#edit-create{ padding: 3px; }
|
||||
input#edit-create{
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
&.loading{
|
||||
background: transparent url('../img/ajax-loader.gif') no-repeat 98% center;
|
||||
@ -1105,85 +1133,84 @@ $headerouterheight:$headerheight+$headerpaddingtop+$headerpaddingbottom;
|
||||
// / ___ / /_/ /| |/ / /_/ / / / / /__/ __/ /_/ / ___/ / __/ /_/ / / / /__/ / / /
|
||||
// /_/ |_\__,_/ |___/\__,_/_/ /_/\___/\___/\__,_/ /____/\___/\__,_/_/ \___/_/ /_/
|
||||
|
||||
#block-materio-search-api-mo-searchapi-advanced-search{
|
||||
// @include inlineblock(); vertical-align: middle ;
|
||||
// position:absolute; top:10px; right:0;
|
||||
float:right;
|
||||
>.inner{
|
||||
@include inlineblock(); margin:0 0 0 10px;
|
||||
padding: 3px 10px; background-color:#fff; @include rounded(3px);
|
||||
@include shadowBtn();
|
||||
// text-align: right;
|
||||
}
|
||||
}
|
||||
// #block-materio-search-api-mo-searchapi-advanced-search{
|
||||
// // @include inlineblock(); vertical-align: middle ;
|
||||
// // position:absolute; top:10px; right:0;
|
||||
// float:right;
|
||||
// >.inner{
|
||||
// @include inlineblock(); margin:0 0 0 10px;
|
||||
// padding: 3px 10px; background-color:#fff; @include rounded(3px);
|
||||
// @include shadowBtn();
|
||||
// // text-align: right;
|
||||
// }
|
||||
|
||||
#materio-search-api-advanced-search-form{
|
||||
>div{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#advancedsearch-filters, #edit-rightcol{
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#edit-rightcol{
|
||||
position: relative;
|
||||
text-align: center;
|
||||
>*{display:block;}
|
||||
a.back-search-home{
|
||||
color:#000;
|
||||
padding-top: 0.45em;
|
||||
i:before{
|
||||
font-size:1.3em;
|
||||
}
|
||||
}
|
||||
#edit-search{
|
||||
margin: 1em 0 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
#advancedsearch-filters{
|
||||
padding-right: 0.5em;
|
||||
margin-right: 0.5em;
|
||||
border-right: 1px solid #ccc;
|
||||
|
||||
.filter-line{
|
||||
margin:0.3em 0;
|
||||
padding-top:0.3em;
|
||||
|
||||
&:not(:first-child){
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
.form-item{
|
||||
display:inline-block;
|
||||
vertical-align: middle;
|
||||
@include fs12; line-height:1;
|
||||
// padding-right:3em;
|
||||
text-transform: capitalize;
|
||||
// min-width : 4em;
|
||||
margin:0 0em 0 0;
|
||||
#materio-search-api-advanced-search-form{
|
||||
>div{
|
||||
position: relative;
|
||||
#advancedsearch-filters, >.form-wrapper{
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
select{
|
||||
width:auto;
|
||||
|
||||
>.form-wrapper{
|
||||
position: relative;
|
||||
text-align: center;
|
||||
>*{display:block;}
|
||||
a.back-search-home{
|
||||
color:#000;
|
||||
padding-top: 0.45em;
|
||||
i:before{
|
||||
font-size:1.3em;
|
||||
}
|
||||
}
|
||||
#edit-search{
|
||||
margin: 1em 0 0.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rm-btn{
|
||||
float: right;
|
||||
margin:0.4em 0 0.4em 0.4em;
|
||||
|
||||
#advancedsearch-filters{
|
||||
padding-right: 0.5em;
|
||||
margin-right: 0.5em;
|
||||
border-right: 1px solid #ccc;
|
||||
|
||||
.filter-line{
|
||||
margin:0.3em 0;
|
||||
padding-top:0.3em;
|
||||
|
||||
&:not(:first-child){
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
.form-item{
|
||||
display:inline-block;
|
||||
vertical-align: middle;
|
||||
@include fs12; line-height:1;
|
||||
// padding-right:3em;
|
||||
text-transform: capitalize;
|
||||
// min-width : 4em;
|
||||
margin:0 0em 0 0;
|
||||
}
|
||||
|
||||
select{
|
||||
width:auto;
|
||||
}
|
||||
}
|
||||
|
||||
.rm-btn{
|
||||
float: right;
|
||||
margin:0.4em 0 0.4em 0.4em;
|
||||
}
|
||||
|
||||
.add-filter{
|
||||
margin:0.5em 0;
|
||||
}
|
||||
}
|
||||
|
||||
.add-filter{
|
||||
margin:0.5em 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user