Chris's first commit at Fri Jan 28 2011 10:14:32 GMT+0800 (CST)
This commit is contained in:
1 parent
554aa0a95d
commit
19a7d51e60
145 files changed
+12742
-893
No files matched your search
@@ -3,6 +3,7 @@ class Admin::PagesController < ApplicationController
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :find_parent_item
|
||||
before_filter :is_admin?
|
||||
|
||||
def show
|
||||
#TODO
|
||||
@@ -11,19 +12,22 @@ class Admin::PagesController < ApplicationController
|
||||
def new
|
||||
@page = Page.new
|
||||
@page.is_published = true
|
||||
@page.parent_name = @parent_item.name
|
||||
@page.parent_id = @parent_item.id rescue nil
|
||||
session[:last_page] = get_go_back || admin_items_url
|
||||
end
|
||||
|
||||
def edit
|
||||
@page = Page.find(params[:id])
|
||||
@i18n_variable = @page.i18n_variable
|
||||
session[:last_page] = get_go_back || admin_items_url
|
||||
end
|
||||
|
||||
def create
|
||||
@page = Page.new(params[:page])
|
||||
|
||||
if @page.save
|
||||
flash[:notice] = 'Page was successfully created.'
|
||||
redirect_to admin_items_url( :parent_name => @page.parent_name )
|
||||
flash[:notice] = t('admin.create_success_page')
|
||||
redirect_to admin_items_url( :parent_id => @page.parent_id )
|
||||
else
|
||||
render :action => "new"
|
||||
end
|
||||
@@ -31,10 +35,9 @@ class Admin::PagesController < ApplicationController
|
||||
|
||||
def update
|
||||
@page = Page.find(params[:id])
|
||||
|
||||
if @page.update_attributes(params[:page])
|
||||
flash[:notice] = 'Page was successfully updated.'
|
||||
redirect_to admin_items_url( :parent_name => @page.parent_name )
|
||||
flash[:notice] = t('admin.update_success_page')
|
||||
redirect_to admin_items_url( :parent_id => @page.parent_id )
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
@@ -44,7 +47,7 @@ class Admin::PagesController < ApplicationController
|
||||
@page = Page.find(params[:id])
|
||||
@page.destroy
|
||||
|
||||
redirect_to admin_items_url( :parent_name => @page.parent_name )
|
||||
redirect_to admin_items_url( :parent_id => @page.parent_id )
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user