Sha256: 64efc7c7af2d4bb72b3138d3c48aa586a7c341bf3f03620b3726b2de556161cc

Contents?: true

Size: 992 Bytes

Versions: 11

Compression:

Stored size: 992 Bytes

Contents

module Locomotive
  class SnippetsController < BaseController

    sections 'settings', 'theme_assets'

    localized

    before_filter :back_to_default_site_locale, :only => %w(new create)

    respond_to :json, :only => [:create, :update, :destroy]

    def new
      @snippet = current_site.snippets.new
      respond_with @snippet
    end

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

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

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

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

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc12 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc11 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc10 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc9 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc8 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc7 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc6 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc5 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc4 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc2 app/controllers/locomotive/snippets_controller.rb
locomotive_cms-2.0.0.rc1 app/controllers/locomotive/snippets_controller.rb