Sha256: 2a330239edf1aba3c69181059b3b945e7dedeff609b188d80ee062a9eb6dc48b

Contents?: true

Size: 905 Bytes

Versions: 8

Compression:

Stored size: 905 Bytes

Contents

require "prawn"
require "prawn/table"

class Dorsale::Flyboy::Roadmap < Prawn::Document
  include ::ActionView::Helpers::NumberHelper
  include ::Dorsale::TextHelper

  attr_accessor :tasks

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

  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

  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

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dorsale-3.1.7 app/pdfs/dorsale/flyboy/roadmap.rb
dorsale-3.1.6 app/pdfs/dorsale/flyboy/roadmap.rb
dorsale-3.1.5 app/pdfs/dorsale/flyboy/roadmap.rb
dorsale-3.1.4 app/pdfs/dorsale/flyboy/roadmap.rb
dorsale-3.1.3 app/pdfs/dorsale/flyboy/roadmap.rb
dorsale-3.1.2 app/pdfs/dorsale/flyboy/roadmap.rb
dorsale-3.1.1 app/pdfs/dorsale/flyboy/roadmap.rb
dorsale-3.1.0 app/pdfs/dorsale/flyboy/roadmap.rb