bcms_tools 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1,2 @@
1
- 0.0.4
1
+ 0.0.5
2
+
data/bcms_tools.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bcms_tools}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["buzzware"]
@@ -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
- aRootCategory = Category.find_by_name(aRootCategory) unless aRootCategory.is_a? Category
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
- item[:selected] = true if category && category==node.name.urlize('+')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - buzzware