Class: Decidim::DocumentsPanelCell

Inherits:
ViewModel
  • Object
show all
Includes:
ActiveSupport::NumberHelper, Cell::ViewModel::Partial, AttachmentsHelper, ERB::Util
Defined in:
app/cells/decidim/documents_panel_cell.rb

Overview

This cell is used to render the documents panel of a resource inside a tab of a show view

The model must be a resource to get the documents from.and is expected to respond to documents method

Example:

cell(
"decidim/documents_panel",
meeting
)

Instance Method Summary collapse

Methods included from AttachmentsHelper

#attachment_title, #attachments_for, #attachments_tab_panel_items

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, #external_icon, #favicon, #icon, #legacy_favicon, #role, #root_url

Methods included from TooltipHelper

#with_tooltip

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

#attachment?, #default_locale?

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'app/cells/decidim/documents_panel_cell.rb', line 38

def blank?
  documents.blank? && components_collections.blank?
end

#components_collectionsObject



34
35
36
# File 'app/cells/decidim/documents_panel_cell.rb', line 34

def components_collections
  @components_collections ||= options[:components_collections] || []
end

#documentsObject



30
31
32
# File 'app/cells/decidim/documents_panel_cell.rb', line 30

def documents
  @documents ||= resource.try(:documents)
end

#showObject



24
25
26
27
28
# File 'app/cells/decidim/documents_panel_cell.rb', line 24

def show
  return if blank?

  render
end