class ThousandIsland::Components::Footer

Public Class Methods

default_numbering_options() click to toggle source
# File lib/thousand_island/components/footer.rb, line 83
def self.default_numbering_options
  {
    align: :right,
    start_count_at: 1,
  }
end
defaults() click to toggle source
# File lib/thousand_island/components/footer.rb, line 71
def self.defaults
  {
    height: 33,
    top_padding: 20,
    repeated: true,
    numbering_options: default_numbering_options,
    number_pages: true,
    numbering_string: '<page>',
    style: {},
  }
end

Public Instance Methods

after_render() click to toggle source
# File lib/thousand_island/components/footer.rb, line 21
def after_render
  col3
end
box_height() click to toggle source
# File lib/thousand_island/components/footer.rb, line 55
def box_height
  options[:height]
end
col1() click to toggle source
# File lib/thousand_island/components/footer.rb, line 37
def col1
end
col1_width() click to toggle source
# File lib/thousand_island/components/footer.rb, line 25
def col1_width
  pdf.bounds.width * 0.15
end
col2() { || ... } click to toggle source
# File lib/thousand_island/components/footer.rb, line 40
def col2
  start = col1_width
  pdf.bounding_box([start, box_height], width: col2_width, height: box_height) do
    inject_style
    yield if block_given?
  end
end
col2_width() click to toggle source
# File lib/thousand_island/components/footer.rb, line 29
def col2_width
  pdf.bounds.width * 0.7
end
col3() click to toggle source
# File lib/thousand_island/components/footer.rb, line 48
def col3
  start = col1_width + col2_width
  pdf.bounding_box([start, box_height], width: col3_width, height: box_height) do
    pdf.number_pages numbering_string, numbering_options if number_pages?
  end
end
col3_width() click to toggle source
# File lib/thousand_island/components/footer.rb, line 33
def col3_width
  pdf.bounds.width * 0.15
end
inject_style() click to toggle source
# File lib/thousand_island/components/footer.rb, line 67
def inject_style
  options[:style].each { |k,v| pdf.send(k, v) if pdf.respond_to?(k) } if options[:style]
end
number_pages?() click to toggle source
# File lib/thousand_island/components/footer.rb, line 9
def number_pages?
  options[:number_pages]
end
numbering_options() click to toggle source
# File lib/thousand_island/components/footer.rb, line 59
def numbering_options
  options[:style].merge(options[:numbering_options])
end
numbering_string() click to toggle source
# File lib/thousand_island/components/footer.rb, line 5
def numbering_string
  options[:numbering_string]
end
render(&block) click to toggle source
# File lib/thousand_island/components/footer.rb, line 13
def render(&block)
  pdf.bounding_box([0, box_height], width: pdf.bounds.width, height: box_height) do
    col1
    col2(&block)
    # col3
  end
end
repeated?() click to toggle source
# File lib/thousand_island/components/footer.rb, line 63
def repeated?
  options[:repeated]
end