Sha256: b45bc6e0aa5745ef1ff791086e7e43934a79ebcc7f190bf3fed0177c45a064da
Contents?: true
Size: 996 Bytes
Versions: 85
Compression:
Stored size: 996 Bytes
Contents
# frozen_string_literal: true module Decidim module Proposals module Admin class ProposalsImportsController < Admin::ApplicationController def new enforce_permission_to :import, :proposals @form = form(Admin::ProposalsImportForm).instance end def create enforce_permission_to :import, :proposals @form = form(Admin::ProposalsImportForm).from_params(params) Admin::ImportProposals.call(@form) do on(:ok) do |proposals| flash[:notice] = I18n.t("proposals_imports.create.success", scope: "decidim.proposals.admin", number: proposals.length) redirect_to EngineRouter.admin_proxy(current_component).root_path end on(:invalid) do flash.now[:alert] = I18n.t("proposals_imports.create.invalid", scope: "decidim.proposals.admin") render action: "new" end end end end end end end
Version data entries
85 entries across 85 versions & 1 rubygems