hydra-editor 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeed336d625411d0c07f9d84ff6b2359410cd215
4
- data.tar.gz: afde272d3a78787077f23555cdae1ece97bca230
3
+ metadata.gz: 07b3e61fba7144fb5d24d64cdc241ab1c5e09f5a
4
+ data.tar.gz: 046d6ccb60e056267ed1e09c29b74999715f2ccf
5
5
  SHA512:
6
- metadata.gz: cd2d650f3a1854d7e8d579f202f9bdf59c82e12cae6c277960d0954e9cf191c6d7557c59fe49b73a92594e4284f979cace91676ef170a93116191984f318f194
7
- data.tar.gz: f0dacfad4569aca4a8fcc37305fae3a605ecd979eba9b953d2c4dc0c3b7cf20b9242fb1cf428e66bf91dd3cabfe21ee65d3fa0fb16e70bf9bdc571b12f5c2e25
6
+ metadata.gz: 712434962668b46f9b6b4dbbc5df09e2acf60b02e4f43b06218a0df30d5891a3046ef938f8ab039c96f1d12da5cc1a072a641f1614308bcecc7fb93bd4154acf
7
+ data.tar.gz: 3875cf1521283e6358fa89d400876665a931f719ce08ea8c0a54b24eebcd41acd4c6ad7720b7545865b9aa85eaa91403af9d365943e1437a0f772792598dd7a7
@@ -3,25 +3,36 @@ class MultiValueInput < SimpleForm::Inputs::CollectionInput
3
3
  @rendered_first_element = false
4
4
  input_html_classes.unshift("string")
5
5
  input_html_options[:name] ||= "#{object_name}[#{attribute_name}][]"
6
- markup = <<-HTML
7
6
 
7
+ outer_wrapper do
8
+ buffer_each(collection) do |value, index|
9
+ inner_wrapper do
10
+ build_field(value, index)
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ protected
8
17
 
9
- <ul class="listing">
10
- HTML
18
+ def buffer_each(collection)
19
+ collection.each_with_object('').with_index do |(value, buffer), index|
20
+ buffer << yield(value, index)
21
+ end
22
+ end
11
23
 
12
- collection.each_with_index do |value, index|
13
- markup << <<-HTML
14
- <li class="field-wrapper">
15
- #{build_field(value, index)}
16
- </li>
17
- HTML
24
+ def outer_wrapper
25
+ " <ul class=\"listing\">\n #{yield}\n </ul>\n"
18
26
  end
19
27
 
20
- markup << <<-HTML
21
- </ul>
22
28
 
23
- HTML
24
- end
29
+ def inner_wrapper
30
+ <<-HTML
31
+ <li class="field-wrapper">
32
+ #{yield}
33
+ </li>
34
+ HTML
35
+ end
25
36
 
26
37
  private
27
38
 
@@ -1,3 +1,3 @@
1
1
  module HydraEditor
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-07 00:00:00.000000000 Z
12
+ date: 2015-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails