Sha256: 4a835dff6e2be98161b5780ef57750b3c9b40215452b22d292674e86d619ec18

Contents?: true

Size: 810 Bytes

Versions: 12

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A Helper to render and link to resources.
  module AttachmentsHelper
    # Renders a the attachments of a model that includes the
    # HasAttachments concern.
    #
    # attached_to - The model to render the attachments from.
    #
    # Returns nothing.
    def attachments_for(attached_to)
      render partial: "decidim/application/attachments", locals: { attached_to: attached_to }
    end

    # Renders the attachment's title.
    # Checks if the attachment's title is translated or not and use
    # the correct render method.
    #
    # attachment - An Attachment object
    #
    # Returns String.
    def attachment_title(attachment)
      attachment.title.is_a?(Hash) ? translated_attribute(attachment.title) : attachment.title
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.8 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.7 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.6 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.5 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.4 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.3 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.2 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.1 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.0 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.0.rc2 app/helpers/decidim/attachments_helper.rb
decidim-core-0.27.0.rc1 app/helpers/decidim/attachments_helper.rb