26 lines
		
	
	
		
			519 B
		
	
	
	
		
			Ruby
		
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			519 B
		
	
	
	
		
			Ruby
		
	
	
	
| class Admin::ItemsController < ApplicationController
 | |
| 
 | |
|   layout "site_editor"
 | |
|   
 | |
|   before_filter :authenticate_user!
 | |
|   before_filter :find_parent_item
 | |
|   before_filter :find_snippets, :only => :index
 | |
|   before_filter :is_admin?
 | |
|   before_filter :set_current_item
 | |
|   
 | |
|   def index
 | |
|     if params[:item_id]
 | |
|       @item = Item.find(params[:item_id])
 | |
|     else
 | |
|       @item = get_homepage
 | |
|     end
 | |
|   end
 | |
|   
 | |
|   protected
 | |
|   
 | |
|   def find_snippets
 | |
|     @snippets = Snippet.where( { :parent_id => @parent_item.id } ) rescue nil
 | |
|   end
 | |
|   
 | |
| end
 |