Sha256: 8c9f23f7f206faa975e6aeee84a15dad31b7669af05120dd98eb562d1a0d3b30
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim module Votings module Admin # This concern is meant to be included in all controllers that are scoped # into a voting admin panel. It will override the layout so it shows # the sidebar, preload the voting, etc. module VotingAdmin extend ActiveSupport::Concern RegistersPermissions .register_permissions(::Decidim::Votings::Admin::VotingAdmin, Decidim::Votings::Permissions, Decidim::Admin::Permissions) included do include Decidim::Admin::ParticipatorySpaceAdminContext participatory_space_admin_layout helper_method :current_voting def current_voting @current_voting ||= organization_votings.find_by!( slug: params[:voting_slug] || params[:slug] ) end alias_method :current_participatory_space, :current_voting def organization_votings @organization_votings ||= OrganizationVotings.new(current_organization).query end def permissions_context super.merge(current_participatory_space:) end def permission_class_chain PermissionsRegistry.chain_for(VotingAdmin) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems