engine/app/controllers/locomotive/snippets_controller.rb
2011-12-05 04:29:58 -08:00

37 lines
894 B
Ruby

module Locomotive
class SnippetsController < BaseController
sections 'settings', 'theme_assets'
respond_to :json, :only => [:create, :update]
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