Skip to content

Instantly share code, notes, and snippets.

@robksawyer
Last active December 22, 2015 09:29
Show Gist options
  • Save robksawyer/e59bc16ec4e6fd74d51c to your computer and use it in GitHub Desktop.
Save robksawyer/e59bc16ec4e6fd74d51c to your computer and use it in GitHub Desktop.
Applicable view code for search
<div class='search row-fluid'>
<div class="well">
<?php
$formOptions = array(
'class' => 'form-search',
'id' => 'CheeseSearchForm'
);
if(!empty($this->params['pass'])){
$formOptions['url'] = array_merge(array('action' => 'index'), $this->params['pass']);
}
echo $this->Form->create('Cheese', $formOptions);
?>
<div class="input-append">
<?php
//debug($this->passedArgs);
echo $this->TwitterBootstrap->search(
'Cheese.query', array(
'class' => 'input-xlarge search-query',
'label' => false,
'placeholder' => 'What are you eating?',
'id' => 'SearchQueryCheese',
'value' => $name,
'onkeyup' => 'javascript:the_api.update_search_url(this.value, ' . $this->passedArgs . ', "Cheese", true)',
'style' => 'margin-bottom:10px'
));
echo $this->Form->submit('Search',array('class'=>'btn','div'=>false));
echo "&nbsp;".$this->Html->image('common/ajax-loader.gif',array('id'=>"SearchLoader",'style'=>'display:none'));
?>
</div>
<?php echo $this->Html->link('<i class="icon-filter">&nbsp;</i>Toggle Filter','#', array(
'class' => 'btn',
'escape' => false,
'onclick' => 'javascript: the_api.toggleFilters(false, true)',
'style' => 'margin-top: -8px'
)); ?>
<div class="row-fluid filter-container" id="filter-container" style="display:none;">
<div class='input'>
<?php
echo $this->Search->input('milkSource',array('type'=>'select','class'=>'chzn-select input-medium','div'=>false,'empty'=>'Milk Source','label'=>false)).'&nbsp;';
echo $this->Search->input('milkTreatment',array('type'=>'select','class'=>'chzn-select input-medium','div'=>false,'empty'=>'Milk Treatment','label'=>false)).'&nbsp;';
echo $this->Search->input('texture',array('type'=>'select','class'=>'chzn-select input-medium','div'=>false,'empty'=>'Texture','label'=>false)).'&nbsp;';
echo $this->Search->input('rennetType',array('type'=>'select','class'=>'chzn-select input-medium','div'=>false,'empty'=>'Coagulant','label'=>false)).'&nbsp;';
echo $this->Search->input('rind',array('type'=>'select','class'=>'chzn-select input-medium','div'=>false,'empty'=>'Rind Type','label'=>false)).'&nbsp;';
echo $this->Search->input('stateRegion',array('type'=>'select','class'=>'chzn-select input-medium','div'=>false,'empty'=>'State/Region','label'=>false)).'&nbsp;';
echo $this->Search->input('country',array('type'=>'select','class'=>'chzn-select input-medium','div'=>false,'empty'=>'Country','label'=>false)).'&nbsp;';
echo $this->Html->link("Reset",'#',array('class'=>'btn btn-mini','div'=>false,'onclick'=>'javascript:resetFilters()','escape'=>false,'title'=>'Reset filters'));
?>
</div>
</div>
<?php echo $this->Form->end(); ?>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment