Module: Blot::Helpers::Grid
- Included in:
- Blot::Helpers
- Defined in:
- lib/blot/helpers/grid.rb
Instance Method Summary collapse
- #block_grid(options = {}) ⇒ Object
- #columns(width, options = {}) ⇒ Object (also: #column)
- #container(options = {}) ⇒ Object
- #panel_sub_grid ⇒ Object
- #row ⇒ Object
- #sub_columns(width, options = {}) ⇒ Object (also: #sub_column)
- #wrapper(options = {}, &block) ⇒ Object
Instance Method Details
#block_grid(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/blot/helpers/grid.rb', line 4 def block_grid(={}) [:class] = "block-grid #{[:up]}-up #{[:class]}".strip content_tag :table, class: [:class] do content_tag :tr do yield if block_given? end end end |
#columns(width, options = {}) ⇒ Object Also known as: column
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/blot/helpers/grid.rb', line 39 def columns(width, ={}) content_tag :table, class: "#{width} columns" do content_tag :tr do content = if [:sub_columns] block_given? ? yield : nil elsif !.empty? || block_given? wrapper() { yield if block_given? } else nil end [content, ].join('').html_safe end end end |
#container(options = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/blot/helpers/grid.rb', line 13 def container(={}) content_tag :table, class: 'container' do content_tag :tr do wrapper() { yield if block_given? } end end end |
#panel_sub_grid ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/blot/helpers/grid.rb', line 29 def panel_sub_grid content_tag :td, class: 'panel sub-grid' do content_tag :table do content_tag :tr do yield if block_given? end end end end |
#row ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/blot/helpers/grid.rb', line 21 def row content_tag :table, class: 'row' do content_tag :tr do yield if block_given? end end end |
#sub_columns(width, options = {}) ⇒ Object Also known as: sub_column
56 57 58 59 |
# File 'lib/blot/helpers/grid.rb', line 56 def sub_columns(width, ={}) [:class] = "#{width} sub-columns #{[:class]}".strip wrapper() { yield if block_given? } end |
#wrapper(options = {}, &block) ⇒ Object
62 63 64 65 66 |
# File 'lib/blot/helpers/grid.rb', line 62 def wrapper(={}, &block) content_tag :td, do optional_content() { yield if block_given? } end end |