Module: TwitterBootstrapBuilder::Helpers::CommonsHelper
- Defined in:
- lib/twitter_bootstrap_builder/helpers/commons_helper.rb
Instance Method Summary collapse
- #alert_message ⇒ Object
- #alert_validations(model) ⇒ Object
- #badge(*args) ⇒ Object
- #fieldset_horizontal(&block) ⇒ Object
- #fieldset_horizontal_for(model, &block) ⇒ Object
- #icon(*args) ⇒ Object
- #icon_white(*args) ⇒ Object
- #label(*args) ⇒ Object
- #nav_bar(&block) ⇒ Object
- #nav_list(&block) ⇒ Object
- #page_header(*args) ⇒ Object
- #page_title(title = nil) ⇒ Object
- #progress_bar(*args) ⇒ Object
- #progress_bar_striped(*args) ⇒ Object
- #progress_bar_striped_animated(*args) ⇒ Object
- #side_bar(partial = nil, &block) ⇒ Object
- #tab(&block) ⇒ Object
- #table_for(collection, model_class = nil, &block) ⇒ Object
- #well(size = nil, &block) ⇒ Object
- #well_large(&block) ⇒ Object
- #well_small(&block) ⇒ Object
Instance Method Details
#alert_message ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 31 def unless content_for?(:alert_message) if flash[:danger] alert_danger(flash[:danger]) elsif flash[:warning] alert_warning(flash[:warning]) elsif flash[:success] alert_success(flash[:success]) elsif flash[:info] alert_info(flash[:info]) end end content_for?(:alert_message) ? content_for(:alert_message) : nil end |
#alert_validations(model) ⇒ Object
73 74 75 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 73 def alert_validations(model) alert_danger(model.errors..join('<br>')) if model.errors.any? end |
#badge(*args) ⇒ Object
107 108 109 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 107 def badge(*args) TwitterBootstrapMarkup::Badge.new(*args).html_safe end |
#fieldset_horizontal(&block) ⇒ Object
91 92 93 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 91 def fieldset_horizontal(&block) Builders::FieldsetBuilder.new(self, &block).html_safe end |
#fieldset_horizontal_for(model, &block) ⇒ Object
87 88 89 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 87 def fieldset_horizontal_for(model, &block) Builders::FieldsetBuilder.new(self, model: model, &block).html_safe end |
#icon(*args) ⇒ Object
95 96 97 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 95 def icon(*args) TwitterBootstrapMarkup::Icon.new(*args).html_safe end |
#icon_white(*args) ⇒ Object
99 100 101 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 99 def icon_white(*args) TwitterBootstrapMarkup::Icon.white(*args).html_safe end |
#label(*args) ⇒ Object
103 104 105 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 103 def label(*args) TwitterBootstrapMarkup::Label.new(*args).html_safe end |
#nav_bar(&block) ⇒ Object
47 48 49 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 47 def (&block) Builders::NavBarBuilder.new(self, &block).html_safe end |
#nav_list(&block) ⇒ Object
51 52 53 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 51 def nav_list(&block) Builders::NavListBuilder.new(self, &block).html_safe end |
#page_header(*args) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 13 def page_header(*args) if args.any? content_for(:page_header, TwitterBootstrapMarkup::PageHeader.new(args.shift, args.shift).html_safe) else content_for?(:page_header) ? content_for(:page_header) : nil end end |
#page_title(title = nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 5 def page_title(title=nil) if title content_for(:page_title, title) else content_for?(:page_title) ? content_for(:page_title) : nil end end |
#progress_bar(*args) ⇒ Object
121 122 123 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 121 def (*args) TwitterBootstrapMarkup::ProgressBar.new(*args).html_safe end |
#progress_bar_striped(*args) ⇒ Object
125 126 127 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 125 def (*args) TwitterBootstrapMarkup::ProgressBar.new(*args).striped.html_safe end |
#progress_bar_striped_animated(*args) ⇒ Object
129 130 131 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 129 def (*args) TwitterBootstrapMarkup::ProgressBar.new(*args).striped_animated.html_safe end |
#side_bar(partial = nil, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 21 def (partial=nil, &block) if partial content_for(:side_bar) { render "layouts/#{partial}" } elsif block content_for(:side_bar, &block) else content_for?(:side_bar) ? content_for(:side_bar) : nil end end |
#tab(&block) ⇒ Object
55 56 57 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 55 def tab(&block) Builders::TabBuilder.new(self, &block).html_safe end |
#table_for(collection, model_class = nil, &block) ⇒ Object
83 84 85 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 83 def table_for(collection, model_class=nil, &block) Builders::TableBuilder.new(self, collection: collection, model_class: model_class, &block).html_safe end |
#well(size = nil, &block) ⇒ Object
59 60 61 62 63 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 59 def well(size=nil, &block) well = TwitterBootstrapMarkup::Well.new(capture(&block)) well.send(size) if size well.html_safe end |
#well_large(&block) ⇒ Object
69 70 71 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 69 def well_large(&block) well(:large, &block) end |
#well_small(&block) ⇒ Object
65 66 67 |
# File 'lib/twitter_bootstrap_builder/helpers/commons_helper.rb', line 65 def well_small(&block) well(:small, &block) end |