Module: RailsBootstrapHelpers::LayoutHelper
- Defined in:
- app/helpers/rails_bootstrap_helpers/layout_helper.rb
Instance Method Summary collapse
- #bootstrap_button_class(color = nil) ⇒ Object
- #bootstrap_label(text, type) ⇒ Object
- #bootstrap_link_to(title, link, color, options = {}) ⇒ Object
- #conditional_bootstrap_label(condition, text, success = :success, failure = :important) ⇒ Object
- #pills(&block) ⇒ Object
- #stacked_pills(&block) ⇒ Object
- #stacked_tabs(&block) ⇒ Object
- #striped_table(id = nil, &block) ⇒ Object
- #tabs(&block) ⇒ Object
Instance Method Details
#bootstrap_button_class(color = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 30 def (color = nil) case color when :red then "btn btn-danger" when :blue then "btn btn-primary" when :light_blue then "btn btn-info" when :green then "btn btn-success" when :yellow then "btn btn-warning" else "btn" end end |
#bootstrap_label(text, type) ⇒ Object
41 42 43 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 41 def bootstrap_label(text, type) content_tag(:span, text, class: "label #{type.to_s}") end |
#bootstrap_link_to(title, link, color, options = {}) ⇒ Object
25 26 27 28 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 25 def bootstrap_link_to(title, link, color, = {}) btn_class = (color).concat([:class] || "") raw(link_to title, link, { class: btn_class }.merge()) end |
#conditional_bootstrap_label(condition, text, success = :success, failure = :important) ⇒ Object
45 46 47 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 45 def conditional_bootstrap_label(condition, text, success = :success, failure = :important) condition ? bootstrap_label(text, success) : bootstrap_label(text, failure) end |
#pills(&block) ⇒ Object
9 10 11 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 9 def pills(&block) list_builder "nav-pills", &block end |
#stacked_pills(&block) ⇒ Object
21 22 23 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 21 def stacked_pills(&block) list_builder "nav-pills","nav-stacked", &block end |
#stacked_tabs(&block) ⇒ Object
17 18 19 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 17 def stacked_tabs(&block) list_builder "nav-tabs", "nav-stacked", &block end |
#striped_table(id = nil, &block) ⇒ Object
4 5 6 7 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 4 def striped_table(id=nil, &block) content = capture(&block) content_tag(:table, content, id: id, class: "table table-bordered table-striped") end |
#tabs(&block) ⇒ Object
13 14 15 |
# File 'app/helpers/rails_bootstrap_helpers/layout_helper.rb', line 13 def tabs(&block) list_builder "nav-tabs", &block end |