dynamic_fieldsets 0.1.3 → 0.1.4

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,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.3
1
+ 0.1.4
@@ -1,7 +1,6 @@
1
1
  module DynamicFieldsets
2
2
  class FieldsController < ApplicationController
3
3
  include FieldsHelper
4
- unloadable
5
4
 
6
5
  # GET /dynamic_fieldsets/fields
7
6
  def index
@@ -2,7 +2,6 @@
2
2
  # Allows users to view but not create or edit fieldset associators
3
3
  module DynamicFieldsets
4
4
  class FieldsetAssociatorsController < ApplicationController
5
- unloadable
6
5
 
7
6
  # show all fieldset associators
8
7
  def index
@@ -3,7 +3,6 @@ module DynamicFieldsets
3
3
  # Most of this is done through the fieldsets#children action
4
4
  # Dependencies are done here
5
5
  class FieldsetChildrenController < ApplicationController
6
- unloadable
7
6
 
8
7
  # this view doesn't exist
9
8
  def index
@@ -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 :fieldset_child_id
18
-
19
- # This validation should really be on
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
- validates_presence_of :dependency_group_id
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.find_by_name(self.value)
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
- if self.fieldset_child && !self.fieldset_child.child.is_a?(DynamicFieldsets::Field)
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, obj.relationship_list %></td>
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
- <% elsif child.is_a? DynamicFieldsets::Field then %>
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>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dynamic_fieldsets"
8
- s.version = "0.1.3"
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-02"
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.3
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-02 00:00:00 Z
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: -2479662043084122620
432
+ hash: -2714422766311375793
433
433
  segments:
434
434
  - 0
435
435
  version: "0"