Class: Decidim::Verifications::CsvCensus::Admin::CensusController
- Inherits:
-
Admin::ApplicationController
- Object
- Admin::ApplicationController
- Decidim::Verifications::CsvCensus::Admin::CensusController
- Includes:
- Admin::WorkflowsBreadcrumb
- Defined in:
- app/controllers/decidim/verifications/csv_census/admin/census_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/decidim/verifications/csv_census/admin/census_controller.rb', line 23 def create :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 'app/controllers/decidim/verifications/csv_census/admin/census_controller.rb', line 40 def destroy_all :destroy, :authorization CsvDatum.clear(current_organization) redirect_to census_path, notice: t(".success") end |
#index ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/decidim/verifications/csv_census/admin/census_controller.rb', line 17 def index :index, :authorization @form = form(CensusDataForm).instance @status = Status.new(current_organization) end |