Sha256: 647f2b5e7059052d3d382fa6bed2bcee3fbf8101e451e3c34b041baf15a92efd

Contents?: true

Size: 1.24 KB

Versions: 54

Compression:

Stored size: 1.24 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: :unprocessable_entity
              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

54 entries across 54 versions & 1 rubygems

Version Path
decidim-verifications-0.27.0.rc2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.27.0.rc1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.26.2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.26.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.26.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.26.0.rc2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.26.0.rc1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.25.2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.25.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.25.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.25.0.rc4 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.25.0.rc3 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.25.0.rc2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.25.0.rc1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.24.3 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.23.6 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.24.2 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.23.5 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.24.1 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb
decidim-verifications-0.24.0 app/controllers/decidim/verifications/postal_letter/admin/postages_controller.rb