clean up useless code
This commit is contained in:
parent
9aeeed140f
commit
a674e46c91
|
@ -2,84 +2,51 @@ class Admin::LayoutsController < ApplicationController
|
||||||
|
|
||||||
layout "admin"
|
layout "admin"
|
||||||
|
|
||||||
# GET /layouts
|
|
||||||
# GET /layouts.xml
|
|
||||||
def index
|
def index
|
||||||
@layouts = Layout.all
|
@layouts = Layout.all
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.xml { render :xml => @layouts }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /layouts/1
|
|
||||||
# GET /layouts/1.xml
|
|
||||||
def show
|
def show
|
||||||
@layout = Layout.find(params[:id])
|
@layout = Layout.find(params[:id])
|
||||||
|
|
||||||
redirect_to "/#{@layout.name}"
|
redirect_to "/#{@layout.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /layouts/new
|
|
||||||
# GET /layouts/new.xml
|
|
||||||
def new
|
def new
|
||||||
@layout = Layout.new
|
@layout = Layout.new
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.xml { render :xml => @layouts }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /layouts/1/edit
|
|
||||||
def edit
|
def edit
|
||||||
@layout = Layout.find(params[:id])
|
@layout = Layout.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /layouts
|
|
||||||
# POST /layouts.xml
|
|
||||||
def create
|
def create
|
||||||
@layout = Layout.new(params[:layout])
|
@layout = Layout.new(params[:layout])
|
||||||
|
|
||||||
respond_to do |format|
|
if @layout.save
|
||||||
if @layout.save
|
flash[:notice] = 'Layout was successfully created.'
|
||||||
flash[:notice] = 'Layout was successfully created.'
|
redirect_to admin_layouts_url
|
||||||
format.html { redirect_to admin_layouts_url }
|
else
|
||||||
format.xml { render :xml => @layout, :status => :created, :location => @layouts }
|
render :action => "new"
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.xml { render :xml => @layout.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# PUT /layouts/1
|
|
||||||
# PUT /layouts/1.xml
|
|
||||||
def update
|
def update
|
||||||
@layout = Layout.find(params[:id])
|
@layout = Layout.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
if @layout.update_attributes(params[:layout])
|
||||||
if @layout.update_attributes(params[:layout])
|
flash[:notice] = 'Layout was successfully updated.'
|
||||||
flash[:notice] = 'Layout was successfully updated.'
|
redirect_to admin_layouts_url
|
||||||
format.html { redirect_to admin_layouts_url }
|
else
|
||||||
format.xml { head :ok }
|
render :action => "edit"
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.xml { render :xml => @layout.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /layouts/1
|
|
||||||
# DELETE /layouts/1.xml
|
|
||||||
def destroy
|
def destroy
|
||||||
@layout = Layout.find(params[:id])
|
@layout = Layout.find(params[:id])
|
||||||
@layout.destroy
|
@layout.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
redirect_to admin_layouts_url
|
||||||
format.html { redirect_to admin_layouts_url }
|
|
||||||
format.xml { head :ok }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,86 +2,53 @@ class Admin::PagesController < ApplicationController
|
||||||
|
|
||||||
layout "admin"
|
layout "admin"
|
||||||
|
|
||||||
# GET /pages
|
|
||||||
# GET /pages.xml
|
|
||||||
def index
|
def index
|
||||||
@pages = Page.all( :conditions => { :parent_page_id => "root" } )
|
@pages = Page.all( :conditions => { :parent_page_id => "root" } )
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.xml { render :xml => @pages }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /pages/1
|
|
||||||
# GET /pages/1.xml
|
|
||||||
def show
|
def show
|
||||||
@page = Page.find(params[:id])
|
@page = Page.find(params[:id])
|
||||||
|
|
||||||
redirect_to "/#{@page.name}"
|
redirect_to "/#{@page.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /pages/new
|
|
||||||
# GET /pages/new.xml
|
|
||||||
def new
|
def new
|
||||||
@page = Page.new
|
@page = Page.new
|
||||||
@page.is_published = true
|
@page.is_published = true
|
||||||
@page.parent_page_id = params[:parent_page_id]
|
@page.parent_page_id = params[:parent_page_id]
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.xml { render :xml => @pages }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /pages/1/edit
|
|
||||||
def edit
|
def edit
|
||||||
@page = Page.find(params[:id])
|
@page = Page.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /pages
|
|
||||||
# POST /pages.xml
|
|
||||||
def create
|
def create
|
||||||
@page = Page.new(params[:page])
|
@page = Page.new(params[:page])
|
||||||
|
|
||||||
respond_to do |format|
|
if @page.save
|
||||||
if @page.save
|
flash[:notice] = 'Page was successfully created.'
|
||||||
flash[:notice] = 'Page was successfully created.'
|
redirect_to admin_pages_url
|
||||||
format.html { redirect_to admin_pages_url }
|
else
|
||||||
format.xml { render :xml => @page, :status => :created, :location => @pages }
|
render :action => "new"
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# PUT /pages/1
|
|
||||||
# PUT /pages/1.xml
|
|
||||||
def update
|
def update
|
||||||
@page = Page.find(params[:id])
|
@page = Page.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
if @page.update_attributes(params[:page])
|
||||||
if @page.update_attributes(params[:page])
|
flash[:notice] = 'Page was successfully updated.'
|
||||||
flash[:notice] = 'Page was successfully updated.'
|
redirect_to admin_pages_url
|
||||||
format.html { redirect_to admin_pages_url }
|
else
|
||||||
format.xml { head :ok }
|
render :action => "edit"
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /pages/1
|
|
||||||
# DELETE /pages/1.xml
|
|
||||||
def destroy
|
def destroy
|
||||||
@page = Page.find(params[:id])
|
@page = Page.find(params[:id])
|
||||||
@page.destroy
|
@page.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
redirect_to admin_pages_url
|
||||||
format.html { redirect_to admin_pages_url }
|
|
||||||
format.xml { head :ok }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,27 +2,16 @@ class Admin::SnippetsController < ApplicationController
|
||||||
|
|
||||||
layout "admin"
|
layout "admin"
|
||||||
|
|
||||||
# GET /snippets
|
|
||||||
# GET /snippets.xml
|
|
||||||
def index
|
def index
|
||||||
@snippets = Snippet.all
|
@snippets = Snippet.all
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.xml { render :xml => @snippets }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /snippets/1
|
|
||||||
# GET /snippets/1.xml
|
|
||||||
def show
|
def show
|
||||||
@snippet = Snippet.find(params[:id])
|
@snippet = Snippet.find(params[:id])
|
||||||
|
|
||||||
redirect_to "/#{@snippet.name}"
|
redirect_to "/#{@snippet.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /snippets/new
|
|
||||||
# GET /snippets/new.xml
|
|
||||||
def new
|
def new
|
||||||
@snippet = Snippet.new
|
@snippet = Snippet.new
|
||||||
|
|
||||||
|
@ -41,61 +30,40 @@ class Admin::SnippetsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.xml { render :xml => @snippets }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /snippets/1/edit
|
|
||||||
def edit
|
def edit
|
||||||
@snippet = Snippet.find(params[:id])
|
@snippet = Snippet.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /snippets
|
|
||||||
# POST /snippets.xml
|
|
||||||
def create
|
def create
|
||||||
@snippet = Snippet.new(params[:snippet])
|
@snippet = Snippet.new(params[:snippet])
|
||||||
|
|
||||||
respond_to do |format|
|
if @snippet.save
|
||||||
if @snippet.save
|
flash[:notice] = 'Snippet was successfully created.'
|
||||||
flash[:notice] = 'Snippet was successfully created.'
|
redirect_to admin_snippets_url
|
||||||
format.html { redirect_to admin_snippets_url }
|
else
|
||||||
format.xml { render :xml => @snippet, :status => :created, :location => @snippets }
|
render :action => "new"
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.xml { render :xml => @snippet.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# PUT /snippets/1
|
|
||||||
# PUT /snippets/1.xml
|
|
||||||
def update
|
def update
|
||||||
@snippet = Snippet.find(params[:id])
|
@snippet = Snippet.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
if @snippet.update_attributes(params[:snippet])
|
||||||
if @snippet.update_attributes(params[:snippet])
|
flash[:notice] = 'Snippet was successfully updated.'
|
||||||
flash[:notice] = 'Snippet was successfully updated.'
|
redirect_to admin_snippets_url
|
||||||
format.html { redirect_to admin_snippets_url }
|
else
|
||||||
format.xml { head :ok }
|
render :action => "edit"
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.xml { render :xml => @snippet.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /snippets/1
|
|
||||||
# DELETE /snippets/1.xml
|
|
||||||
def destroy
|
def destroy
|
||||||
@snippet = Snippet.find(params[:id])
|
@snippet = Snippet.find(params[:id])
|
||||||
@snippet.destroy
|
@snippet.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
redirect_to admin_snippets_url
|
||||||
format.html { redirect_to admin_snippets_url }
|
|
||||||
format.xml { head :ok }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,7 +29,7 @@ Rails::Initializer.run do |config|
|
||||||
|
|
||||||
# Skip frameworks you're not going to use. To use Rails without a database,
|
# Skip frameworks you're not going to use. To use Rails without a database,
|
||||||
# you must remove the Active Record framework.
|
# you must remove the Active Record framework.
|
||||||
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
config.frameworks -= [ :active_record ]
|
||||||
|
|
||||||
# Activate observers that should always be running
|
# Activate observers that should always be running
|
||||||
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
||||||
|
|
Reference in New Issue