Set order of page context to match the order of structure
Add some params to keep the sorting
This commit is contained in:
1 parent
127ab3845c
commit
c2331695cd
4 files changed
+39
-20
No files matched your search
@@ -64,6 +64,10 @@ class Item
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def self.structure_ordered_items
|
||||
self.get_children(Item.root, [])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -87,5 +91,13 @@ class Item
|
||||
def validates_presence_of_parent_id?
|
||||
true
|
||||
end
|
||||
|
||||
def self.get_children(item, tree)
|
||||
tree << item
|
||||
item.children.each do |child|
|
||||
self.get_children(child, tree)
|
||||
end
|
||||
tree
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user