Add Item, Page, Component, Link inheritanced models
This commit is contained in:
1 parent
cd21cadfe7
commit
e1440a79d8
38 files changed
+417
-175
No files matched your search
@@ -1,21 +1,16 @@
|
||||
class Admin::PagesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :find_parent_item
|
||||
|
||||
def index
|
||||
@pages = Page.all( :conditions => { :parent_page_name => params[:parent] || "root" } )
|
||||
end
|
||||
|
||||
def show
|
||||
@page = Page.find(params[:id])
|
||||
|
||||
redirect_to "/#{@page.name}"
|
||||
#TODO
|
||||
end
|
||||
|
||||
def new
|
||||
@page = Page.new
|
||||
@page.is_published = true
|
||||
@page.parent_page_name = params[:parent_page_name]
|
||||
@page.parent_item_name = @parent_item.name
|
||||
end
|
||||
|
||||
def edit
|
||||
@@ -27,7 +22,7 @@ class Admin::PagesController < ApplicationController
|
||||
|
||||
if @page.save
|
||||
flash[:notice] = 'Page was successfully created.'
|
||||
redirect_to admin_pages_url( :parent_page_name => @page.parent_page_name )
|
||||
redirect_to admin_items_url( :parent_item_name => @page.parent_item_name )
|
||||
else
|
||||
render :action => "new"
|
||||
end
|
||||
@@ -38,7 +33,7 @@ class Admin::PagesController < ApplicationController
|
||||
|
||||
if @page.update_attributes(params[:page])
|
||||
flash[:notice] = 'Page was successfully updated.'
|
||||
redirect_to admin_pages_url
|
||||
redirect_to admin_items_url( :parent_item_name => @page.parent_item_name )
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
@@ -48,7 +43,7 @@ class Admin::PagesController < ApplicationController
|
||||
@page = Page.find(params[:id])
|
||||
@page.destroy
|
||||
|
||||
redirect_to admin_pages_url
|
||||
redirect_to admin_items_url( :parent_item_name => @page.parent_item_name )
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user