Sha256: 9af2cd3ed52cd22d92c789b2571c2e3075e495ce32258ba54ebf5e6c229d4b60

Contents?: true

Size: 518 Bytes

Versions: 2

Compression:

Stored size: 518 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
      @resource.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

2 entries across 2 versions & 1 rubygems

Version Path
decidim-admin-0.16.1 app/events/decidim/attachment_created_event.rb
decidim-admin-0.16.0 app/events/decidim/attachment_created_event.rb