dynamic_fieldsets 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/VERSION +1 -1
- data/app/controllers/dynamic_fieldsets/fields_controller.rb +0 -1
- data/app/controllers/dynamic_fieldsets/fieldset_associators_controller.rb +0 -1
- data/app/controllers/dynamic_fieldsets/fieldset_children_controller.rb +0 -1
- data/app/models/dynamic_fieldsets/dependency.rb +3 -8
- data/app/models/dynamic_fieldsets/dependency_clause.rb +2 -1
- data/app/models/dynamic_fieldsets/field_default.rb +1 -1
- data/app/models/dynamic_fieldsets/field_record.rb +2 -1
- data/app/models/dynamic_fieldsets/fieldset_child.rb +1 -1
- data/app/views/dynamic_fieldsets/fieldset_children/_dependency_fields.html.erb +2 -2
- data/app/views/dynamic_fieldsets/fieldsets/_child.html.erb +1 -1
- data/dynamic_fieldsets.gemspec +2 -2
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
== unreleased changes
|
2
2
|
|
3
|
+
* Removed unloadable from the controllers because they were causing an issue when the controller generator was run
|
4
|
+
* Updated the fieldset children manager page to show any type of field
|
5
|
+
* Updated dependency system model validations so that they trigger correctly on create
|
6
|
+
* Fixed selected value for the fieldset_child_id on fieldset child dependency edit page dependency_fields partial
|
7
|
+
* Improved the behavior of the field option finder on the field default model
|
8
|
+
* Updated the field record validator to handle the field child classes
|
9
|
+
|
3
10
|
== 0.1.3
|
4
11
|
|
5
12
|
* Fixed a typo in the generated config
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -11,16 +11,11 @@ module DynamicFieldsets
|
|
11
11
|
# Relations
|
12
12
|
|
13
13
|
belongs_to :fieldset_child
|
14
|
-
belongs_to :dependency_clause
|
15
14
|
|
16
15
|
# Validations
|
17
|
-
validates_presence_of :
|
18
|
-
|
19
|
-
|
20
|
-
# It is off due to a bug (?) in the nested attributes
|
21
|
-
# where the dependency clause id is not set when it creates the dependency
|
22
|
-
# validates_presence_of :dependency_clause_id
|
23
|
-
|
16
|
+
validates_presence_of :fieldset_child
|
17
|
+
# hack to make saving through nested attributes work
|
18
|
+
validates_presence_of :dependency_clause, :on => :update
|
24
19
|
validates_inclusion_of :relationship, :in => RELATIONSHIP_LIST
|
25
20
|
|
26
21
|
# Returns a full list of the options for relationship_list
|
@@ -9,7 +9,8 @@ module DynamicFieldsets
|
|
9
9
|
has_many :dependencies
|
10
10
|
accepts_nested_attributes_for :dependencies, :allow_destroy => true
|
11
11
|
|
12
|
-
|
12
|
+
# hack to make saving through nested attributes work
|
13
|
+
validates_presence_of :dependency_group, :on => :update
|
13
14
|
|
14
15
|
# Evaluates the depdendencies in the claus by ORing them together
|
15
16
|
# Short circuit evaluation returns true as soon as possible
|
@@ -22,7 +22,7 @@ module DynamicFieldsets
|
|
22
22
|
# http://www.youtube.com/watch?v=BeP6CpUnfc0
|
23
23
|
def convert_option_name_to_id
|
24
24
|
if field.uses_field_options?
|
25
|
-
option = FieldOption.
|
25
|
+
option = FieldOption.where(:name => self.value, :field => self.field).first
|
26
26
|
self.value = option.id unless option.nil?
|
27
27
|
end
|
28
28
|
end
|
@@ -14,7 +14,8 @@ module DynamicFieldsets
|
|
14
14
|
# make sure the fieldset child has the type field
|
15
15
|
# does not explicitly check to make sure the fieldset_child exists, still have to validate presence
|
16
16
|
def type_of_fieldset_child
|
17
|
-
|
17
|
+
# yet another casualty of me not understanding how the objects are getting duplicated in development (JH 3-6-2012)
|
18
|
+
if self.fieldset_child && !self.fieldset_child.child.class.superclass.to_s.eql?("DynamicFieldsets::Field")
|
18
19
|
self.errors.add(:fieldset_child, "The fieldset child must refer to a Field object")
|
19
20
|
end
|
20
21
|
end
|
@@ -122,7 +122,7 @@ module DynamicFieldsets
|
|
122
122
|
output = {}
|
123
123
|
if child.class == DynamicFieldsets::Fieldset
|
124
124
|
return child.get_values_using_fsa(fsa)
|
125
|
-
elsif child.class.superclass == DynamicFieldsets::Field
|
125
|
+
elsif child.class.superclass == DynamicFieldsets::Field || child.class.superclass.to_s == DynamicFieldsets::Field.to_s
|
126
126
|
return child.get_values_using_fsa_and_fsc(fsa, self)
|
127
127
|
else
|
128
128
|
# I am not sure if we need to use child.superclass equals Field due to the sti
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<tr>
|
2
|
-
<td><%= f.select :fieldset_child_id, options_for_select(DynamicFieldsets::FieldsetChild.all.collect { |c| [c.child.name, c.id]})%></td>
|
3
|
-
<td><%= f.select :relationship,
|
2
|
+
<td><%= f.select :fieldset_child_id, options_for_select(DynamicFieldsets::FieldsetChild.all.collect { |c| [c.child.name, c.id]}, obj.fieldset_child_id)%></td>
|
3
|
+
<td><%= f.select :relationship, DynamicFieldsets::Dependency::RELATIONSHIP_LIST %></td>
|
4
4
|
<td><%= f.text_field :value %></td>
|
5
5
|
<td>
|
6
6
|
<%= f.hidden_field :_destroy %>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
</ol>
|
24
24
|
<% end %>
|
25
25
|
</li>
|
26
|
-
<%
|
26
|
+
<% else %>
|
27
27
|
<% fieldset_child = DynamicFieldsets::FieldsetChild.where( fieldset_id: fieldset.id, child_id: child.id, child_type: "DynamicFieldsets::Field" ).first %>
|
28
28
|
<li id="child-<%= fieldset_child.id %>" class="field<%= ' required' if child.required? %>">
|
29
29
|
<div>
|
data/dynamic_fieldsets.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "dynamic_fieldsets"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
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-03-
|
12
|
+
s.date = "2012-03-06"
|
13
13
|
s.description = "Dynamic fieldsets for rails controllers"
|
14
14
|
s.email = "jeremiah@cloudspace.com"
|
15
15
|
s.extra_rdoc_files = [
|
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.
|
5
|
+
version: 0.1.4
|
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-03-
|
15
|
+
date: 2012-03-06 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: -
|
432
|
+
hash: -2714422766311375793
|
433
433
|
segments:
|
434
434
|
- 0
|
435
435
|
version: "0"
|