bcms_tools 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +2 -1
- data/bcms_tools.gemspec +1 -1
- data/lib/bcms_tools/view_helpers.rb +13 -4
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
2
|
+
|
data/bcms_tools.gemspec
CHANGED
@@ -68,9 +68,17 @@ module ActionView
|
|
68
68
|
# Construct tree_nodes, an array of arrays - each array a level in tree.
|
69
69
|
# Each level is a list children to the parents in the level before
|
70
70
|
def construct_category_tree(aRootCategory)
|
71
|
-
|
71
|
+
level_nodes = case aRootCategory
|
72
|
+
when String
|
73
|
+
[Category.find_by_name(aRootCategory)]
|
74
|
+
when Category
|
75
|
+
[aRootCategory]
|
76
|
+
when CategoryType
|
77
|
+
[aRootCategory.categories.top_level]
|
78
|
+
else
|
79
|
+
CategoryType.first.categories.top_level
|
80
|
+
end
|
72
81
|
tree_nodes = []
|
73
|
-
level_nodes = [aRootCategory]
|
74
82
|
begin
|
75
83
|
tree_nodes << level_nodes
|
76
84
|
ids = level_nodes.map {|n| n.id}
|
@@ -105,9 +113,10 @@ module ActionView
|
|
105
113
|
item[:url] += '+' unless item[:url]=='' || item[:url].ends_with?('/') || item[:url].ends_with?('+')
|
106
114
|
item[:url] += name.urlize('-')
|
107
115
|
else
|
108
|
-
item[:url] = aBaseUrl
|
116
|
+
item[:url] = File.join(aBaseUrl,name.urlize('-'))
|
109
117
|
end
|
110
|
-
|
118
|
+
|
119
|
+
item[:selected] = true if category && (category==node.name.urlize('+'))
|
111
120
|
item_level << item
|
112
121
|
end
|
113
122
|
tree_items << item_level
|