Sha256: d65c40fc50cd8bc7191197921e5e7261b0c3e046be4fa156ab070a8557ecb31d

Contents?: true

Size: 932 Bytes

Versions: 6

Compression:

Stored size: 932 Bytes

Contents

module Spontaneous::Rack::Back
  class Schema < Base
    # Use the CSRF verification step separately from the main app
    # because it conflicts with the Index application:
    # The index application needs to load without CSRF validation
    # and the Schema app needs CSRF validation
    # but the Schema app has be before Index in the stack
    use Spontaneous::Rack::Middleware::CSRF::Verification

    def schema
      site.schema
    end

    post "/delete" do
      begin
        schema.apply_fix(:delete, params[:uid])
      rescue Spot::SchemaModificationError # ignore remaining errors - they will be fixed later
      end
      redirect(params[:origin])
    end

    post "/rename" do
      begin
        schema.apply_fix(:rename, params[:uid], params[:ref])
      rescue Spot::SchemaModificationError => e # ignore remaining errors - they will be fixed later
      end
      redirect(params[:origin])
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/rack/back/schema.rb
spontaneous-0.2.0.beta9 lib/spontaneous/rack/back/schema.rb
spontaneous-0.2.0.beta8 lib/spontaneous/rack/back/schema.rb
spontaneous-0.2.0.beta7 lib/spontaneous/rack/back/schema.rb
spontaneous-0.2.0.beta6 lib/spontaneous/rack/back/schema.rb
spontaneous-0.2.0.beta5 lib/spontaneous/rack/back/schema.rb