Sha256: 2cd1f7674a2b97d4be51842f7bb144b1e07d224f55ffc661eed033bf8cb7f2c0

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

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

        # GET /admin/initiatives/:initiative_id/committee_requests
        def index
          authorize! :index, InitiativesCommitteeMember
        end

        # GET /initiatives/:initiative_id/committee_requests/:id/approve
        def approve
          authorize! :approve, 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
          authorize! :revoke, 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

4 entries across 4 versions & 1 rubygems

Version Path
decidim-initiatives-0.11.2 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.11.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.11.0.pre1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb
decidim-initiatives-0.9.1 app/controllers/decidim/initiatives/admin/committee_requests_controller.rb