Module: Decidim::AttachmentsHelper

Defined in:
app/helpers/decidim/attachments_helper.rb

Overview

A Helper to render and link to resources.

Instance Method Summary collapse

Instance Method Details

#attachment_title(attachment) ⇒ Object

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.



23
24
25
# File 'app/helpers/decidim/attachments_helper.rb', line 23

def attachment_title(attachment)
  attachment.title.is_a?(Hash) ? translated_attribute(attachment.title) : attachment.title
end

#attachments_for(attached_to) ⇒ Object

Renders a the attachments of a model that includes the HasAttachments concern.

attached_to - The model to render the attachments from.

Returns nothing.



12
13
14
# File 'app/helpers/decidim/attachments_helper.rb', line 12

def attachments_for(attached_to)
  render partial: "decidim/application/attachments", locals: { attached_to: attached_to }
end