dynamic_fieldsets 0.0.12 → 0.0.13
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/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.0.13
|
2
|
+
|
3
|
+
* Added an error to the FieldsetAssociator.find_by_fieldset_model_parameters to give better information if the fieldset is missing
|
4
|
+
* Fixed a problem with field_show_renderer and added markup/classes to it.
|
5
|
+
|
1
6
|
== 0.0.12
|
2
7
|
|
3
8
|
* Fixed stray typo and failing test
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.13
|
@@ -27,9 +27,9 @@ module DynamicFieldsetsHelper
|
|
27
27
|
def field_show_renderer(fsa, fieldset_child, values = [])
|
28
28
|
field = fieldset_child.child
|
29
29
|
lines = []
|
30
|
-
lines.push "<div class='
|
31
|
-
lines.push "<
|
32
|
-
lines.push "<
|
30
|
+
lines.push "<div class='dynamic_fieldsets field'>"
|
31
|
+
lines.push "<span class='label'>#{field.label}</div>"
|
32
|
+
lines.push "<span class='value'>"
|
33
33
|
if values
|
34
34
|
if field.field_type == "multiple_select" || field.field_type == "checkbox"
|
35
35
|
values.each do |value|
|
@@ -43,8 +43,9 @@ module DynamicFieldsetsHelper
|
|
43
43
|
lines.push values
|
44
44
|
end
|
45
45
|
else
|
46
|
-
lines.push "No answer given"
|
46
|
+
lines.push "<em class='empty'>No answer given</em>"
|
47
47
|
end
|
48
|
+
lines.push "</span>"
|
48
49
|
lines.push "</div>"
|
49
50
|
return lines
|
50
51
|
end
|
@@ -25,10 +25,14 @@ module DynamicFieldsets
|
|
25
25
|
# fieldset_model_type: The class name of the fieldset model
|
26
26
|
# fieldset_model_name: The named fieldset in the model
|
27
27
|
#
|
28
|
+
# Throws an error if the fieldset does not exist to help with debugging
|
29
|
+
#
|
28
30
|
# @params [Hash] args A hash of arguments for the scope
|
29
|
-
# @
|
31
|
+
# @returns [Array] An array of fieldset associators that match the arguments
|
30
32
|
def self.find_by_fieldset_model_parameters(args)
|
31
33
|
fieldset = Fieldset.find_by_nkey(args[:fieldset])
|
34
|
+
throw "Fieldset not found in FieldsetAssociator.find_by_fieldset_model_parameters" if fieldset.nil?
|
35
|
+
|
32
36
|
where(
|
33
37
|
:fieldset_id => fieldset.id,
|
34
38
|
:fieldset_model_id => args[:fieldset_model_id],
|
data/dynamic_fieldsets.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dynamic_fieldsets}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Jeremiah Hemphill}, %q{Ethan Pemble}, %q{John Carter}]
|
12
|
-
s.date = %q{2012-01-
|
12
|
+
s.date = %q{2012-01-30}
|
13
13
|
s.description = %q{Dynamic fieldsets for rails controllers}
|
14
14
|
s.email = %q{jeremiah@cloudspace.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -66,6 +66,11 @@ describe FieldsetAssociator do
|
|
66
66
|
FieldsetAssociator.find_by_fieldset_model_parameters(@fieldset_model_attributes)
|
67
67
|
end
|
68
68
|
|
69
|
+
it "should throw an error if the fieldset does not exist" do
|
70
|
+
Fieldset.stub!(:find_by_nkey).and_return(nil)
|
71
|
+
lambda { FieldsetAssociator.find_by_fieldset_model_parameters(@fieldset_model_attributes) }.should raise_error
|
72
|
+
end
|
73
|
+
|
69
74
|
it "should return the correct fieldset associator" do
|
70
75
|
Fieldset.stub!(:find_by_nkey).and_return(@fieldset)
|
71
76
|
# this is a fun hack because of all the fsas being made during tests
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dynamic_fieldsets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.13
|
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-01-
|
15
|
+
date: 2012-01-30 00:00:00 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -351,7 +351,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
351
351
|
requirements:
|
352
352
|
- - ">="
|
353
353
|
- !ruby/object:Gem::Version
|
354
|
-
hash:
|
354
|
+
hash: 4534077377862689434
|
355
355
|
segments:
|
356
356
|
- 0
|
357
357
|
version: "0"
|