Class: Decidim::Verifications::CsvCensus::Admin::CensusController
Instance Method Summary
collapse
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
#disable_http_caching
#default_locale?
#snippets
register_permissions
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'decidim-verifications/app/controllers/decidim/verifications/csv_census/admin/census_controller.rb', line 23
def create
enforce_permission_to :create, :authorization
@form = form(CensusDataForm).from_params(params)
@status = Status.new(current_organization)
CreateCensusData.call(@form, current_organization) do
on(:ok) do
flash[:notice] = t(".success", count: @form.data.values.count, errors: @form.data.errors.count)
redirect_to census_path
end
on(:invalid) do
flash[:alert] = t(".error")
render :index
end
end
end
|
#destroy_all ⇒ Object
40
41
42
43
44
45
|
# File 'decidim-verifications/app/controllers/decidim/verifications/csv_census/admin/census_controller.rb', line 40
def destroy_all
enforce_permission_to :destroy, :authorization
CsvDatum.clear(current_organization)
redirect_to census_path, notice: t(".success")
end
|
#index ⇒ Object
17
18
19
20
21
|
# File 'decidim-verifications/app/controllers/decidim/verifications/csv_census/admin/census_controller.rb', line 17
def index
enforce_permission_to :index, :authorization
@form = form(CensusDataForm).instance
@status = Status.new(current_organization)
end
|