Class: Dorsale::Flyboy::Roadmap
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- Dorsale::Flyboy::Roadmap
- Includes:
- ActionView::Helpers::NumberHelper, TextHelper
- Defined in:
- app/pdfs/dorsale/flyboy/roadmap.rb
Instance Attribute Summary collapse
-
#tasks ⇒ Object
Returns the value of attribute tasks.
Instance Method Summary collapse
- #build ⇒ Object
- #display_tasks(tasks) ⇒ Object
-
#initialize(tasks) ⇒ Roadmap
constructor
A new instance of Roadmap.
Methods included from TextHelper
#currency, #date, #euros, #hours, #info, #lf2br, #number, #percentage, #tags, #text2html
Constructor Details
#initialize(tasks) ⇒ Roadmap
Returns a new instance of Roadmap.
10 11 12 13 |
# File 'app/pdfs/dorsale/flyboy/roadmap.rb', line 10 def initialize(tasks) super(:page_layout => :landscape) @tasks = tasks end |
Instance Attribute Details
#tasks ⇒ Object
Returns the value of attribute tasks.
8 9 10 |
# File 'app/pdfs/dorsale/flyboy/roadmap.rb', line 8 def tasks @tasks end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 |
# File 'app/pdfs/dorsale/flyboy/roadmap.rb', line 15 def build font_size 10 text "Plan d'actions au #{I18n.l(Time.zone.now.to_date)}", :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 44 45 |
# File 'app/pdfs/dorsale/flyboy/roadmap.rb', line 22 def display_tasks(tasks) display = [[ "Taskable", "Type", "Avancement taskable", "Tâche", "Avancement tâche", "Echéance" ]] tasks.each do |task| display << [ task.taskable.name, task.taskable.class.t, percentage(task.taskable.try(:progress)), task.name, percentage(task.progress), I18n.l(task.term) ] end table display move_down(10) end |