Sha256: 2397dad0555faef86d0c9329d6ab2bae6cee1f6e86315678ef9f05d3c420ca57

Contents?: true

Size: 1.27 KB

Versions: 13

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

xml.Worksheet 'ss:Name' => I18n.t(:tab_tasks) do
  xml.Table do
    unless @tasks.empty?
      # Header.
      xml.Row do
        heads = %w[id
                   name
                   due
                   date_created
                   date_updated
                   completed
                   user
                   assigned_to
                   category
                   background_info]

        heads.each do |head|
          xml.Cell do
            xml.Data I18n.t(head),
                     'ss:Type' => 'String'
          end
        end
      end

      # Rows.
      @tasks.map(&:second).flatten.each do |task|
        xml.Row do
          data = [task.id,
                  task.name,
                  I18n.t(task.computed_bucket),
                  task.created_at,
                  task.updated_at,
                  task.completed_at,
                  task.user.try(:name),
                  task.assignee.try(:name),
                  task.category,
                  task.background_info]

          data.each do |value|
            xml.Cell do
              xml.Data value,
                       'ss:Type' => (value.respond_to?(:abs) ? 'Number' : 'String').to_s
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fat_free_crm-0.22.1 app/views/tasks/index.xls.builder
fat_free_crm-0.22.0 app/views/tasks/index.xls.builder
fat_free_crm-0.21.0 app/views/tasks/index.xls.builder
fat_free_crm-0.20.1 app/views/tasks/index.xls.builder
fat_free_crm-0.20.0 app/views/tasks/index.xls.builder
fat_free_crm-0.19.2 app/views/tasks/index.xls.builder
fat_free_crm-0.19.0 app/views/tasks/index.xls.builder
fat_free_crm-0.18.2 app/views/tasks/index.xls.builder
fat_free_crm-0.17.3 app/views/tasks/index.xls.builder
fat_free_crm-0.18.1 app/views/tasks/index.xls.builder
fat_free_crm-0.18.0 app/views/tasks/index.xls.builder
fat_free_crm-0.17.2 app/views/tasks/index.xls.builder
fat_free_crm-0.17.1 app/views/tasks/index.xls.builder