Class: Decidim::DecidimAwesome::ContentBlocks::AwesomeProcessesFormCell

Inherits:
ViewModel
  • Object
show all
Defined in:
app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb

Instance Method Summary collapse

Instance Method Details

#content_blockObject



9
10
11
# File 'app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb', line 9

def content_block
  options[:content_block]
end

#i18n_scopeObject



13
14
15
# File 'app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb', line 13

def i18n_scope
  "decidim.decidim_awesome.content_blocks.awesome_processes"
end

#process_group_optionsObject



25
26
27
28
29
# File 'app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb', line 25

def process_group_options
  groups = Decidim::ParticipatoryProcessGroup.where(organization: current_organization)
  [[t("any_group", scope: i18n_scope), 0]] +
    groups.map { |group| [translated_attribute(group.title), group.id] }
end

#process_status_optionsObject



31
32
33
34
35
36
37
38
# File 'app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb', line 31

def process_status_options
  [
    [t("process_statuses.active", scope: i18n_scope), "active"],
    [t("process_statuses.all", scope: i18n_scope), "all"],
    [t("process_statuses.upcoming", scope: i18n_scope), "upcoming"],
    [t("process_statuses.past", scope: i18n_scope), "past"]
  ]
end

#process_type_optionsObject



17
18
19
20
21
22
23
# File 'app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb', line 17

def process_type_options
  [
    [t("process_types.all", scope: i18n_scope), "all"],
    [t("process_types.processes", scope: i18n_scope), "processes"],
    [t("process_types.groups", scope: i18n_scope), "groups"]
  ]
end

#processes_for_selectObject



47
48
49
# File 'app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb', line 47

def processes_for_select
  reorder_by_saved_selection(build_process_options)
end

#selection_criteria_optionsObject



40
41
42
43
44
45
# File 'app/cells/decidim/decidim_awesome/content_blocks/awesome_processes_form_cell.rb', line 40

def selection_criteria_options
  [
    [t("selection_criteria_options.automatic", scope: i18n_scope), "automatic"],
    [t("selection_criteria_options.manual", scope: i18n_scope), "manual"]
  ]
end