express_templates 0.9.7 → 0.9.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a671ca52fa5c3475e144928f8b50e4e70b03baa
4
- data.tar.gz: 832c78019d3a9d8ed40d41e11884a7d13170af45
3
+ metadata.gz: e66b5f8c8493808ff989e22a6423a3446c6a6917
4
+ data.tar.gz: aa49d8497f8be6e6ee218a861e543f311e3f46b8
5
5
  SHA512:
6
- metadata.gz: e425677ed8d6c52de583baf250f290588c00e33aff56a6b3f3c48978dc4248fdb4bb41925152741756a2b6cd21f355ed4c0e6d9879fe2cfc9979a69faaa13cd1
7
- data.tar.gz: 4eeba931463b330588f1d41926f688dbbcf8a7d2dc9358a954649bb4926ae3ffcac140b4dd3c7a464314155f564bceadd640684242e3f9c0948974971c817612
6
+ metadata.gz: 03f1c7da0070f318dcc5b6ea04a1bb81dd5495f715d89f5e803c5895a3963e1514eb058526a8bdc8bd4920c8438c653451a983c67a2df56b65ca10d2036e3af5
7
+ data.tar.gz: efe4c4852fc762b52c7d4bc933f29b1e945df699fc8e02e110953283b3547410ba0cca3f0162517a4c4ee6fa2738a725da64f1c76e7e348b011ac99a69cf3196
@@ -60,10 +60,14 @@ module ExpressTemplates
60
60
 
61
61
  def options_from_supplied_or_field_values
62
62
  if select_options_supplied?
63
- helpers.options_for_select(
64
- normalize_for_helper(use_supplied_options),
65
- selected_value
66
- )
63
+ supplied_options = use_supplied_options
64
+ if supplied_options.respond_to?(:map)
65
+ helpers.options_for_select(
66
+ normalize_for_helper(supplied_options),
67
+ selected_value)
68
+ else
69
+ supplied_options
70
+ end
67
71
  else
68
72
  generate_options_from_field_values
69
73
  end
@@ -42,16 +42,25 @@ module ExpressTemplates
42
42
  tag :ul
43
43
 
44
44
  has_attributes :class => 'tree'
45
+ has_option :root, "Root of the tree. Defaults to collection with the same as the id.", type: :proc
45
46
 
46
47
  contains -> (&customize_block) {
47
48
  @customize_block = customize_block
48
- list_items(send(config[:id]))
49
+ list_items(root_node)
49
50
  }
50
51
 
51
52
  before_build -> {
52
53
  add_class config[:id]
53
54
  }
54
55
 
56
+ def root_node
57
+ if config[:root] && config[:root].respond_to?(:call)
58
+ config[:root].call
59
+ else
60
+ send(config[:id])
61
+ end
62
+ end
63
+
55
64
  def list_items(nodes)
56
65
  nodes.each do |node|
57
66
  list_item(node)
@@ -1,3 +1,3 @@
1
1
  module ExpressTemplates
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: express_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Talcott Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-17 00:00:00.000000000 Z
12
+ date: 2015-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport