Sha256: 256d472b12640c6efe8b2a44a0ee4a409364a515a4cac1820d7c1e523b9015a8

Contents?: true

Size: 943 Bytes

Versions: 5

Compression:

Stored size: 943 Bytes

Contents

module Locomotive
  module Api
    class SnippetsController < BaseController

      load_and_authorize_resource :class => Locomotive::Snippet

      def index
        @snippets = current_site.snippets.order_by([[:name, :asc]])
        respond_with(@snippets)
      end

      def show
        @snippet = current_site.snippets.find(params[:id])
        respond_with @snippet
      end

      def create
        @snippet = current_site.snippets.create(params[:snippet])
        respond_with @snippet, :location => main_app.locomotive_api_snippets_url
      end

      def update
        @snippet = current_site.snippets.find(params[:id])
        @snippet.update_attributes(params[:snippet])
        respond_with @snippet, :location => main_app.locomotive_api_snippets_url
      end

      def destroy
        @snippet = current_site.snippets.find(params[:id])
        @snippet.destroy
        respond_with @snippet
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc12 app/controllers/locomotive/api/snippets_controller.rb
locomotive_cms-2.0.0.rc11 app/controllers/locomotive/api/snippets_controller.rb
locomotive_cms-2.0.0.rc10 app/controllers/locomotive/api/snippets_controller.rb
locomotive_cms-2.0.0.rc9 app/controllers/locomotive/api/snippets_controller.rb
locomotive_cms-2.0.0.rc8 app/controllers/locomotive/api/snippets_controller.rb