Class: Decidim::Votings::Menu
- Inherits:
-
Object
- Object
- Decidim::Votings::Menu
- Defined in:
- lib/decidim/votings/menu.rb
Class Method Summary collapse
- .register_admin_menu_modules! ⇒ Object
- .register_admin_voting_menu! ⇒ Object
- .register_admin_votings_components_menu! ⇒ Object
- .register_decidim_votings_monitoring_committee_menu! ⇒ Object
- .register_home_content_block_menu! ⇒ Object
- .register_menu! ⇒ Object
- .register_votings_admin_attachments_menu! ⇒ Object
Class Method Details
.register_admin_menu_modules! ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/decidim/votings/menu.rb', line 28 def self. Decidim. :admin_menu_modules do || .add_item :votings, I18n.t("menu.votings", scope: "decidim.votings.admin"), decidim_admin_votings.votings_path, icon_name: "mail-line", position: 2.6, active: :inclusive, if: allowed_to?(:enter, :space_area, space_name: :votings) end end |
.register_admin_voting_menu! ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/decidim/votings/menu.rb', line 100 def self. Decidim. :admin_voting_menu do || .add_item :edit_voting, I18n.t("info", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.edit_voting_path(current_participatory_space), icon_name: "information-line", if: allowed_to?(:edit, :voting, voting: current_participatory_space) .add_item :edit_voting_landing_page, I18n.t("landing_page", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.edit_voting_landing_page_path(current_participatory_space), icon_name: "layout-masonry-line", if: allowed_to?(:update, :landing_page) .add_item :components, I18n.t("components", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.components_path(current_participatory_space), active: is_active_link?(decidim_admin_votings.components_path(current_participatory_space), ["decidim/votings/admin/components", %w(index new edit)]), icon_name: "tools-line", if: allowed_to?(:read, :components, voting: current_participatory_space), submenu: { target_menu: :admin_votings_components_menu } .add_item :attachments, I18n.t("attachments", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.(current_participatory_space), icon_name: "attachment-2", active: is_active_link?(decidim_admin_votings.(current_participatory_space)) || is_active_link?(decidim_admin_votings.(current_participatory_space)), if: allowed_to?(:read, :attachment, voting: current_participatory_space) || allowed_to?(:read, :attachment_collection, voting: current_participatory_space) .add_item :voting_polling_stations, I18n.t("polling_stations", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.voting_polling_stations_path(current_participatory_space), icon_name: "mail-line", if: !current_participatory_space.online_voting? && allowed_to?(:read, :polling_stations) .add_item :voting_polling_officers, I18n.t("polling_officers", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.voting_polling_officers_path(current_participatory_space), icon_name: "mail-line", if: !current_participatory_space.online_voting? && allowed_to?(:read, :polling_officers) .add_item :voting_monitoring_committee, I18n.t("monitoring_committee", scope: "decidim.votings.admin.menu.votings_submenu"), "#", icon_name: "mail-line", active: false, if: !current_participatory_space.online_voting? && allowed_to?(:read, :monitoring_committee_menu, voting: current_participatory_space), submenu: { target_menu: :decidim_votings_monitoring_committee_menu } .add_item :voting_ballot_styles, I18n.t("ballot_styles", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.voting_ballot_styles_path(current_participatory_space), icon_name: "mail-line", if: allowed_to?(:read, :ballot_styles) end end |
.register_admin_votings_components_menu! ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/decidim/votings/menu.rb', line 40 def self. Decidim. :admin_votings_components_menu do || current_participatory_space.components.each do |component| = decidim_escape_translated(component.name) += content_tag(:span, component.primary_stat, class: "component-counter") if component.primary_stat.present? .add_item [component.manifest_name, component.id].join("_"), .html_safe, manage_component_path(component), active: is_active_link?(manage_component_path(component)) || is_active_link?(decidim_admin_votings.edit_component_path(current_participatory_space, component)) || is_active_link?(decidim_admin_votings.(current_participatory_space, component)) || participatory_space_active_link?(component), if: component.manifest.admin_engine # && user_role_config.component_is_accessible?(component.manifest_name) end end end |
.register_decidim_votings_monitoring_committee_menu! ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/decidim/votings/menu.rb', line 75 def self. Decidim. :decidim_votings_monitoring_committee_menu do || .add_item :voting_monitoring_committee_members, I18n.t("monitoring_committee_members", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.voting_monitoring_committee_members_path(current_participatory_space), active: is_active_link?(decidim_admin_votings.voting_monitoring_committee_members_path(current_participatory_space)), if: allowed_to?(:read, :monitoring_committee_members) .add_item :monitoring_committee_polling_station_closures, I18n.t("monitoring_committee_polling_station_closures", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.voting_monitoring_committee_polling_station_closures_path(current_participatory_space), active: is_active_link?(decidim_admin_votings.voting_monitoring_committee_polling_station_closures_path(current_participatory_space)), if: allowed_to?(:read, :monitoring_committee_polling_station_closures, voting: current_participatory_space) .add_item :monitoring_committee_verify_elections, I18n.t("monitoring_committee_verify_elections", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.voting_monitoring_committee_verify_elections_path(current_participatory_space), active: is_active_link?(decidim_admin_votings.voting_monitoring_committee_verify_elections_path(current_participatory_space)), if: allowed_to?(:read, :monitoring_committee_verify_elections, voting: current_participatory_space) .add_item :monitoring_committee_election_results, I18n.t("monitoring_committee_election_results", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.voting_monitoring_committee_election_results_path(current_participatory_space), active: is_active_link?(decidim_admin_votings.voting_monitoring_committee_election_results_path(current_participatory_space)), if: allowed_to?(:read, :monitoring_committee_election_results, voting: current_participatory_space) end end |
.register_home_content_block_menu! ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/decidim/votings/menu.rb', line 17 def self. Decidim. :home_content_block_menu do || .add_item :votings, I18n.t("menu.votings", scope: "decidim"), decidim_votings.votings_path, position: 40, if: Decidim::Votings::Voting.where(organization: current_organization).published.any?, active: :inclusive end end |
.register_menu! ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/decidim/votings/menu.rb', line 6 def self. Decidim. :menu do || .add_item :votings, I18n.t("menu.votings", scope: "decidim"), decidim_votings.votings_path, position: 2.6, if: Decidim::Votings::Voting.where(organization: current_organization).published.any?, active: :inclusive end end |
.register_votings_admin_attachments_menu! ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/decidim/votings/menu.rb', line 58 def self. Decidim. :votings_admin_attachments_menu do || .add_item :voting_attachments, I18n.t("attachment_files", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.(current_participatory_space), active: is_active_link?(decidim_admin_votings.(current_participatory_space)), if: allowed_to?(:read, :attachment, voting: current_participatory_space), icon_name: "attachment-line" .add_item :voting_attachment_collections, I18n.t("attachment_collections", scope: "decidim.votings.admin.menu.votings_submenu"), decidim_admin_votings.(current_participatory_space), active: is_active_link?(decidim_admin_votings.(current_participatory_space)), if: allowed_to?(:read, :attachment_collection, voting: current_participatory_space), icon_name: "folder-line" end end |