Sha256: 34c0b0f425e5d2348b93e5a18e24ce0a849cf526666726e482344f06d48e63d5

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

module Locomotive
  module Api
    class ContentTypesController < BaseController

      load_and_authorize_resource :class => Locomotive::ContentType

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

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

      def create
        @content_type = current_site.content_types.create(params[:content_type])
        respond_with @content_type, :location => main_app.locomotive_api_content_types_url
      end

      def update
        @content_type = current_site.content_types.find(params[:id])
        @content_type.update_attributes(params[:content_type])
        respond_with @content_type, :location => main_app.locomotive_api_content_types_url
      end

      def destroy
        @content_type = current_site.content_types.find(params[:id])
        @content_type.destroy
        respond_with @content_type
      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/content_types_controller.rb
locomotive_cms-2.0.0.rc11 app/controllers/locomotive/api/content_types_controller.rb
locomotive_cms-2.0.0.rc10 app/controllers/locomotive/api/content_types_controller.rb
locomotive_cms-2.0.0.rc9 app/controllers/locomotive/api/content_types_controller.rb
locomotive_cms-2.0.0.rc8 app/controllers/locomotive/api/content_types_controller.rb