class UiBibz::Ui::Core::Layouts::Row

Create a row

This element is an extend of UiBibz::Ui::Core::Component.

Attributes

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

Signatures

UiBibz::Ui::Core::Layouts::Row.new(content, options = {}, html_options = {})

UiBibz::Ui::Core::Layouts::Row.new(options = {}, html_options = {}) do
  #content
end

UiBibz::Ui::Core::Layouts::Row.new(options = {}, html_options = {}) do |row|
  row.col do
    # content
  end
end

Helper

row(content, options = {}, html_options = {})

row(options = {}, html_options = {}) do
  content
end

row(options = {}, html_options = {}) do |row|
  row.col do
    content
  end
end

Public Class Methods

new(content = nil, options = nil, html_options = nil, &block) click to toggle source

See UiBibz::Ui::Core::Component.initialize

Calls superclass method UiBibz::Ui::Core::Component::new
# File lib/ui_bibz/ui/core/layouts/row.rb, line 52
def initialize(content = nil, options = nil, html_options = nil, &block)
  content = { num: content } if !block.nil? && content.is_a?(Integer)
  super
  @items = [@content]
end

Public Instance Methods

col(content = nil, options = nil, html_options = nil, &block) click to toggle source
# File lib/ui_bibz/ui/core/layouts/row.rb, line 63
def col(content = nil, options = nil, html_options = nil, &block)
  @items << UiBibz::Ui::Core::Layouts::Col.new(content, options, html_options, &block).render
end
pre_render() click to toggle source

Render html tag

# File lib/ui_bibz/ui/core/layouts/row.rb, line 59
def pre_render
  content_tag :div, @items.join.html_safe, html_options
end

Private Instance Methods

breakpoints_present?() click to toggle source
# File lib/ui_bibz/ui/core/layouts/row.rb, line 77
def breakpoints_present?
  @options.keys.size - (@options.keys.map(&:to_sym) - [UiBibz::Ui::Core::Component::BREAKPOINTS, :num].flatten).size != 0
end
component_html_classes() click to toggle source
# File lib/ui_bibz/ui/core/layouts/row.rb, line 69
def component_html_classes
  [
    'row',
    (UiBibz::Utils::BreakdownClassNameGenerator.new(@options[:gutters], 'g').class_names if @options[:gutters]),
    (UiBibz::Utils::BreakdownClassNameGenerator.new(@options, 'row-cols').class_names if breakpoints_present?)
  ]
end