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

opensource.org/licenses/MIT

Instance Method Summary collapse

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 search_bar appended=true, &block  
	if appended then
 		 :div, ((:div, capture(&block), :class => "btn-group", :data => {:toggle => "buttons-checkbox"} ) ), :class => "input-append"
 	else
 		 :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 search_bar_item(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
   
   button_tag( 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 search_bar_search_input(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 search_bar_submit(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
   
   button_tag( glyphicon(icon) + " " + title, opts)
end