Sha256: c5ed1793b996a69301ccfc39f6709942962bae29022cade4f3fd6e610871774d
Contents?: true
Size: 1.73 KB
Versions: 10
Compression:
Stored size: 1.73 KB
Contents
# frozen_string_literal: true module Decidim module Verifications module CsvCensus module Admin class CensusController < Decidim::Admin::ApplicationController layout "decidim/admin/users" before_action :show_instructions, unless: :csv_census_active? include Decidim::Admin::WorkflowsBreadcrumb add_breadcrumb_item_from_menu :workflows_menu def index enforce_permission_to :index, :authorization @form = form(CensusDataForm).instance @status = Status.new(current_organization) end 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 def destroy_all enforce_permission_to :destroy, :authorization CsvDatum.clear(current_organization) redirect_to census_path, notice: t(".success") end private def show_instructions enforce_permission_to :index, :authorization render :instructions end def csv_census_active? current_organization.available_authorizations.include?("csv_census") end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems