sandrods / odf-report

Generates ODF files, given a template (.odt) and data, replacing tags

Home Page:http://sandrods.github.com/odf-report

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`add_image' for a section is not available

ionosphere opened this issue · comments

Hi,

When we try to add image in a section, we have an issue

undefined method `add_image' for #ODFReport::Section:0x000055f7465dafc8

the source code is

      r.add_field 'CAMPAIGN_NAME', @campaign.name
      r.add_field 'PRINTED_AT', Time.now.strftime("%d/%m/%y")
      r.add_field 'COMPANY_NAME', company.name
      r.add_field 'COMPANY_ADDRESS', company.mails.where(by_default: true).first.coordinate
      r.add_field 'COMPANY_SIRET', company.siret_number
      r.add_field 'FILENAME', document_name
      r.add_section(:section_ti, dataset) do |s|
        s.add_image(:img_act) { |ti| ti[:image]}
        s.add_field(:ti_name) { |ti| ti[:name]}
        s.add_field(:duration) { |ti| ti[:duration]}
        s.add_field(:av_yield) { |ti| ti[:average_yield]}
        s.add_field(:total_cost) { |ti| ti[:total_cost]}
        s.add_section(:section_procedure, :items) do |sp|
          sp.add_field(:position) { |spi| spi[:position]}
          sp.add_field(:name) { |spi| spi[:name]}
          sp.add_field(:day_since_start) { |spi| spi[:day_since_start]}
          sp.add_field(:human_workflow) { |spi| spi[:human_workflow]}
          sp.add_table(:table_parameters, :parameters) do |ts|
            ts.add_field(:nature) { |i| i[:nature]}
            ts.add_field(:name) { |i| i[:name]}
            ts.add_field(:quantity) { |i| i[:quantity]}
          end
        end