dynamic_fieldsets 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,10 @@
1
- == 0.1.0
1
+ == 0.1.2
2
+
3
+ * Fixed a bug where fields would not display correctly on the show page if they were never filled out
4
+ * Fixed a bug in date and datetime fields were being converted to octal due to leading zeroes on the select options: "09" caused an error
5
+ * Fixed a bug where all field records were associated with the same field fieldset associator
6
+
7
+ == 0.1.1
2
8
 
3
9
  * Found a bug in the Field.descendants code that stopped the nested attributes from working
4
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -27,7 +27,6 @@ module DynamicFieldsetsHelper
27
27
  def field_show_renderer(fsa, fieldset_child, values = [])
28
28
  field = fieldset_child.child
29
29
  lines = []
30
-
31
30
  if field.use_show_header_partial?
32
31
  lines.push render(:partial => field.show_header_partial )
33
32
  end
@@ -151,7 +151,11 @@ module DynamicFieldsets
151
151
 
152
152
  # given a value hash for a field, return the part that needs to be shown on the show page
153
153
  def get_value_for_show(value)
154
- value[:value]
154
+ if value.nil?
155
+ return nil
156
+ else
157
+ value[:value]
158
+ end
155
159
  end
156
160
 
157
161
  # Other Methods
@@ -85,13 +85,13 @@ module DynamicFieldsets
85
85
  # The form values should only be values for the current fsa
86
86
  #
87
87
  # @param [Hash] form_values Information from the form
88
- def update_field_records_with_form_information(form_values)
88
+ def update_field_records_with_form_information(fsa, form_values)
89
89
  form_values.each_pair do |fieldset_child_key, value|
90
90
  if fieldset_child_key.start_with?(DynamicFieldsets.config.form_field_prefix)
91
91
  fieldset_child_id = fieldset_child_key.gsub(/^#{DynamicFieldsets.config.form_field_prefix}/, "")
92
92
  fieldset_child = fieldset_children.select { |child| child.id == fieldset_child_id.to_i }.first
93
93
  # this could potentially hit a fieldset and cause problems
94
- fieldset_child.child.update_field_records(self, fieldset_child, value)
94
+ fieldset_child.child.update_field_records(fsa, fieldset_child, value)
95
95
  end
96
96
  end
97
97
  end
@@ -52,7 +52,7 @@ module DynamicFieldsets
52
52
 
53
53
  # given the params, passes along to the fieldset
54
54
  def update_fieldset_records_with_form_information(fsa_params)
55
- fieldset.update_field_records_with_form_information(fsa_params)
55
+ fieldset.update_field_records_with_form_information(self, fsa_params)
56
56
  end
57
57
 
58
58
  # Record whose field matches the name and associator matches the current associator
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dynamic_fieldsets"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremiah Hemphill", "Ethan Pemble", "John Carter"]
12
- s.date = "2012-02-28"
12
+ s.date = "2012-02-29"
13
13
  s.description = "Dynamic fieldsets for rails controllers"
14
14
  s.email = "jeremiah@cloudspace.com"
15
15
  s.extra_rdoc_files = [
@@ -133,14 +133,14 @@ module DynamicFieldsets
133
133
  datefield = ''
134
134
  datefield += post.delete( "#{field}(1i)" ) # year
135
135
  datefield += '-'
136
- datefield += '%02d' % post.delete( "#{field}(2i)" ) # month
136
+ datefield += '%02d' % post.delete( "#{field}(2i)" ).to_i # month
137
137
  datefield += '-'
138
- datefield += '%02d' % post.delete( "#{field}(3i)" ) # day
138
+ datefield += '%02d' % post.delete( "#{field}(3i)" ).to_i # day
139
139
  if post.keys.include? "#{field}(4i)" then
140
140
  datefield += ' '
141
- datefield += '%02d' % post.delete( "#{field}(4i)" ) # hour
141
+ datefield += '%02d' % post.delete( "#{field}(4i)" ).to_i # hour
142
142
  datefield += ':'
143
- datefield += '%02d' % post.delete( "#{field}(5i)" ) # minute
143
+ datefield += '%02d' % post.delete( "#{field}(5i)" ).to_i # minute
144
144
  datefield += ':'
145
145
  datefield += '00' # second
146
146
  end
@@ -34,7 +34,11 @@ module DynamicFieldsets
34
34
 
35
35
  # given a value hash for a field, return the part that needs to be shown on the show page
36
36
  def get_value_for_show(value)
37
- value[:name]
37
+ if value.nil?
38
+ return nil
39
+ else
40
+ value[:name]
41
+ end
38
42
  end
39
43
 
40
44
  def uses_field_options?
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dynamic_fieldsets
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeremiah Hemphill
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2012-02-28 00:00:00 Z
15
+ date: 2012-02-29 00:00:00 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -429,7 +429,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
429
429
  requirements:
430
430
  - - ">="
431
431
  - !ruby/object:Gem::Version
432
- hash: -3694889709902434942
432
+ hash: -575384589768239247
433
433
  segments:
434
434
  - 0
435
435
  version: "0"