- No more Home object
- Sitemap on the left side and view of the current page in the main block
This commit is contained in:
1 parent
9fdfb140d3
commit
d9ba76ebd5
21 files changed
+122
-149
No files matched your search
@@ -1,50 +0,0 @@
|
||||
class Admin::HomesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def show
|
||||
#TODO
|
||||
end
|
||||
|
||||
def new
|
||||
@home = Home.new
|
||||
@home.is_published = true
|
||||
@home.parent_id = nil
|
||||
end
|
||||
|
||||
def edit
|
||||
@home = Home.find(params[:id])
|
||||
@i18n_variable = @home.i18n_variable
|
||||
end
|
||||
|
||||
def create
|
||||
@home = Home.new(params[:home])
|
||||
|
||||
if @home.save
|
||||
flash[:notice] = t('admin.create_success_home')
|
||||
redirect_to admin_items_url
|
||||
else
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@home = Home.find(params[:id])
|
||||
if @home.update_attributes(params[:home])
|
||||
flash[:notice] = t('admin.update_success_home')
|
||||
redirect_to admin_items_url
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@home = Home.find(params[:id])
|
||||
@home.destroy
|
||||
|
||||
redirect_to admin_items_url
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
class Admin::ItemsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
layout "content"
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :find_parent_item
|
||||
@@ -8,8 +8,11 @@ class Admin::ItemsController < ApplicationController
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
@items = Item.where(:parent_id => @parent_item.id).entries rescue []
|
||||
@items = Item.where(:_type => 'Home').entries unless (!@items.empty? || @parent_item)
|
||||
if params[:item_id]
|
||||
@page = Item.find(params[:item_id])
|
||||
else
|
||||
@page = Item.first(:conditions => {:parent_id => nil})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Admin::PagesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
layout "content"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :find_parent_item
|
||||
before_filter :is_admin?
|
||||
|
||||
Reference in new issue
Block a user