Module: TwBootsrapHelper::ViewHelper
- Defined in:
- lib/tw_bootstrap_helper/view_helper.rb
Overview
Extende os Helpers da Aplicação
Instance Method Summary collapse
- #bootstrap_label(title, type, options = {}) ⇒ Object
- #bootstrap_link_to(title, path, type, options = {}) ⇒ Object
- #cancel_link_to(title, path, options = {}) ⇒ Object
- #danger_link_to(title, path, options = {}) ⇒ Object
-
#default_link_to(title, path, options = {}) ⇒ Object
Default Options from Links with Bootstraper.
- #delete_link_to(title, path, options = {}) ⇒ Object
- #edit_link_to(title, path, options = {}) ⇒ Object
-
#grid_col(cols, center = true, &block) ⇒ Object
Bootstrap Col Grid.
-
#grid_row(&block) ⇒ Object
Bootstrap Row Grid.
- #info_link_to(title, path, options = {}) ⇒ Object
- #label_back(title = "<< Voltar") ⇒ Object
- #label_default(title, options = {}) ⇒ Object
- #label_details(title = "+ Detalhes") ⇒ Object
- #label_error(title = "Erro") ⇒ Object
- #label_important(title, options = {}) ⇒ Object
- #label_incomplete(title = "Incompleto") ⇒ Object
-
#label_new(title = "Novo") ⇒ Object
Commom Alias from Labels.
- #label_notice(title, options = {}) ⇒ Object
- #label_success(title, options = {}) ⇒ Object
- #label_warning(title, options = {}) ⇒ Object
- #lorem_ipsum_text ⇒ Object
-
#nav_icon(title, link) ⇒ Object
Bootstrap Row Grid.
- #new_link_to(title, path, options = {}) ⇒ Object
-
#pill(&block) ⇒ Object
Show a Pill Toolbar.
-
#pill_item(&block) ⇒ Object
Show a Pill Toolbar Item.
-
#pill_link_to(title, path, options = {}) ⇒ Object
Commom Alias from Links.
- #primary_link_to(title, path, options = {}) ⇒ Object
- #success_link_to(title, path, options = {}) ⇒ Object
-
#table(opts = {}, &block) ⇒ Object
HTML HELPERS ================.
- #table_body(&block) ⇒ Object
- #table_head(&block) ⇒ Object
- #table_td(value = "", options = {}) ⇒ Object
- #table_td_block(options = {}, &block) ⇒ Object
- #table_th(value = "", options = {}) ⇒ Object
- #table_th_block(options = {}, &block) ⇒ Object
- #table_tr(&block) ⇒ Object
-
#toolbar(&block) ⇒ Object
Show a Toolbar.
-
#toolbar_item(&block) ⇒ Object
Show a Toolbar.
Instance Method Details
#bootstrap_label(title, type, options = {}) ⇒ Object
111 112 113 114 115 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 111 def bootstrap_label title, type, ={} [:class] = "" unless .has_key?(:class) [:class].insert(0, " label " + type.to_s) raw content_tag :span, " #{title} ", end |
#bootstrap_link_to(title, path, type, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 15 def bootstrap_link_to title, path, type, ={} [:class] = "" unless .has_key?(:class) [:class].insert(0, " btn " + type.to_s) if .has_key?(:small) then if [:small] == true then [:class].insert(-1, " small ") end .delete(:small) end [:class].to_s.strip! link_to title, path, end |
#cancel_link_to(title, path, options = {}) ⇒ Object
68 69 70 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 68 def cancel_link_to title, path, ={} default_link_to title, path, end |
#danger_link_to(title, path, options = {}) ⇒ Object
54 55 56 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 54 def danger_link_to title, path, ={} bootstrap_link_to title, path, :danger, end |
#default_link_to(title, path, options = {}) ⇒ Object
Default Options from Links with Bootstraper
34 35 36 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 34 def default_link_to title, path, ={} bootstrap_link_to title, path, :default, end |
#delete_link_to(title, path, options = {}) ⇒ Object
76 77 78 79 80 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 76 def delete_link_to title, path, ={} [:confirm] = 'Tem certeza que deseja apagar este item?' [:method] = :delete danger_link_to title, path, end |
#edit_link_to(title, path, options = {}) ⇒ Object
72 73 74 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 72 def edit_link_to title, path, ={} info_link_to title, path, end |
#grid_col(cols, center = true, &block) ⇒ Object
Bootstrap Col Grid
170 171 172 173 174 175 176 177 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 170 def grid_col(cols, center=true,&block) content = capture(&block) cl = "span#{cols} border corner h-padding opaque " cl += " center " if center content_tag(:div, content, :class => cl) end |
#grid_row(&block) ⇒ Object
Bootstrap Row Grid
163 164 165 166 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 163 def grid_row(&block) content = capture(&block) raw content_tag(:div, content, :class => "grid row") end |
#info_link_to(title, path, options = {}) ⇒ Object
44 45 46 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 44 def info_link_to title, path, ={} bootstrap_link_to title, path, :info, end |
#label_back(title = "<< Voltar") ⇒ Object
155 156 157 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 155 def label_back title="<< Voltar" label_default title end |
#label_default(title, options = {}) ⇒ Object
117 118 119 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 117 def label_default title, ={} bootstrap_label title, :default, ={} end |
#label_details(title = "+ Detalhes") ⇒ Object
151 152 153 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 151 def label_details title="+ Detalhes" label_notice title end |
#label_error(title = "Erro") ⇒ Object
143 144 145 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 143 def label_error title="Erro" label_important title end |
#label_important(title, options = {}) ⇒ Object
129 130 131 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 129 def label_important title, ={} bootstrap_label title, :important, ={} end |
#label_incomplete(title = "Incompleto") ⇒ Object
147 148 149 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 147 def label_incomplete title="Incompleto" label_warning title end |
#label_new(title = "Novo") ⇒ Object
Commom Alias from Labels
139 140 141 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 139 def label_new title="Novo" label_success title end |
#label_notice(title, options = {}) ⇒ Object
133 134 135 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 133 def label_notice title, ={} bootstrap_label title, :notice, ={} end |
#label_success(title, options = {}) ⇒ Object
121 122 123 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 121 def label_success title, ={} bootstrap_label title, :success, ={} end |
#label_warning(title, options = {}) ⇒ Object
125 126 127 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 125 def label_warning title, ={} bootstrap_label title, :warning, ={} end |
#lorem_ipsum_text ⇒ Object
234 235 236 237 238 239 240 241 242 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 234 def lorem_ipsum_text <<-eos Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris fermentum tempor arcu in mollis. Aliquam erat volutpat. Sed malesuada lacinia nibh, eget posuere turpis accumsan vitae. Aliquam lacus massa, pellentesque auctor volutpat eu, luctus ac enim. Nullam venenatis tellus nec tortor dictum rutrum. Proin sed magna eu mauris posuere vulputate vel quis nunc. Donec at elit sapien, vitae mattis arcu. Maecenas sollicitudin auctor volutpat. Vivamus tincidunt interdum placerat. In mattis, metus vel pellentesque accumsan, neque nisi ornare lectus, et interdum lectus ipsum sed augue. Nullam sollicitudin placerat enim a lobortis. Curabitur id lorem turpis, sit amet euismod elit. eos end |
#nav_icon(title, link) ⇒ Object
Bootstrap Row Grid
181 182 183 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 181 def nav_icon(title, link) raw content_tag(:div, link + content_tag(:span, title), :class => "nav-icon-item corner h-margin v-margin") end |
#new_link_to(title, path, options = {}) ⇒ Object
64 65 66 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 64 def new_link_to title, path, ={} success_link_to title, path, end |
#pill(&block) ⇒ Object
Show a Pill Toolbar
99 100 101 102 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 99 def pill(&block) content = capture(&block) content_tag(:div, content_tag(:ul, content, :class => "pills border corner h-padding")) end |
#pill_item(&block) ⇒ Object
Show a Pill Toolbar Item
105 106 107 108 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 105 def pill_item(&block) content = capture(&block) content_tag(:li, content, :class => "pill-item") end |
#pill_link_to(title, path, options = {}) ⇒ Object
Commom Alias from Links
60 61 62 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 60 def pill_link_to title, path, ={} link_to title, path, end |
#primary_link_to(title, path, options = {}) ⇒ Object
39 40 41 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 39 def primary_link_to title, path, ={} bootstrap_link_to title, path, :primary, end |
#success_link_to(title, path, options = {}) ⇒ Object
49 50 51 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 49 def success_link_to title, path, ={} bootstrap_link_to title, path, :success, end |
#table(opts = {}, &block) ⇒ Object
HTML HELPERS ================
188 189 190 191 192 193 194 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 188 def table(opts={}, &block) content = capture(&block) opts[:class] = "border zebra-striped corner" content_tag(:table, content, opts) end |
#table_body(&block) ⇒ Object
213 214 215 216 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 213 def table_body(&block) content = capture(&block) content_tag(:tbody, content) end |
#table_head(&block) ⇒ Object
197 198 199 200 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 197 def table_head(&block) content = capture(&block) content_tag(:thead, content_tag(:tr, content)) end |
#table_td(value = "", options = {}) ⇒ Object
230 231 232 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 230 def table_td(value="", ={}) content_tag(:td, value, ) end |
#table_td_block(options = {}, &block) ⇒ Object
225 226 227 228 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 225 def table_td_block(={}, &block) content = capture(&block) content_tag(:td, content, ) end |
#table_th(value = "", options = {}) ⇒ Object
208 209 210 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 208 def table_th(value="", ={}) content_tag(:th, value) end |
#table_th_block(options = {}, &block) ⇒ Object
203 204 205 206 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 203 def table_th_block(={}, &block) content = capture(&block) content_tag(:th, content) end |
#table_tr(&block) ⇒ Object
219 220 221 222 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 219 def table_tr(&block) content = capture(&block) content_tag(:tr, content) end |
#toolbar(&block) ⇒ Object
Show a Toolbar
85 86 87 88 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 85 def (&block) content = capture(&block) content_tag(:div, content_tag(:ul, content), :class => "toolbar corner border gradient") end |
#toolbar_item(&block) ⇒ Object
Show a Toolbar
91 92 93 94 |
# File 'lib/tw_bootstrap_helper/view_helper.rb', line 91 def (&block) content = capture(&block) content_tag(:li, content, :class => "toolbar-item") end |