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

Inherits:
ApplicationController show all
Includes:
InitiativeAdmin
Defined in:
decidim-initiatives/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

Methods inherited from Admin::ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from NeedsSnippets

#snippets

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#approveObject

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


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

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


11
12
13
# File 'decidim-initiatives/app/controllers/decidim/initiatives/admin/committee_requests_controller.rb', line 11

def index
  enforce_permission_to :index, :initiative_committee_member
end

#revokeObject

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


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

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