Class: Renalware::Forms::Base

Inherits:
Object
  • Object
show all
Includes:
Prawn::View
Defined in:
lib/renalware/forms/base.rb

Direct Known Subclasses

Generic::Homecare::V1::Base

Constant Summary collapse

EMPTY_CHECKBOX =

❏ in ZapfDingbats

"o     "
CHECKBOX =

■ in ZapfDingbats

"n    "

Instance Method Summary collapse

Instance Method Details

#borderless_table_styleObject



53
54
55
56
57
58
59
# File 'lib/renalware/forms/base.rb', line 53

def borderless_table_style
  {
    cell_style: {
      border_width: 0.5
    }
  }
end

#cell_with_leading_checkbox(text, checked: false, **options) ⇒ Object

lower case o is an empty checkbox in ZapfDingbats



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/renalware/forms/base.rb', line 10

def cell_with_leading_checkbox(text, checked: false, **options)
  if checked
    {
      content: "<font name='ZapfDingbats'>#{CHECKBOX}</font>#{text}",
      inline_format: true,
      **options
    }
  else
    {
      content: "<font name='ZapfDingbats'>#{EMPTY_CHECKBOX}</font>#{text}",
      inline_format: true,
      **options
    }
  end
end

#cell_with_trailing_checkbox(text, checked: false, **options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/renalware/forms/base.rb', line 26

def cell_with_trailing_checkbox(text, checked: false, **options)
  if checked
    {
      content: "#{text} <font name='ZapfDingbats'>#{CHECKBOX}</font>",
      inline_format: true,
      **options
    }
  else
    {
      content: "#{text} <font name='ZapfDingbats'>#{EMPTY_CHECKBOX}</font>",
      inline_format: true,
      **options
    }
  end
end

#underlined_table_styleObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/renalware/forms/base.rb', line 42

def underlined_table_style
  {
    cell_style: {
      padding: [2, 5, 2, 0],
      border_width: 0.5,
      border_color: "AAAAAA",
      borders: [:bottom]
    }
  }
end