Sha256: 3bd2c21afda79d3b6035ec8d821029bd7bb4013abaadbe53796b3c8dba985a5f

Contents?: true

Size: 1.17 KB

Versions: 13

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

# http://www.atomenabled.org/developers/syndication/
items  = controller.controller_name
item   = items.singularize
assets = controller.instance_variable_get("@#{items}")

if item == 'task'
  assets = assets.values.flatten
  title  = t(:"#{@view}_tab") + ' ' + t(items.to_sym)
end

atom_feed do |feed|
  feed.title      title || t(items.to_sym)
  feed.updated    assets.any? ? assets.max_by(&:updated_at).updated_at : Time.now
  feed.generator  "Fat Free CRM v#{FatFreeCRM::VERSION::STRING}"
  feed.author do |author|
    author.name  current_user.full_name
    author.email current_user.email
  end

  assets.each do |asset|
    feed.entry(asset) do |entry|
      entry.title   !asset.is_a?(User) ? asset.name : "#{asset.full_name} (#{asset.username})"
      entry.summary send(:"#{item}_summary", asset) if respond_to?(:"#{item}_summary")

      entry.author do |author|
        author.name !asset.is_a?(User) ? asset.try(:user).try(:full_name) : asset.full_name
      end

      if asset.respond_to?(:assigned_to_full_name)
        entry.contributor do |contributor|
          contributor.name asset.assigned_to_full_name
        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/application/index.atom.builder
fat_free_crm-0.22.0 app/views/application/index.atom.builder
fat_free_crm-0.21.0 app/views/application/index.atom.builder
fat_free_crm-0.20.1 app/views/application/index.atom.builder
fat_free_crm-0.20.0 app/views/application/index.atom.builder
fat_free_crm-0.19.2 app/views/application/index.atom.builder
fat_free_crm-0.19.0 app/views/application/index.atom.builder
fat_free_crm-0.18.2 app/views/application/index.atom.builder
fat_free_crm-0.17.3 app/views/application/index.atom.builder
fat_free_crm-0.18.1 app/views/application/index.atom.builder
fat_free_crm-0.18.0 app/views/application/index.atom.builder
fat_free_crm-0.17.2 app/views/application/index.atom.builder
fat_free_crm-0.17.1 app/views/application/index.atom.builder