Class: Decidim::ProcessGroupsContentBlock::ContentBlocks::HighlightedProcessGroupsCell

Inherits:
ViewModel
  • Object
show all
Includes:
SanitizeHelper
Defined in:
app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups_cell.rb

Instance Method Summary collapse

Instance Method Details

#decidim_participatory_processesObject



33
34
35
# File 'app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups_cell.rb', line 33

def decidim_participatory_processes
  Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
end

#highlighted_groupsObject



18
19
20
21
22
23
24
25
26
27
# File 'app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups_cell.rb', line 18

def highlighted_groups
  Decidim::ParticipatoryProcesses::OrganizationPrioritizedParticipatoryProcessGroups.new(
    current_organization
  ).query
  .joins(:participatory_processes)
  .where.not(decidim_participatory_processes: { published_at: nil })
  .where('decidim_participatory_processes.end_date > ?', DateTime.now)
  .group('decidim_participatory_process_groups.id')
  .having('COUNT(decidim_participatory_processes.id) > 0')
end

#i18n_scopeObject



29
30
31
# File 'app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups_cell.rb', line 29

def i18n_scope
  "decidim.process_groups_content_block.pages.home.highlighted_process_groups"
end

#showObject



12
13
14
15
16
# File 'app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups_cell.rb', line 12

def show
  if highlighted_groups.any?
    render
  end
end