Sha256: 726049b46c5987e7e99e2633b8f54768cc4519fba810900df2f80125183bb0a7

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true
xml.Worksheet 'ss:Name' => I18n.t(:tab_dashboard) do
  xml.Table do
    unless @activities.empty?

      xml.Row do
        heads = ["Id",
                 "Item type",
                 "Item",
                 "Event",
                 "Whodunnit",
                 "Object",
                 "Created at",
                 "Object changes",
                 "Related",
                 "Related type",
                 "Transaction"]

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

      @activities.each do |activity|
        xml.Row do
          data = [activity.id,
                  activity.item_type,
                  activity.item_id,
                  activity.event,
                  activity.whodunnit,
                  activity.object,
                  activity.created_at,
                  activity.object_changes,
                  activity.related_id,
                  activity.related_type,
                  activity.transaction_id]

          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

2 entries across 2 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 app/views/home/index.xls.builder
fat_free_crm-0.20.0 app/views/home/index.xls.builder