Class: ScaffoldMarkup::Builders::PageBuilder

Inherits:
BaseBuilder
  • Object
show all
Includes:
Helpers::LinkButtonHelper, Helpers::TableHelper
Defined in:
lib/scaffold_markup/builders/page_builder.rb

Instance Attribute Summary

Attributes inherited from BaseBuilder

#block, #template, #url

Instance Method Summary collapse

Methods included from Helpers::TableHelper

#table, #table_actions, #table_body, #table_head

Methods included from Helpers::LinkButtonHelper

#link_button

Methods inherited from BaseBuilder

#html_safe, #initialize

Constructor Details

This class inherits a constructor from ScaffoldMarkup::Builders::BaseBuilder

Instance Method Details

#container(&block) ⇒ Object



13
14
15
16
# File 'lib/scaffold_markup/builders/page_builder.rb', line 13

def container(&block)
  #TODO: Container tiene que ser un tag de TwitterBootstrapMarkup
  Tag.new(:div, template.capture(self, &block), :class => 'container').html_safe
end

#flash_messagesObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/scaffold_markup/builders/page_builder.rb', line 42

def flash_messages
  unless template.content_for?(:flash)
    template.flash.keys.each do |key|
      if template.flash[key].is_a? Array
        flash_text = template.flash[key].join('<br>')
      else
        flash_text = template.flash[key]
      end
      template.content_for(:flash, self.send("alert_#{key}", flash_text))
    end
  end
end

#form_for(model, &block) ⇒ Object



34
35
36
# File 'lib/scaffold_markup/builders/page_builder.rb', line 34

def form_for(model, &block)
  FormBuilder.new(template, model, &block).html_safe
end

#header(title, subtitle = nil) ⇒ Object



22
23
24
# File 'lib/scaffold_markup/builders/page_builder.rb', line 22

def header(title, subtitle=nil)
  template.content_for(:page_header, PageHeader.new(title, subtitle).html_safe)
end


38
39
40
# File 'lib/scaffold_markup/builders/page_builder.rb', line 38

def nav_bar(&block)
  NavBarBuilder.new(template, &block).html_safe
end

#submit_primary(*args) ⇒ Object



30
31
32
# File 'lib/scaffold_markup/builders/page_builder.rb', line 30

def submit_primary(*args)
  Submit.primary(*args).html_safe
end

#title(text) ⇒ Object



18
19
20
# File 'lib/scaffold_markup/builders/page_builder.rb', line 18

def title(text)
  template.content_for(:page_title, text)
end

#to_sObject



7
8
9
10
11
# File 'lib/scaffold_markup/builders/page_builder.rb', line 7

def to_s
  html = template.capture(self, &block)
  flash_messages
  html
end

#well_small(&block) ⇒ Object



26
27
28
# File 'lib/scaffold_markup/builders/page_builder.rb', line 26

def well_small(&block)
  Well.small(template.capture(self, &block)).html_safe
end