Sha256: eb0f2d4f39683b83878be4bb9c17ee6d1b45c7ba35269fcfc5ac56dd74391db4

Contents?: true

Size: 1.61 KB

Versions: 8

Compression:

Stored size: 1.61 KB

Contents

module Coupler
  module Extensions
    module Transformers
      def self.registered(app)
        app.get "/transformers" do
          @transformers = Models::Transformer.all
          erb :'transformers/index'
        end

        app.post "/transformers/preview" do
          @transformer = Models::Transformer.new(params[:transformer])
          erb(:'transformers/preview', :layout => false)
        end

        app.get "/transformers/new" do
          @transformer = Models::Transformer.new
          erb :'transformers/new'
        end

        app.get '/transformers/:id' do
          @transformer = Models::Transformer[:id => params[:id]]
          erb :'transformers/show'
        end

        app.get "/transformers/:id/edit" do
          @transformer = Models::Transformer[:id => params[:id]]
          erb :'transformers/edit'
        end

        app.post "/transformers" do
          @transformer = Models::Transformer.new(params[:transformer])
          if @transformer.save
            redirect "/transformers"
          else
            erb :'transformers/new'
          end
        end

        app.put '/transformers/:id' do
          @transformer = Models::Transformer[:id => params[:id]]
          @transformer.set(params[:transformer])
          if @transformer.valid?
            @transformer.save
            redirect '/transformers'
          else
            erb :'transformers/edit'
          end
        end

        app.delete '/transformers/:id' do
          @transformer = Models::Transformer[:id => params[:id]]
          @transformer.destroy
          redirect '/transformers'
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
coupler-0.0.9-java lib/coupler/extensions/transformers.rb
coupler-0.0.8-java lib/coupler/extensions/transformers.rb
coupler-0.0.7-java lib/coupler/extensions/transformers.rb
coupler-0.0.6-java lib/coupler/extensions/transformers.rb
coupler-0.0.4-java lib/coupler/extensions/transformers.rb
coupler-0.0.3-java lib/coupler/extensions/transformers.rb
coupler-0.0.2-java lib/coupler/extensions/transformers.rb
coupler-0.0.1-java lib/coupler/extensions/transformers.rb