active_scaffold 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/frontends/default/views/_form_association.html.erb +2 -0
- data/frontends/default/views/_list_inline_adapter.html.erb +1 -1
- data/lib/active_scaffold/actions/create.rb +1 -1
- data/lib/active_scaffold/actions/list.rb +1 -1
- data/lib/active_scaffold/actions/subform.rb +1 -1
- data/lib/active_scaffold/actions/update.rb +1 -1
- data/lib/active_scaffold/attribute_params.rb +2 -4
- data/lib/active_scaffold/version.rb +1 -1
- metadata +4 -4
@@ -9,6 +9,8 @@ subform_div_id = "#{sub_form_id({:association => column.name, :id => parent_reco
|
|
9
9
|
-%>
|
10
10
|
<h5><%= column.label -%></h5>
|
11
11
|
<div id ="<%= subform_div_id %>" <%= 'style="display: none;"'.html_safe if column.collapsed -%>>
|
12
|
+
<%# HACK to be able to delete all associated records %>
|
13
|
+
<%= hidden_field_tag "#{active_scaffold_input_options(column)[:name]}[0]", '' if column.plural_association? %>
|
12
14
|
<%= render :partial => subform_partial_for_column(column), :locals => {:column => column, :parent_record => parent_record, :associated => associated, :show_blank_record => show_blank_record} %>
|
13
15
|
</div>
|
14
16
|
<%= link_to_visibility_toggle(subform_div_id, {:default_visible => !column.collapsed}) -%>
|
@@ -34,7 +34,7 @@ module ActiveScaffold::Actions
|
|
34
34
|
def create_respond_to_html
|
35
35
|
if params[:iframe]=='true' # was this an iframe post ?
|
36
36
|
responds_to_parent do
|
37
|
-
render :action => 'on_create', :
|
37
|
+
render :action => 'on_create', :formats => [:js], :layout => false
|
38
38
|
end
|
39
39
|
else
|
40
40
|
if successful?
|
@@ -35,7 +35,7 @@ module ActiveScaffold::Actions
|
|
35
35
|
def update_respond_to_html
|
36
36
|
if params[:iframe]=='true' # was this an iframe post ?
|
37
37
|
responds_to_parent do
|
38
|
-
render :action => 'on_update', :
|
38
|
+
render :action => 'on_update', :formats => [:js], :layout => false
|
39
39
|
end
|
40
40
|
else # just a regular post
|
41
41
|
if successful?
|
@@ -60,9 +60,6 @@ module ActiveScaffold
|
|
60
60
|
|
61
61
|
# we avoid assigning a value that already exists because otherwise has_one associations will break (AR bug in has_one_association.rb#replace)
|
62
62
|
parent_record.send("#{column.name}=", value) unless parent_record.send(column.name) == value
|
63
|
-
|
64
|
-
elsif column.plural_association?
|
65
|
-
parent_record.send("#{column.name}=", [])
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
@@ -139,7 +136,8 @@ module ActiveScaffold
|
|
139
136
|
elsif column.singular_association?
|
140
137
|
manage_nested_record_from_params(parent_record, column, value)
|
141
138
|
elsif column.plural_association?
|
142
|
-
|
139
|
+
# HACK to be able to delete all associated records, hash will include "0" => ""
|
140
|
+
value.collect {|key, value| manage_nested_record_from_params(parent_record, column, value) unless value == ""}.compact
|
143
141
|
else
|
144
142
|
value
|
145
143
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 2
|
10
|
+
version: 3.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Many, see README
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :development
|