Module: Aptible::DocumentHelpers::Header

Included in:
Aptible::DocumentHelpers
Defined in:
lib/aptible/document_helpers/header.rb

Instance Method Summary collapse

Instance Method Details

#header(title, options = {}) ⇒ Object

rubocop:disable MethodLength



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/aptible/document_helpers/header.rb', line 5

def header(title, options = {})
  header_box do
    formatted_text [{
      text: title,
      color: '003366',
      size: 30,
      styles: [:bold],
      font: 'Proxima Nova'
    }],
                   valign: :center
    add_dest title, dest_fit
  end

  closed = options[:closed] || false
  outline.define do
    section(title, destination: page_number, closed: closed) do
    end
  end
end

#header_box(&block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/aptible/document_helpers/header.rb', line 25

def header_box(&block)
  box_margin = 36
  background_color = 'eef6fe'
  reset_default_font_color = '333333'

  bounding_box([-bounds.absolute_left, cursor + 50],
               width: bounds.absolute_left + bounds.absolute_right,
               height: box_margin * 2) do
    fill_color background_color
    fill_rectangle(
      [bounds.left, bounds.top],
      bounds.right,
      bounds.top - bounds.bottom
    )
    fill_color reset_default_font_color
    # pass the block and render the text
    indent(50, &block)
  end
  # move_down(20)
end