Sha256: 4aa6f319b867a26bb5a883f30677f3bd46b5405f4fda0719092d368c402647ae

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 KB

Contents

:ruby
  searchable_columns = fancygrid.serachable_leafs.map{ |leaf| 
    [leaf.human_name, leaf.tag_name] 
  }
  search_operators = fancygrid.search_operators.map { |op| 
    [I18n.t(:"search.operator.#{op.to_s}", :default => op.to_s.humanize, :scope => Fancygrid.i18n_scope ), op.to_s] 
  }
   
= field_set_tag( t(:"search.title", :default => "Search", :scope => Fancygrid.i18n_scope), :class => :"fg-search" ) do
  .fg-search-controls
    = fancygrid_button(:"fg-search-add", :"search.add", 'Add')
    = fancygrid_button(:"fg-search-submit", :"search.submit", 'Search')
    = fancygrid_button(:"fg-clear", :"search.clear", 'Clear search')
    = check_box_tag(:"fg-search-conditions", :all, fancygrid.view.get_search_operator.to_s == "all")
    = label_tag(:"fg-search-conditions", t(:"fancygrid.search.conditions", :default => 'All conditions must met:'))
      
  %ul.fg-search-criteria
    - fancygrid.each_visible_leaf do |leaf|
      - fancygrid.view.get_node_search_conditions(leaf).each do |condition|
        %li.fg-search-criterion
          = fancygrid_button(:"fg-search-remove", :"search.remove", "Remove")
          = select_tag(:column_name, options_for_select(searchable_columns, leaf.tag_name))    
          = select_tag(:operator, options_for_select(search_operators, condition[:operator]))
          = text_field_tag(:column_value, condition[:value])
  

      
.fg-search-template
  %li.fg-search-criterion
    = fancygrid_button(:"fg-search-remove", :"search.remove", "Remove")
    = select_tag(:column_name, options_for_select(searchable_columns))    
    = select_tag(:operator, options_for_select(search_operators ))
    = text_field_tag(:column_value, "")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fancygrid-1.1.0 app/views/fancygrid/base/search.html.haml
fancygrid-1.0.0 app/views/fancygrid/base/search.html.haml