Class: Card::Bootstrap::Component::Layout

Inherits:
OldComponent show all
Defined in:
mod/bootstrap/lib/card/bootstrap/component/layout.rb

Overview

generate bootstrap column layout

Examples:

layout container: true, fluid: true, class: "jackelope" do
  row 6, 6, class: "unicorn" do
    column "horn",
    column "rainbow", class: "colorful"
  end
end
layout do
  row 3, 3, 4, 2, class: "unicorn" do
    [ "horn", "body", "tail", "rainbow"]
  end
  add_html "<span> some extra html</span>"
  row 6, 6, ["unicorn", "rainbow"], class: "horn"
end

Instance Method Summary collapse

Methods inherited from OldComponent

add_div_method, add_tag_method, #initialize, render

Methods included from Delegate

#method_missing, #respond_to_missing?

Methods inherited from Card::Bootstrap::Component

#append, #card, #initialize, #insert, #prepend, #wrap

Methods included from Card::Bootstrap::ComponentKlass

#def_div_method, #def_tag_method

Methods included from BasicTags

#html

Constructor Details

This class inherits a constructor from Card::Bootstrap::OldComponent

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Card::Bootstrap::Delegate

Instance Method Details

#renderObject



21
22
23
24
25
26
# File 'mod/bootstrap/lib/card/bootstrap/component/layout.rb', line 21

def render
  @rendered = begin
    render_content
    @content[-1]
  end
end

#render_contentObject



28
29
30
31
32
33
34
35
36
37
# File 'mod/bootstrap/lib/card/bootstrap/component/layout.rb', line 28

def render_content
  content = instance_exec(*@args, &@build_block)
  add_content content
  opts = @args.first
  return unless opts&.delete(:container)

  content = @content.pop
  @content = ["".html_safe]
  container content, opts
end