orbit-basic/app/controllers/admin/items_controller.rb

30 lines
562 B
Ruby

class Admin::ItemsController < OrbitBackendController
layout "structure"
open_for_admin
def index
if params[:item_id]
@item = Item.find(params[:item_id])
else
@item = get_homepage
end
end
def destroy
@item = Item.find(params[:id])
@item.destroy
respond_to do |format|
format.js { render 'admin/items/reload_items' }
end
end
def update_position
item = Item.find(params[:id])
item.shift_to(params[:parent_id], params[:position].to_i)
render :nothing => true, status: 200
end
end