25 lines
		
	
	
		
			497 B
		
	
	
	
		
			Ruby
		
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			497 B
		
	
	
	
		
			Ruby
		
	
	
	
| class Admin::ItemsController < ApplicationController
 | |
| 
 | |
|   layout "site_editor"
 | |
|   
 | |
|   before_filter :authenticate_user!
 | |
|   before_filter :find_parent_item
 | |
|   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
 | |
| 
 | |
|   def update_position
 | |
|     item = Item.find(params[:id])
 | |
|     item.shift_to(params[:parent_id], params[:position])
 | |
|     render :nothing => true
 | |
|   end
 | |
|   
 | |
| end
 |