Class: Flyboy::Roadmap

Inherits:
Prawn::Document
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper, Dorsale::TextHelper
Defined in:
app/pdfs/flyboy/roadmap.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tasks) ⇒ Roadmap

Returns a new instance of Roadmap.



10
11
12
13
# File 'app/pdfs/flyboy/roadmap.rb', line 10

def initialize(tasks)
  super(:page_layout => :landscape)
  @tasks = tasks
end

Instance Attribute Details

#tasksObject

Returns the value of attribute tasks.



8
9
10
# File 'app/pdfs/flyboy/roadmap.rb', line 8

def tasks
  @tasks
end

Instance Method Details

#buildObject



15
16
17
18
19
20
# File 'app/pdfs/flyboy/roadmap.rb', line 15

def build
  font_size 10
  text "Plan d'actions au #{I18n.l(Date.today)}", :size => 20
  move_down(10)
  display_tasks(@tasks)
end

#display_tasks(tasks) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/pdfs/flyboy/roadmap.rb', line 22

def display_tasks(tasks)
  display = [[
    "Dossier",
    "Avancement dossier",
    "Tâche",
    "Avancement tâche",
    "Echéance"
  ]]

  tasks.each do |t|
    display << [
      t.goal.title,
      percentage(t.goal.progress),
      t.title,
      percentage(t.progress),
      I18n.l(t.term)
    ]
  end

  table display
  move_down(10)
end