Class: Decidim::Admin::UserGroupsCsvVerificationsController

Inherits:
ApplicationController show all
Includes:
UserGroups
Defined in:
decidim-admin/app/controllers/decidim/admin/user_groups_csv_verifications_controller.rb

Overview

Controller that allows batch verifying user groups by uploading a CSV file.

Instance Method Summary collapse

Methods included from UserGroups

#enforce_user_groups_enabled

Methods inherited from 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

#createObject


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'decidim-admin/app/controllers/decidim/admin/user_groups_csv_verifications_controller.rb', line 18

def create
  enforce_permission_to :csv_verify, :user_group
  @form = form(UserGroupCsvVerificationForm).from_params(params)

  ProcessUserGroupVerificationCsv.call(@form) do
    on(:ok) do
      flash[:notice] = I18n.t("user_group.csv_verify.success", scope: "decidim.admin")
      redirect_to decidim_admin.user_groups_path
    end

    on(:invalid) do
      flash[:alert] = I18n.t("user_group.csv_verify.invalid", scope: "decidim.admin")
      render :new
    end
  end
end

#newObject


13
14
15
16
# File 'decidim-admin/app/controllers/decidim/admin/user_groups_csv_verifications_controller.rb', line 13

def new
  enforce_permission_to :csv_verify, :user_group
  @form = form(UserGroupCsvVerificationForm).instance
end