Sha256: ecd42ca2e9d6b4a7c69e10a42c10357910b09eff3ca664b9c3cadc7f959c15d5

Contents?: true

Size: 520 Bytes

Versions: 56

Compression:

Stored size: 520 Bytes

Contents

# frozen-string_literal: true

module Decidim
  class AttachmentCreatedEvent < Decidim::Events::SimpleEvent
    i18n_attributes :attached_to_url

    def resource_path
      @resource.url
    end

    def resource_url
      attached_to_url
    end

    def resource_text
      translated_attribute(
        resource.try(:description) ||
          resource.try(:body)
      )
    end

    private

    def attached_to_url
      resource_locator.url
    end

    def resource
      @resource.attached_to
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
decidim-admin-0.27.9 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.8 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.7 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.6 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.10 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.9 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.5 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.8 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.4 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.3 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.7 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.5 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.2 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.1 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.4 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.0 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.3 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.0.rc2 app/events/decidim/attachment_created_event.rb
decidim-admin-0.27.0.rc1 app/events/decidim/attachment_created_event.rb
decidim-admin-0.26.2 app/events/decidim/attachment_created_event.rb