effective_pages 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/menu.rb +3 -2
- data/lib/effective_pages/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdc2ea024af5c64997e65499eb7fbc7b30a9646a
|
4
|
+
data.tar.gz: d1b13ac733384c370d8425bdd5e367477fd8e20f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6a4e49899bda3930447e7520b8183a570815c471d4a1c2ae242488da092984e76cbe07b033d780e84cca08526664fe6dc1c1482b084ccf6ecbc798e40830918
|
7
|
+
data.tar.gz: 55386e22ea38c173c02cf7a37edd523250decb1f79ae9ea19f75593c7d67a19b29d5d3764cbd7a203c9d5f0462acc9de33ec3a45ef0ed187127151cf23c26f44
|
@@ -26,17 +26,18 @@ module Effective
|
|
26
26
|
menu = Effective::Menu.includes(:menu_items).find(menu_id)
|
27
27
|
menu.menu_items.delete_all
|
28
28
|
|
29
|
+
right = -1
|
30
|
+
|
29
31
|
attributes[:menu_items_attributes].each do |_, atts|
|
30
32
|
atts[:menuable_type] = 'Effective::Page' if atts[:menuable_type].blank?
|
31
33
|
atts.delete(:id)
|
34
|
+
right = [atts[:rgt].to_i, right].max
|
32
35
|
end
|
33
36
|
|
34
37
|
menu.attributes = attributes
|
35
38
|
|
36
39
|
# So when we render the menu, we don't include the Root/Home item.
|
37
40
|
# It has a left of 1 and a right of max(items.right)
|
38
|
-
right = attributes[:menu_items_attributes].map { |_, atts| atts[:rgt].to_i }.max
|
39
|
-
|
40
41
|
root_node = menu.menu_items.find { |menu_item| menu_item.lft == 1 }
|
41
42
|
root_node ||= menu.menu_items.build(title: 'Home', url: '/', lft: 1, rgt: 2)
|
42
43
|
root_node.rgt = right + 1
|