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

Constants included from AmendmentsHelper

AmendmentsHelper::TOTAL_STEPS

Instance Method Summary collapse

Methods inherited from CollaborativeDraftsController

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

Methods included from IconHelper

#component_icon, #manifest_icon, #resource_icon, #resource_type_icon, #resource_type_icon_key, #text_with_resource_icon

Methods included from LayoutHelper

#_icon_classes, #apple_favicon, #application_path, #current_url, #current_user_unread_data, #extended_navigation_bar, #external_icon, #favicon, #icon, #legacy_favicon, #role

Methods included from TooltipHelper

#with_tooltip

Methods included from ModalHelper

#decidim_drawer, #decidim_modal

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#default_locale?

Methods included from ApplicationHelper

#add_body_classes, #cell, #edit_link, #extra_admin_link, #html_truncate, #present, #prevent_timeout_seconds, #resolve_presenter_class, #text_initials

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?, #amendments_enabled?, #amendments_form_field_for, #amendments_form_fields_label, #amendments_form_fields_value, #can_participate_in_private_space?, #can_react_to_emendation?, #current_step, #emendation_actions_for, #emendation_announcement_for, #promote_button_for, #render_emendation_body, #total_steps, #wizard_aside_back_url, #wizard_header_title

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_select_field, #scopes_select_tag

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, #ordered_scopes_descendants, #ordered_scopes_descendants_for_select, #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, #set_component_breadcrumb_item

Methods included from RegistersPermissions

register_permissions

Methods inherited from ApplicationController

#store_share_token

Methods included from UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from Headers::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