Module: Decidim::Surveys::ApplicationHelper

Includes:
CheckBoxesTreeHelper, RichTextEditorHelper, Decidim::SanitizeHelper, PaginateHelper
Defined in:
app/helpers/decidim/surveys/application_helper.rb

Overview

Custom helpers, scoped to the surveys engine.

Instance Method Summary collapse

Instance Method Details

#filter_sectionsObject



23
24
25
26
27
28
29
30
31
# File 'app/helpers/decidim/surveys/application_helper.rb', line 23

def filter_sections
  @filter_sections ||= [{
    method: :with_any_state,
    collection: filter_surveys_date_values,
    label: t("decidim.proposals.proposals.filters.state"),
    id: "state",
    type: :radio_buttons
  }]
end

#filter_surveys_date_valuesObject

Returns a TreeNode to be used in the list filters to filter surveys by its state.



15
16
17
18
19
20
21
# File 'app/helpers/decidim/surveys/application_helper.rb', line 15

def filter_surveys_date_values
  [
    ["all", t("all", scope: "decidim.surveys.surveys.filters")],
    ["open", { checked: true }, t("open", scope: "decidim.surveys.surveys.filters.state_values")],
    ["closed", t("closed", scope: "decidim.surveys.surveys.filters.state_values")]
  ]
end