Sha256: 0be2681c184caf7c844653757b4ccc74441e040cd3a8a007aa9b80434c86f175

Contents?: true

Size: 815 Bytes

Versions: 19

Compression:

Stored size: 815 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.html", 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

19 entries across 19 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.9 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.8 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.7 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.5 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.4 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.3 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.2 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.1 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.0 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.0.rc2 app/helpers/decidim/attachments_helper.rb
decidim-core-0.26.0.rc1 app/helpers/decidim/attachments_helper.rb
decidim-core-0.25.2 app/helpers/decidim/attachments_helper.rb
decidim-core-0.25.1 app/helpers/decidim/attachments_helper.rb
decidim-core-0.25.0 app/helpers/decidim/attachments_helper.rb
decidim-core-0.25.0.rc4 app/helpers/decidim/attachments_helper.rb
decidim-core-0.25.0.rc3 app/helpers/decidim/attachments_helper.rb
decidim-core-0.25.0.rc2 app/helpers/decidim/attachments_helper.rb
decidim-core-0.25.0.rc1 app/helpers/decidim/attachments_helper.rb