2010-01-14 10:30:53 +00:00
|
|
|
class Admin::ItemsController < ApplicationController
|
|
|
|
|
2011-12-05 01:54:41 +00:00
|
|
|
layout "site_editor"
|
2010-03-04 08:33:26 +00:00
|
|
|
|
|
|
|
before_filter :authenticate_user!
|
2010-01-14 10:30:53 +00:00
|
|
|
before_filter :find_parent_item
|
|
|
|
before_filter :find_snippets, :only => :index
|
2011-04-13 10:19:51 +00:00
|
|
|
before_filter :is_admin?
|
2011-05-13 01:08:42 +00:00
|
|
|
before_filter :set_current_item
|
2010-01-14 10:30:53 +00:00
|
|
|
|
|
|
|
def index
|
2011-05-09 10:49:57 +00:00
|
|
|
if params[:item_id]
|
2011-05-13 01:08:42 +00:00
|
|
|
@item = Item.find(params[:item_id])
|
2011-05-09 10:49:57 +00:00
|
|
|
else
|
2011-09-01 01:12:41 +00:00
|
|
|
@item = get_homepage
|
2011-05-09 10:49:57 +00:00
|
|
|
end
|
2010-02-22 08:10:13 +00:00
|
|
|
end
|
|
|
|
|
2010-01-14 10:30:53 +00:00
|
|
|
protected
|
|
|
|
|
|
|
|
def find_snippets
|
2011-04-13 10:19:51 +00:00
|
|
|
@snippets = Snippet.where( { :parent_id => @parent_item.id } ) rescue nil
|
2010-01-14 10:30:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|