Class: Decidim::Initiatives::Admin::CommitteeRequestsController

Inherits:
ApplicationController
  • Object
show all
Includes:
InitiativeAdmin
Defined in:
app/controllers/decidim/initiatives/admin/committee_requests_controller.rb

Overview

Controller in charge of managing committee membership

Instance Method Summary collapse

Methods included from InitiativeSlug

#id_from_slug, #slug_from_id

Methods inherited from ApplicationController

#permission_class_chain, #permissions_context

Instance Method Details

#approveObject

GET /initiatives/:initiative_id/committee_requests/:id/approve



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/decidim/initiatives/admin/committee_requests_controller.rb', line 18

def approve
  enforce_permission_to :approve, :initiative_committee_member, request: membership_request

  ApproveMembershipRequest.call(membership_request) do
    on(:ok) do
      redirect_to edit_initiative_path(current_initiative), flash: {
        notice: I18n.t("success", scope: "decidim.initiatives.committee_requests.approve")
      }
    end
  end
end

#indexObject

GET /admin/initiatives/:initiative_id/committee_requests



13
14
15
# File 'app/controllers/decidim/initiatives/admin/committee_requests_controller.rb', line 13

def index
  enforce_permission_to :index, :initiative_committee_member
end

#revokeObject

DELETE /initiatives/:initiative_id/committee_requests/:id/revoke



31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/decidim/initiatives/admin/committee_requests_controller.rb', line 31

def revoke
  enforce_permission_to :revoke, :initiative_committee_member, request: membership_request

  RevokeMembershipRequest.call(membership_request) do
    on(:ok) do
      redirect_to edit_initiative_path(current_initiative), flash: {
        notice: I18n.t("success", scope: "decidim.initiatives.committee_requests.revoke")
      }
    end
  end
end