Module: Decidim::Votings::VotingsHelper
- Includes:
- CheckBoxesTreeHelper
- Included in:
- ContentBlocks::MainDataCell, VotingDropdownMetadataCell
- Defined in:
- app/helpers/decidim/votings/votings_helper.rb
Instance Method Summary collapse
- #date_filter_values ⇒ Object
- #filter_sections ⇒ Object
- #voting_nav_items(participatory_space) ⇒ Object
Instance Method Details
#date_filter_values ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/decidim/votings/votings_helper.rb', line 8 def date_filter_values TreeNode.new( TreePoint.new("", t("votings.filters.all", scope: "decidim.votings")), [ TreePoint.new("active", t("votings.filters.active", scope: "decidim.votings")), TreePoint.new("upcoming", t("votings.filters.upcoming", scope: "decidim.votings")), TreePoint.new("finished", t("votings.filters.finished", scope: "decidim.votings")) ] ) end |
#filter_sections ⇒ Object
19 20 21 |
# File 'app/helpers/decidim/votings/votings_helper.rb', line 19 def filter_sections @filter_sections ||= [{ method: :with_any_date, collection: date_filter_values, label_scope: "decidim.votings.votings.filters", id: "date" }] end |
#voting_nav_items(participatory_space) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/helpers/decidim/votings/votings_helper.rb', line 23 def voting_nav_items(participatory_space) components = participatory_space.components.published.or(Decidim::Component.where(id: try(:current_component))) ( [ if participatory_space.check_census_enabled? { name: t("layouts.decidim.voting_navigation.check_census"), url: decidim_votings.voting_check_census_path(participatory_space), active: is_active_link?(decidim_votings.voting_check_census_path(participatory_space), :exclusive) } end ] + components.map do |component| { name: decidim_escape_translated(component.name), url: main_component_path(component), active: is_active_link?(main_component_path(component), :inclusive) && !is_active_link?("election_log", /election_log$/) } end + [ { name: t("layouts.decidim.voting_navigation.election_log"), url: decidim_votings.voting_elections_log_path(participatory_space), active: is_active_link?(decidim_votings.voting_elections_log_path(participatory_space), :exclusive) || is_active_link?("election_log", /election_log$/) } ] ).compact end |