app/controllers/admin/snippets_controller.rb in locomotive_cms-0.0.2.9 vs app/controllers/admin/snippets_controller.rb in locomotive_cms-0.0.3.1

- old
+ new

@@ -1,56 +1,13 @@ module Admin class SnippetsController < BaseController sections 'settings' + + respond_to :json, :only => :update def index @snippets = current_site.snippets.order_by([[:name, :asc]]) - end - - def new - @snippet = current_site.snippets.build - end - - def edit - @snippet = current_site.snippets.find(params[:id]) - end - - def create - @snippet = current_site.snippets.build(params[:snippet]) - - if @snippet.save - flash_success! - redirect_to edit_admin_snippet_url(@snippet) - else - flash_error! - render :action => 'new' - end - end - - def update - @snippet = current_site.snippets.find(params[:id]) - - if @snippet.update_attributes(params[:snippet]) - flash_success! - redirect_to edit_admin_snippet_url(@snippet) - else - flash_error! - render :action => "edit" - end - end - - def destroy - @snippet = current_site.snippets.find(params[:id]) - - begin - @snippet.destroy - flash_success! - rescue Exception => e - flash[:error] = e.to_s - end - - redirect_to admin_snippets_url end end end \ No newline at end of file