Class: Admin::Page::ContentsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/page/contents_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



8
9
10
# File 'app/controllers/admin/page/contents_controller.rb', line 8

def index
  @contents = @section.contents #.filtered params[:filters]
end

#update_allObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/admin/page/contents_controller.rb', line 12

def update_all
  params[:contents].each do |id, attrs|
    content = Content.find id
    parent = Content.find_by_id attrs[:parent_id]
    left = Content.find_by_id attrs[:left_id]
    if parent
      content.move_to_child_with_index parent, 0
    else
      content.move_to_root
      content.move_to_left_of content.siblings.first
    end
    content.move_to_right_of left if left
  end
  render :text => 'OK'
end