Module: BootstrapSearchbarHelper
- Defined in:
- app/helpers/bootstrap_searchbar_helper.rb
Overview
RAILS BOOTSTRAP ENGINE
Search Bar
Copyright 2012-2013 Luiz Eduardo de Oliveira Fonseca, AgĂȘncia Orangeweb
Licensed under The MIT License
Instance Method Summary collapse
- #search_bar(appended = true, &block) ⇒ Object
- #search_bar_item(title, name, value, opts = {}) ⇒ Object
- #search_bar_search_input(placeholder = "O que deseja Pesquisar?") ⇒ Object
- #search_bar_submit(title = "Pesquisar", color = :primary, icon = :search, opts = {}) ⇒ Object
Instance Method Details
#search_bar(appended = true, &block) ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/helpers/bootstrap_searchbar_helper.rb', line 20 def appended=true, &block if appended then content_tag :div, (content_tag(:div, capture(&block), :class => "btn-group", :data => {:toggle => "buttons-checkbox"} ) ), :class => "input-append" else content_tag :div, capture(&block), :class => "btn-group", :data => {:toggle => "buttons-checkbox"} end end |
#search_bar_item(title, name, value, opts = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/helpers/bootstrap_searchbar_helper.rb', line 54 def (title, name, value, opts={}) opts[:class] = "" if opts[:class].nil? opts[:class] << " btn " opts[:type] = :button opts[:name] = name opts[:value] = value if params.include?(name) then opts[:class] << " active " end ( title, opts) end |
#search_bar_search_input(placeholder = "O que deseja Pesquisar?") ⇒ Object
33 34 35 |
# File 'app/helpers/bootstrap_searchbar_helper.rb', line 33 def (placeholder = "O que deseja Pesquisar?") text_field_tag 'search', params[:search], :placeholder => placeholder end |
#search_bar_submit(title = "Pesquisar", color = :primary, icon = :search, opts = {}) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'app/helpers/bootstrap_searchbar_helper.rb', line 41 def (title = "Pesquisar", color = :primary, icon = :search, opts={}) opts[:class] = "" if opts[:class].nil? opts[:class] << " btn btn-#{color.to_s}" opts[:type] = :submit opts[:name] = nil ( glyphicon(icon) + " " + title, opts) end |