Module: Decidim::AttachmentsHelper
- Includes:
- IconHelper
- Included in:
- Decidim::Assemblies::AssembliesHelper, Conferences::ConferenceHelper, Debates::DebatesController, DocumentsPanelCell, Meetings::MeetingsController, ParticipatoryProcesses::ParticipatoryProcessHelper, Proposals::ProposalsController
- Defined in:
- decidim-core/app/helpers/decidim/attachments_helper.rb
Overview
A Helper to render and link to resources.
Instance Method Summary collapse
-
#attachment_title(attachment) ⇒ Object
Renders the attachment’s title.
-
#attachments_for(attached_to) ⇒ Object
Renders a the attachments of a model that includes the HasAttachments concern.
- #attachments_tab_panel_items(attached_to) ⇒ Object
Methods included from IconHelper
#component_icon, #manifest_icon, #resource_icon, #resource_type_icon, #resource_type_icon_key, #text_with_resource_icon
Methods included from LayoutHelper
#_icon_classes, #apple_favicon, #application_path, #current_url, #current_user_unread_data, #extended_navigation_bar, #external_icon, #favicon, #icon, #legacy_favicon, #role
Methods included from TooltipHelper
Methods included from ModalHelper
#decidim_drawer, #decidim_modal
Methods included from OrganizationHelper
#current_organization_name, #organization_colors, #organization_description_label, #organization_name
Methods included from TranslatableAttributes
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.
46 47 48 |
# File 'decidim-core/app/helpers/decidim/attachments_helper.rb', line 46 def () .title.is_a?(Hash) ? translated_attribute(.title) : .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.
12 13 14 15 16 |
# File 'decidim-core/app/helpers/decidim/attachments_helper.rb', line 12 def (attached_to) return unless attached_to.is_a?(Decidim::HasAttachments) cell "decidim/tab_panels", (attached_to) end |
#attachments_tab_panel_items(attached_to) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'decidim-core/app/helpers/decidim/attachments_helper.rb', line 18 def (attached_to) [ { enabled: attached_to.photos.any?, id: "images", text: t("decidim.application.photos.photos"), icon: resource_type_icon_key("images"), method: :cell, args: ["decidim/images_panel", attached_to] }, { enabled: attached_to.documents.any?, id: "documents", text: t("decidim.application.documents.documents"), icon: resource_type_icon_key("documents"), method: :cell, args: ["decidim/documents_panel", attached_to] } ] end |