Sha256: 009a9c92eca55ff4c7b0cf2744c1b74d98e5cfdc0d5aa1add4fe4c6af6c44bb2

Contents?: true

Size: 1.24 KB

Versions: 35

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    module Admin
      # Controller in charge of managing committee membership
      class CommitteeRequestsController < Decidim::Initiatives::Admin::ApplicationController
        include InitiativeAdmin

        # GET /admin/initiatives/:initiative_id/committee_requests
        def index
          enforce_permission_to :index, :initiative_committee_member
        end

        # GET /initiatives/:initiative_id/committee_requests/:id/approve
        def approve
          enforce_permission_to :approve, :initiative_committee_member, request: membership_request
          membership_request.accepted!

          redirect_to initiative_committee_requests_path(membership_request.initiative)
        end

        # DELETE /initiatives/:initiative_id/committee_requests/:id/revoke
        def revoke
          enforce_permission_to :revoke, :initiative_committee_member, request: membership_request
          membership_request.rejected!
          redirect_to initiative_committee_requests_path(membership_request.initiative)
        end

        private

        def membership_request
          @membership_request ||= InitiativesCommitteeMember.find(params[:id])
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
decidim-initiatives-0.23.6 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.23.5 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.23.4 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.23.3 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.23.2 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.23.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.23.1.rc1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.23.0 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.22.0 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.21.0 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.20.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.20.0 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.19.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.18.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.19.0 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.17.2 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.18.0 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.17.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.16.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.17.0 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb