2011-10-30 23:02:41 +00:00
|
|
|
module Locomotive
|
2010-05-10 22:39:52 +00:00
|
|
|
class SnippetsController < BaseController
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-09-22 12:50:01 +00:00
|
|
|
sections 'settings', 'theme_assets'
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2011-12-05 10:31:34 +00:00
|
|
|
respond_to :json, :only => [:create, :update]
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2011-11-28 14:40:25 +00:00
|
|
|
def new
|
|
|
|
@snippet = current_site.snippets.new
|
|
|
|
respond_with @snippet
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@snippet = current_site.snippets.create(params[:snippet])
|
2011-12-05 10:31:34 +00:00
|
|
|
respond_with @snippet, :location => edit_snippet_url(@snippet._id)
|
2011-11-28 14:40:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@snippet = current_site.snippets.find(params[:id])
|
|
|
|
respond_with @snippet
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@snippet = current_site.snippets.find(params[:id])
|
2011-12-05 12:29:58 +00:00
|
|
|
@snippet.update_attributes(params[:snippet])
|
2011-12-05 10:31:34 +00:00
|
|
|
respond_with @snippet, :location => edit_snippet_url(@snippet._id)
|
2011-11-28 14:40:25 +00:00
|
|
|
end
|
|
|
|
|
2010-09-22 12:50:01 +00:00
|
|
|
def destroy
|
2011-11-28 14:40:25 +00:00
|
|
|
@snippet = current_site.snippets.find(params[:id])
|
2011-12-05 14:39:52 +00:00
|
|
|
# @snippet.destroy
|
2011-11-28 14:40:25 +00:00
|
|
|
respond_with @snippet, :location => theme_assets_url
|
2010-05-10 22:39:52 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-10 22:39:52 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
end
|