Module: Blot::Helpers::Grid
- Included in:
- Blot::Helpers
- Defined in:
- lib/blot/helpers/grid.rb
Instance Method Summary collapse
- #block_grid(options = {}) ⇒ Object
- #center(&block) ⇒ 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
permalink #block_grid(options = {}) ⇒ Object
[View source]
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 |
permalink #center(&block) ⇒ Object
[View source]
77 78 79 80 81 82 83 |
# File 'lib/blot/helpers/grid.rb', line 77 def center(&block) content_tag :td, class: 'center', align: 'center' do content_tag :center do yield if block_given? end end end |
permalink #columns(width, options = {}) ⇒ Object Also known as: column
[View source]
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/blot/helpers/grid.rb', line 41 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? content_tag :td, do optional_content() { yield if block_given? } end else nil end [content, ].join('').html_safe end end end |
permalink #container(options = {}) ⇒ Object
[View source]
13 14 15 16 17 18 19 20 21 |
# File 'lib/blot/helpers/grid.rb', line 13 def container(={}) content_tag :table, class: 'container' do content_tag :tr do content_tag :td, do yield if block_given? end end end end |
permalink #panel_sub_grid ⇒ Object
[View source]
31 32 33 34 35 36 37 38 39 |
# File 'lib/blot/helpers/grid.rb', line 31 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 |
permalink #row ⇒ Object
[View source]
23 24 25 26 27 28 29 |
# File 'lib/blot/helpers/grid.rb', line 23 def row content_tag :table, class: 'row' do content_tag :tr do yield if block_given? end end end |
permalink #sub_columns(width, options = {}) ⇒ Object Also known as: sub_column
[View source]
60 61 62 63 64 65 |
# File 'lib/blot/helpers/grid.rb', line 60 def sub_columns(width, ={}) [:class] = "#{width} sub-columns #{[:class]}".strip content_tag :td, do optional_content() { yield if block_given? } end end |
permalink #wrapper(options = {}, &block) ⇒ Object
[View source]
68 69 70 71 72 73 74 75 |
# File 'lib/blot/helpers/grid.rb', line 68 def wrapper(={}, &block) unless .delete(:wrapper).is_a?(FalseClass) || [:class] && [:class].split(' ').include?('wrapper') [:class] = "wrapper #{[:class]}".squish end content_tag :td, do optional_content() { yield if block_given? } end end |