Sha256: 36268ef05d46b36f6e2f427491e42081a81eb5e4ff50e17ef4aca3b5177faaaf

Contents?: true

Size: 1.22 KB

Versions: 21

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

module Decidim
  module Verifications
    module PostalLetter
      module Admin
        #
        # Handles postages for verification letters.
        #
        class PostagesController < Decidim::Admin::ApplicationController
          layout "decidim/admin/users"

          before_action :load_pending_authorization

          def create
            enforce_permission_to :update, :authorization, authorization: @pending_authorization

            @form = PostageForm.from_model(@pending_authorization)

            PerformAuthorizationStep.call(@pending_authorization, @form) do
              on(:ok) do
                flash[:notice] = t("postages.create.success", scope: "decidim.verifications.postal_letter.admin")
                redirect_to pending_authorizations_path
              end

              on(:invalid) do
                render json: { error: I18n.t("postages.create.error", scope: "decidim.verifications.postal_letter.admin") }, status: 422
              end
            end
          end

          private

          def load_pending_authorization
            @pending_authorization = Authorization.find(params[:pending_authorization_id])
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
decidim-verifications-0.18.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.17.2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.18.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.17.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.16.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.17.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.16.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.15.2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.15.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.15.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.14.4 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.14.3 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.14.2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.14.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.13.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.12.2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.13.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.12.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.13.0.pre1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.12.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb