Class: Inkling::PathsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/inkling/paths_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
# File 'app/controllers/inkling/paths_controller.rb', line 6

def index
  @content_types = Inkling::Content::Types.listed
  @content_types ||= []
  @path = Inkling::Path.new
end

#update_treeObject



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

def update_tree 
  new_parent_id = params[:new_parent]
  child_id = params[:child]
  new_parent = Inkling::Path.find(new_parent_id)
  child = Inkling::Path.find(child_id)
  restriction = new_parent.restricts?(child)
  if restriction[0]
    @msg = restriction[1]
  else
    child.move_to_child_of new_parent
    child.save
    @msg = "Ok."
  end
end