active_scaffold 3.4.9 → 3.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/app/views/active_scaffold_overrides/_add_existing_form.html.erb +1 -1
- data/lib/active_scaffold/actions/list.rb +1 -1
- data/lib/active_scaffold/attribute_params.rb +1 -1
- data/lib/active_scaffold/data_structures/action_links.rb +3 -0
- data/lib/active_scaffold/version.rb +1 -1
- data/test/company.rb +3 -0
- data/test/misc/attribute_params_test.rb +3 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26af65dba6ac3fe50f666f71c4ed02abb0adda89
|
4
|
+
data.tar.gz: 619b8200bc93ba0f81d123119723ab24c12fbec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3969fced5fe06b11f6ac32735ae382f0f494a5087d0a7664eb11b1a15d6952fcf64832f2f585d0408363f10cecab1a8c6617ed90519b04b18d73fbd98cde92
|
7
|
+
data.tar.gz: be56ceb6696c945eb66872fa482166b430d417de66d26f861e6c66d9f68e03ecb1e1c06050d28a1095c7dbbd2071ae3f9b4ee29e3c455533991e54663e7d44a5
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
= 3.4.10
|
2
|
+
- singular associations on subform are always created, in other case it's not possible to enable a checkbox without filling text fields.
|
3
|
+
- process_action_link_action checks security for crud_type and action now
|
4
|
+
- fix record for add_existing_form, so it can be used on options_for_association_conditions
|
5
|
+
- :type option for action_link not needed anymore if added with action_links.member.add, it was redundant
|
6
|
+
|
1
7
|
= 3.4.9
|
2
8
|
- update parent data when changing a column in subform of edit form, so parent has data from form as it works in new form
|
3
9
|
- use :only and :except options from resource line on as_routes and as_association_routes, so activescaffold actions can be selected
|
@@ -17,7 +17,7 @@ options = {:id => element_form_id(:action => :add_existing),
|
|
17
17
|
<% end -%>
|
18
18
|
|
19
19
|
<label for="<%= "record_#{active_scaffold_config.model}" %>"><%= active_scaffold_add_existing_label %></label>
|
20
|
-
<%= active_scaffold_add_existing_input(:name => 'associated_id', :url_options => url_options, :object =>
|
20
|
+
<%= active_scaffold_add_existing_input(:name => 'associated_id', :url_options => url_options, :object => nested_parent_record) %>
|
21
21
|
|
22
22
|
<p class="form-footer">
|
23
23
|
<%= submit_tag as_(:add), :class => "submit" %>
|
@@ -156,7 +156,7 @@ module ActiveScaffold::Actions
|
|
156
156
|
else
|
157
157
|
@action_link = active_scaffold_config.action_links[action_name]
|
158
158
|
if params[:id]
|
159
|
-
crud_type_or_security_options ||= (request.post? || request.put?) ? :update : :delete
|
159
|
+
crud_type_or_security_options ||= {:crud_type => (request.post? || request.put?) ? :update : :delete, :action => action_name}
|
160
160
|
get_row(crud_type_or_security_options)
|
161
161
|
unless @record.nil?
|
162
162
|
yield @record
|
@@ -173,7 +173,7 @@ module ActiveScaffold
|
|
173
173
|
def build_record_from_params(params, column, record)
|
174
174
|
current = record.send(column.name)
|
175
175
|
klass = column.association.klass
|
176
|
-
(column.plural_association? && !column.show_blank_record?(current)) || !attributes_hash_is_empty?(params, klass)
|
176
|
+
column.singular_association? || (column.plural_association? && !column.show_blank_record?(current)) || !attributes_hash_is_empty?(params, klass)
|
177
177
|
end
|
178
178
|
|
179
179
|
# Attempts to create or find an instance of the klass of the association in parent_column from the
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ActiveScaffold::DataStructures
|
2
2
|
class ActionLinks
|
3
3
|
include Enumerable
|
4
|
+
attr_accessor :default_type
|
4
5
|
|
5
6
|
def initialize
|
6
7
|
@set = []
|
@@ -13,6 +14,7 @@ module ActiveScaffold::DataStructures
|
|
13
14
|
link = if action.is_a?(ActiveScaffold::DataStructures::ActionLink) || action.is_a?(ActiveScaffold::DataStructures::ActionLinks)
|
14
15
|
action
|
15
16
|
else
|
17
|
+
options[:type] ||= default_type
|
16
18
|
ActiveScaffold::DataStructures::ActionLink.new(action, options)
|
17
19
|
end
|
18
20
|
# NOTE: this duplicate check should be done by defining the comparison operator for an Action data structure
|
@@ -130,6 +132,7 @@ module ActiveScaffold::DataStructures
|
|
130
132
|
group = ActiveScaffold::DataStructures::ActionLinks.new
|
131
133
|
group.label = label || name
|
132
134
|
group.name = name
|
135
|
+
group.default_type = self.name == :root ? (name.to_sym if %w(member collection).include?(name.to_s)) : default_type
|
133
136
|
add_to_set group
|
134
137
|
end
|
135
138
|
group
|
data/test/company.rb
CHANGED
@@ -217,7 +217,7 @@ class AttributeParamsTest < MiniTest::Test
|
|
217
217
|
|
218
218
|
model = update_record_from_params(model, :update, :brand, :person, :brand => 'Mercedes', :person => {:first_name => ''})
|
219
219
|
assert_equal 'Mercedes', model.brand
|
220
|
-
|
220
|
+
refute_equal person.id, model.person.id
|
221
221
|
assert model.save
|
222
222
|
end
|
223
223
|
|
@@ -254,14 +254,14 @@ class AttributeParamsTest < MiniTest::Test
|
|
254
254
|
assert_equal 'First', model.first_name
|
255
255
|
assert_nil Car.where(:id => car.id).first, 'previous car should be deleted'
|
256
256
|
assert model.car.present?
|
257
|
-
refute_equal
|
257
|
+
refute_equal car.id, model.car.id
|
258
258
|
assert model.save
|
259
259
|
|
260
260
|
car = model.car.reload
|
261
261
|
model = update_record_from_params(model, :update, :first_name, :car, :first_name => 'Name', :car => {:brand => ''})
|
262
262
|
assert_equal 'Name', model.first_name
|
263
263
|
assert_nil Car.where(:id => car.id).first, 'previous car should be deleted'
|
264
|
-
|
264
|
+
refute_equal car.id, model.car.id
|
265
265
|
assert model.save
|
266
266
|
end
|
267
267
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Many, see README
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0
|
33
|
+
version: '1.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rcov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -435,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
435
435
|
version: '0'
|
436
436
|
requirements: []
|
437
437
|
rubyforge_project:
|
438
|
-
rubygems_version: 2.
|
438
|
+
rubygems_version: 2.0.3
|
439
439
|
signing_key:
|
440
440
|
specification_version: 4
|
441
441
|
summary: Rails 3.2 and 4.0 version of activescaffold supporting prototype and jquery
|