Class: Decidim::Proposals::CollaborativeDraftCollaboratorRequestsController

Inherits:
CollaborativeDraftsController show all
Defined in:
decidim-proposals/app/controllers/decidim/proposals/collaborative_draft_collaborator_requests_controller.rb

Overview

Exposes Collaborative Draft Request actions for collaboration between participants on a resource.

Constant Summary

Constants included from Decidim::Paginable

Decidim::Paginable::OPTIONS

Instance Method Summary collapse

Methods inherited from CollaborativeDraftsController

#create, #edit, #index, #new, #publish, #show, #update, #withdraw

Methods included from ApplicationHelper

#cell, #edit_link, #extra_admin_link, #html_truncate, #present, #resolve_presenter_class, #step_cta_url

Methods included from CacheHelper

#cache

Methods included from AmendmentsHelper

#accept_and_reject_buttons_for, #action_button_card_for, #allowed_to_accept_and_reject?, #allowed_to_promote?, #amend_button_for, #amenders_list_for, #amendments_enabled?, #amendments_for, #amendments_form_field_for, #amendments_form_fields_label, #amendments_form_fields_value, #can_participate_in_private_space?, #can_react_to_emendation?, #emendation_actions_for, #emendation_announcement_for, #promote_button_for, #render_emendation_body

Methods included from RichTextEditorHelper

included, #text_editor_for

Methods included from ContextualHelpHelper

#floating_help

Methods included from ScopesHelper

#has_visible_scopes?, #scope_name_for_picker, #scopes_picker_field, #scopes_picker_filter, #scopes_picker_tag

Methods included from TranslatableAttributes

#default_locale?

Methods included from DecidimFormHelper

#areas_for_select, #base_error_messages, #decidim_form_for, #decidim_form_slug_url, #editor_field_tag, #form_field_has_error?, #form_required_explanation, #name_with_locale, #scopes_picker_field_tag, #tab_element_class_for, #translated_field_tag

Methods included from OmniauthHelper

#normalize_provider_name, #oauth_icon, #provider_name

Methods inherited from ApplicationController

#proposal_limit, #proposal_limit_reached?, #proposals

Methods inherited from Components::BaseController

#current_component, #current_manifest, #current_participatory_space, #permission_class_chain, #permission_scope, #redirect_unless_feature_private, #share_token

Methods included from RegistersPermissions

register_permissions

Methods included from UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#request_acceptObject


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'decidim-proposals/app/controllers/decidim/proposals/collaborative_draft_collaborator_requests_controller.rb', line 24

def request_accept
  @accept_request_form = form(AcceptAccessToCollaborativeDraftForm).from_params(params)
  AcceptAccessToCollaborativeDraft.call(@accept_request_form, current_user) do
    on(:ok) do |requester_user|
      flash[:notice] = t("accepted_request.success", scope: "decidim.proposals.collaborative_drafts.requests", user: requester_user.nickname)
    end

    on(:invalid) do
      flash[:alert] = t("accepted_request.error", scope: "decidim.proposals.collaborative_drafts.requests")
    end
  end
  redirect_to Decidim::ResourceLocatorPresenter.new(@collaborative_draft).path
end

#request_accessObject


10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'decidim-proposals/app/controllers/decidim/proposals/collaborative_draft_collaborator_requests_controller.rb', line 10

def request_access
  @request_access_form = form(RequestAccessToCollaborativeDraftForm).from_params(params)
  RequestAccessToCollaborativeDraft.call(@request_access_form, current_user) do
    on(:ok) do |_collaborative_draft|
      flash[:notice] = t("access_requested.success", scope: "decidim.proposals.collaborative_drafts.requests")
    end

    on(:invalid) do
      flash[:alert] = t("access_requested.error", scope: "decidim.proposals.collaborative_drafts.requests")
    end
  end
  redirect_to Decidim::ResourceLocatorPresenter.new(@collaborative_draft).path
end

#request_rejectObject


38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'decidim-proposals/app/controllers/decidim/proposals/collaborative_draft_collaborator_requests_controller.rb', line 38

def request_reject
  @reject_request_form = form(RejectAccessToCollaborativeDraftForm).from_params(params)
  RejectAccessToCollaborativeDraft.call(@reject_request_form, current_user) do
    on(:ok) do |requester_user|
      flash[:notice] = t("rejected_request.success", scope: "decidim.proposals.collaborative_drafts.requests", user: requester_user.nickname)
    end

    on(:invalid) do
      flash.now[:alert] = t("rejected_request.error", scope: "decidim.proposals.collaborative_drafts.requests")
    end
  end
  redirect_to Decidim::ResourceLocatorPresenter.new(@collaborative_draft).path
end