active_scaffold 3.4.7 → 3.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac10aec1fac3d66afecec71c2262dedb311c000c
4
- data.tar.gz: 77208c9dbc9f3c50b8bd88265ba645be6fe6e857
3
+ metadata.gz: b5de5babbd2447c2a706b2627e7e1cb09966e563
4
+ data.tar.gz: 371b743005cc81c284a673ee82e9fd23048bf8e3
5
5
  SHA512:
6
- metadata.gz: 8cd83d6362143864a3cf2c753163562821da1c32ebb641f0b0e25e49459b3bbee91c415db5f1a256b13a8a06a1d774361c0233bdffd1902ae0f9417b9e004b62
7
- data.tar.gz: da1a7da25ad88b2d88ce8811e5d6d4b830c2991a673bc90412f68b30244e4141a51b2119cf0415a11daa8a2f99ad99166f3d7845921e671d6ed0ac37653a5c0d
6
+ metadata.gz: 1c3156bc03652f0b4efdfe075dd5019648ada5087474e17d49c6fdfd0bdf0e4dc1465eec783638154f22dcaa62d98eb9eeb54ce3b01b6ec04b732931bf495237
7
+ data.tar.gz: 797149d0738f3e7f995bd13e367fb589e8fa9956d1954b65b90b3e15925631a763ac630227df4ffb6c5c8ebbeb6b466571874601c841eee4506dd3868abc70b5
data/CHANGELOG CHANGED
@@ -1,4 +1,8 @@
1
- = 3.4.7 (not released yet)
1
+ = 3.4.8 (not released yet)
2
+ - set parent data when adding new record on subform of a create form on a embedded or nested list
3
+ - trigger ajax:* events on ajax call to render_field
4
+
5
+ = 3.4.7
2
6
  - sorting by primary key added by default only for postgres, on mysql it will avoid using index to sort (you can see using filesort on explain), slowdown sorting
3
7
  - fix set_parent on rails 3.2 with attr_accessible
4
8
  - fix saving changes on render_field when blank row is changed and request render_field action
@@ -944,20 +944,29 @@ var ActiveScaffold = {
944
944
  url: url,
945
945
  data: params,
946
946
  type: 'post',
947
- beforeSend: function(event) {
947
+ beforeSend: function(xhr, settings) {
948
948
  element.nextAll('img.loading-indicator').css('visibility','visible');
949
949
  ActiveScaffold.disable_form(as_form);
950
+ if ($.rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
951
+ element.trigger('ajax:send', xhr);
952
+ } else {
953
+ return false;
954
+ }
955
+ },
956
+ success: function(data, status, xhr) {
957
+ as_form.find('#'+element.attr('id')).trigger('ajax:success', [data, status, xhr]);
950
958
  },
951
- complete: function(event) {
959
+ complete: function(xhr, status) {
960
+ element = as_form.find('#'+element.attr('id'));
952
961
  element.nextAll('img.loading-indicator').css('visibility','hidden');
953
- ActiveScaffold.enable_form(as_form);
962
+ element.trigger('ajax:complete', [xhr, status]);
954
963
  if (ActiveScaffold.last_focus) jQuery(ActiveScaffold.last_focus).focus().select();
955
964
  },
956
965
  error: function (xhr, status, error) {
966
+ element = as_form.find('#'+element.attr('id'));
957
967
  var as_div = element.closest("div.active-scaffold");
958
- if (as_div) {
959
- ActiveScaffold.report_500_response(as_div, xhr);
960
- }
968
+ if (as_div) ActiveScaffold.report_500_response(as_div, xhr);
969
+ element.trigger('ajax:error', [xhr, status, error]);
961
970
  }
962
971
  });
963
972
  },
@@ -9,6 +9,11 @@ module ActiveScaffold::Actions
9
9
 
10
10
  def do_edit_associated
11
11
  @parent_record = params[:id].nil? ? new_model : find_if_allowed(params[:id], :update)
12
+ if @parent_record.new_record?
13
+ apply_constraints_to_record @parent_record
14
+ create_association_with_parent @parent_record if nested?
15
+ end
16
+
12
17
  generate_temporary_id(@parent_record, params[:generated_id]) if @parent_record.new_record? && params[:generated_id]
13
18
  @column = active_scaffold_config.columns[params[:child_association]]
14
19
 
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 7
5
+ PATCH = 8
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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.7
4
+ version: 3.4.8
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-10-20 00:00:00.000000000 Z
11
+ date: 2014-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda