module Blot::Helpers::Grid
Public Instance Methods
block_grid(options={}) { || ... }
click to toggle source
# File lib/blot/helpers/grid.rb, line 4 def block_grid(options={}) options[:class] = "block-grid #{options[:up]}-up #{options[:class]}".strip content_tag :table, class: options[:class] do content_tag :tr do yield if block_given? end end end
center() { || ... }
click to toggle source
# 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
columns(width, options={}) { |: nil| ... }
click to toggle source
# File lib/blot/helpers/grid.rb, line 41 def columns(width, options={}) content_tag :table, class: "#{width} columns" do content_tag :tr do content = if options[:sub_columns] block_given? ? yield : nil elsif !options.empty? || block_given? content_tag :td, options do optional_content(options) { yield if block_given? } end else nil end [content, expander].join('').html_safe end end end
Also aliased as: column
container(options={}) { || ... }
click to toggle source
# File lib/blot/helpers/grid.rb, line 13 def container(options={}) content_tag :table, class: 'container' do content_tag :tr do content_tag :td, options do yield if block_given? end end end end
panel_sub_grid() { || ... }
click to toggle source
# 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
row() { || ... }
click to toggle source
# 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
sub_columns(width, options={}) { || ... }
click to toggle source
# File lib/blot/helpers/grid.rb, line 60 def sub_columns(width, options={}) options[:class] = "#{width} sub-columns #{options[:class]}".strip content_tag :td, options do optional_content(options) { yield if block_given? } end end
Also aliased as: sub_column
wrapper(options={}) { || ... }
click to toggle source
# File lib/blot/helpers/grid.rb, line 68 def wrapper(options={}, &block) unless options.delete(:wrapper).is_a?(FalseClass) || options[:class] && options[:class].split(' ').include?('wrapper') options[:class] = "wrapper #{options[:class]}".squish end content_tag :td, options do optional_content(options) { yield if block_given? } end end
Private Instance Methods
expander()
click to toggle source
# File lib/blot/helpers/grid.rb, line 87 def expander content_tag :td, nil, class: 'expander' end
optional_content(options={}, &block)
click to toggle source
# File lib/blot/helpers/grid.rb, line 91 def optional_content(options={}, &block) if options[:class] && options[:class].split(' ').include?('center') content_tag :center, block.call else block.call end end