Sha256: 531146defda96475ab79c9f0a16afc5e869cfeaf6b5806a1dd7c5f81244dfed7

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

xml.Worksheet 'ss:Name' => I18n.t(:tab_tasks) do
  xml.Table do
    unless @tasks.empty?
      # Header.
      xml.Row do
        heads = %w{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.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'}"
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fat_free_crm-0.12.3 app/views/tasks/index.xls.builder
fat_free_crm-0.12.2 app/views/tasks/index.xls.builder
fat_free_crm-0.12.1 app/views/tasks/index.xls.builder
fat_free_crm-0.12.0 app/views/tasks/index.xls.builder
fat_free_crm-0.11.4 app/views/tasks/index.xls.builder