active_scaffold 3.2.6 → 3.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/app/assets/javascripts/jquery/active_scaffold.js +13 -13
- data/app/assets/javascripts/prototype/active_scaffold.js +7 -6
- data/frontends/default/views/on_update.js.erb +19 -17
- data/lib/active_scaffold/actions/list.rb +1 -3
- data/lib/active_scaffold/actions/update.rb +6 -3
- data/lib/active_scaffold/config/update.rb +7 -0
- data/lib/active_scaffold/helpers/form_column_helpers.rb +1 -1
- data/lib/active_scaffold/version.rb +1 -1
- metadata +21 -21
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
= 3.2.7 (not released)
|
2
|
+
- restore missing update.persistent feature
|
3
|
+
- fix create.persistent
|
4
|
+
- add new record in first scaffold, not in all nested scaffolds
|
5
|
+
- fix deleting all in habtm with select_ui
|
6
|
+
|
1
7
|
= 3.2.6
|
2
8
|
- fix ordering with DISTINCT call
|
3
9
|
- allow to override some human condition strings in i18n, and translate select values for non-association columns
|
@@ -356,8 +356,7 @@ var ActiveScaffold = {
|
|
356
356
|
},
|
357
357
|
hide_empty_message: function(tbody) {
|
358
358
|
if (this.records_for(tbody).length != 0) {
|
359
|
-
|
360
|
-
if (empty_message_node) empty_message_node.hide();
|
359
|
+
jQuery(tbody).parent().find('tbody.messages p.empty-message').hide();
|
361
360
|
}
|
362
361
|
},
|
363
362
|
reload_if_empty: function(tbody, url) {
|
@@ -380,14 +379,14 @@ var ActiveScaffold = {
|
|
380
379
|
decrement_record_count: function(scaffold) {
|
381
380
|
// decrement the last record count, firsts record count are in nested lists
|
382
381
|
if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
|
383
|
-
scaffold = jQuery(scaffold)
|
382
|
+
scaffold = jQuery(scaffold);
|
384
383
|
count = scaffold.find('span.active-scaffold-records').last();
|
385
384
|
if (count) count.html(parseInt(count.html(), 10) - 1);
|
386
385
|
},
|
387
386
|
increment_record_count: function(scaffold) {
|
388
387
|
// increment the last record count, firsts record count are in nested lists
|
389
388
|
if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
|
390
|
-
scaffold = jQuery(scaffold)
|
389
|
+
scaffold = jQuery(scaffold);
|
391
390
|
count = scaffold.find('span.active-scaffold-records').last();
|
392
391
|
if (count) count.html(parseInt(count.html(), 10) + 1);
|
393
392
|
},
|
@@ -465,7 +464,7 @@ var ActiveScaffold = {
|
|
465
464
|
|
466
465
|
create_record_row: function(active_scaffold_id, html, options) {
|
467
466
|
if (typeof(active_scaffold_id) == 'string') active_scaffold_id = '#' + active_scaffold_id;
|
468
|
-
tbody = jQuery(active_scaffold_id).find('tbody.records');
|
467
|
+
tbody = jQuery(active_scaffold_id).find('tbody.records').first();
|
469
468
|
|
470
469
|
if (options.insert_at == 'top') {
|
471
470
|
tbody.prepend(html);
|
@@ -618,7 +617,7 @@ var ActiveScaffold = {
|
|
618
617
|
if (element.length == 0) {
|
619
618
|
element = source.closest('form > ol.form');
|
620
619
|
}
|
621
|
-
element = element.find('.' + options.field_class
|
620
|
+
element = element.find('.' + options.field_class).first();
|
622
621
|
|
623
622
|
if (element) {
|
624
623
|
if (options.is_subform == false) {
|
@@ -861,7 +860,7 @@ ActiveScaffold.ActionLink = {
|
|
861
860
|
new ActiveScaffold.Actions.Record(target, parent, loading_indicator);
|
862
861
|
} else if (parent && parent.is('div')) {
|
863
862
|
//table action
|
864
|
-
new ActiveScaffold.Actions.Table(parent.find('a.as_action'), parent.closest('div.active-scaffold').find('tbody.before-header'), parent.find('.loading-indicator'));
|
863
|
+
new ActiveScaffold.Actions.Table(parent.find('a.as_action'), parent.closest('div.active-scaffold').find('tbody.before-header').first(), parent.find('.loading-indicator').first());
|
865
864
|
}
|
866
865
|
element = jQuery(element);
|
867
866
|
}
|
@@ -887,6 +886,7 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
|
|
887
886
|
},
|
888
887
|
|
889
888
|
open: function(event) {
|
889
|
+
this.tag.click();
|
890
890
|
},
|
891
891
|
|
892
892
|
insert: function(content) {
|
@@ -900,11 +900,6 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
|
|
900
900
|
if (ActiveScaffold.config.scroll_on_close) ActiveScaffold.scroll_to(this.target);
|
901
901
|
},
|
902
902
|
|
903
|
-
reload: function() {
|
904
|
-
this.close();
|
905
|
-
this.open();
|
906
|
-
},
|
907
|
-
|
908
903
|
get_new_adapter_id: function() {
|
909
904
|
var id = 'adapter_';
|
910
905
|
var i = 0;
|
@@ -1053,5 +1048,10 @@ ActiveScaffold.ActionLink.Table = ActiveScaffold.ActionLink.Abstract.extend({
|
|
1053
1048
|
throw 'Unknown position "' + this.position + '"'
|
1054
1049
|
}
|
1055
1050
|
ActiveScaffold.highlight(this.adapter.find('td').first().children());
|
1056
|
-
}
|
1051
|
+
},
|
1052
|
+
|
1053
|
+
reload: function() {
|
1054
|
+
this.close();
|
1055
|
+
this.open();
|
1056
|
+
},
|
1057
1057
|
});
|
@@ -784,6 +784,7 @@ ActiveScaffold.ActionLink.Abstract = Class.create({
|
|
784
784
|
},
|
785
785
|
|
786
786
|
open: function(event) {
|
787
|
+
this.tag.click();
|
787
788
|
},
|
788
789
|
|
789
790
|
insert: function(content) {
|
@@ -797,11 +798,6 @@ ActiveScaffold.ActionLink.Abstract = Class.create({
|
|
797
798
|
if (ActiveScaffold.config.scroll_on_close) ActiveScaffold.scroll_to(this.target);
|
798
799
|
},
|
799
800
|
|
800
|
-
reload: function() {
|
801
|
-
this.close();
|
802
|
-
this.open();
|
803
|
-
},
|
804
|
-
|
805
801
|
get_new_adapter_id: function() {
|
806
802
|
var id = 'adapter_';
|
807
803
|
var i = 0;
|
@@ -946,7 +942,12 @@ ActiveScaffold.ActionLink.Table = Class.create(ActiveScaffold.ActionLink.Abstrac
|
|
946
942
|
throw 'Unknown position "' + this.position + '"'
|
947
943
|
}
|
948
944
|
this.adapter.down('td').down().highlight();
|
949
|
-
}
|
945
|
+
},
|
946
|
+
|
947
|
+
reload: function() {
|
948
|
+
this.close();
|
949
|
+
this.open();
|
950
|
+
},
|
950
951
|
});
|
951
952
|
|
952
953
|
if (Ajax.InPlaceEditor) {
|
@@ -3,25 +3,27 @@ try {
|
|
3
3
|
var action_link = ActiveScaffold.find_action_link('<%= form_selector%>');
|
4
4
|
action_link.update_flash_messages('<%=escape_javascript(render(:partial => 'messages'))%>');
|
5
5
|
<% if controller.send :successful? %>
|
6
|
-
<% if
|
7
|
-
<%
|
8
|
-
|
9
|
-
|
10
|
-
<% else %>
|
11
|
-
<% if render_parent_action == :row %>
|
6
|
+
<% if !active_scaffold_config.update.persistent %>
|
7
|
+
<% if render_parent? && controller.respond_to?(:render_component_into_view) %>
|
8
|
+
<% parent_rendered = controller.send(:render_component_into_view, render_parent_options) %>
|
9
|
+
<% if nested_singular_association? %>
|
12
10
|
action_link.close('<%= escape_javascript(parent_rendered)%>');
|
13
|
-
<%
|
14
|
-
|
11
|
+
<% else %>
|
12
|
+
<% if render_parent_action == :row %>
|
13
|
+
action_link.close('<%= escape_javascript(parent_rendered)%>');
|
14
|
+
<% elsif render_parent_action == :index %>
|
15
|
+
<%= escape_javascript(parent_rendered) %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<%#page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
|
19
|
+
<% elsif update_refresh_list? %>
|
20
|
+
ActiveScaffold.replace_html('<%= active_scaffold_content_id%>', '<%= escape_javascript(render(:partial => 'list', :layout => false))%>');
|
21
|
+
<% else %>
|
22
|
+
<% updated_row = render :partial => 'list_record', :locals => {:record => @record}%>
|
23
|
+
action_link.close('<%= escape_javascript(updated_row)%>');
|
24
|
+
<% if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
|
25
|
+
ActiveScaffold.replace('<%=active_scaffold_calculations_id%>', '<%=escape_javascript(render(:partial => 'list_calculations'))%>');
|
15
26
|
<% end %>
|
16
|
-
<% end %>
|
17
|
-
<%#page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
|
18
|
-
<% elsif update_refresh_list? %>
|
19
|
-
ActiveScaffold.replace_html('<%= active_scaffold_content_id%>', '<%= escape_javascript(render(:partial => 'list', :layout => false))%>');
|
20
|
-
<% else %>
|
21
|
-
<% updated_row = render :partial => 'list_record', :locals => {:record => @record}%>
|
22
|
-
action_link.close('<%= escape_javascript(updated_row)%>');
|
23
|
-
<% if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
|
24
|
-
ActiveScaffold.replace('<%=active_scaffold_calculations_id%>', '<%=escape_javascript(render(:partial => 'list_calculations'))%>');
|
25
27
|
<% end %>
|
26
28
|
<% end %>
|
27
29
|
<% else %>
|
@@ -30,9 +30,7 @@ module ActiveScaffold::Actions
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
def list_respond_to_js
|
33
|
-
if params[:adapter]
|
34
|
-
render(:partial => 'list_with_header')
|
35
|
-
elsif embedded?
|
33
|
+
if params[:adapter] || embedded?
|
36
34
|
render(:partial => 'list_with_header')
|
37
35
|
else
|
38
36
|
render :action => 'refresh_list', :formats => [:js]
|
@@ -47,9 +47,12 @@ module ActiveScaffold::Actions
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
def update_respond_to_js
|
50
|
-
if successful?
|
51
|
-
|
52
|
-
|
50
|
+
if successful?
|
51
|
+
if update_refresh_list? && !render_parent?
|
52
|
+
do_search if respond_to? :do_search
|
53
|
+
do_list
|
54
|
+
end
|
55
|
+
flash.now[:info] = as_(:updated_model, :model => @record.to_label) if active_scaffold_config.update.persistent
|
53
56
|
end
|
54
57
|
render :action => 'on_update'
|
55
58
|
end
|
@@ -18,6 +18,10 @@ module ActiveScaffold::Config
|
|
18
18
|
end
|
19
19
|
@@link = ActiveScaffold::DataStructures::ActionLink.new('edit', :label => :edit, :type => :member, :security_method => :update_authorized?)
|
20
20
|
|
21
|
+
# whether the form stays open after an update or not
|
22
|
+
cattr_accessor :persistent
|
23
|
+
@@persistent = false
|
24
|
+
|
21
25
|
# whether we should refresh list after update or not
|
22
26
|
cattr_accessor :refresh_list
|
23
27
|
@@refresh_list = false
|
@@ -28,6 +32,9 @@ module ActiveScaffold::Config
|
|
28
32
|
attr_accessor :nested_links
|
29
33
|
cattr_accessor :nested_links
|
30
34
|
@@nested_links = false
|
35
|
+
|
36
|
+
# whether the form stays open after an update or not
|
37
|
+
attr_accessor :persistent
|
31
38
|
|
32
39
|
attr_writer :hide_nested_column
|
33
40
|
def hide_nested_column
|
@@ -123,7 +123,7 @@ module ActiveScaffold
|
|
123
123
|
|
124
124
|
def active_scaffold_checkbox_list(column, select_options, associated_ids, options)
|
125
125
|
html = content_tag :ul, :class => "#{options[:class]} checkbox-list", :id => options[:id] do
|
126
|
-
content = ""
|
126
|
+
content = hidden_field_tag("#{options[:name]}[]", '')
|
127
127
|
select_options.each_with_index do |option, i|
|
128
128
|
label, id = option
|
129
129
|
this_id = "#{options[:id]}_#{i}_id"
|
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: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 7
|
10
|
+
version: 3.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Many, see README
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-08 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
21
|
+
type: :development
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
23
|
none: false
|
23
24
|
requirements:
|
24
25
|
- - ">="
|
@@ -27,12 +28,12 @@ dependencies:
|
|
27
28
|
segments:
|
28
29
|
- 0
|
29
30
|
version: "0"
|
30
|
-
|
31
|
-
type: :development
|
32
|
-
requirement: *id001
|
31
|
+
version_requirements: *id001
|
33
32
|
name: shoulda
|
33
|
+
prerelease: false
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
|
35
|
+
type: :development
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
37
|
none: false
|
37
38
|
requirements:
|
38
39
|
- - ~>
|
@@ -43,12 +44,12 @@ dependencies:
|
|
43
44
|
- 0
|
44
45
|
- 0
|
45
46
|
version: 1.0.0
|
46
|
-
|
47
|
-
type: :development
|
48
|
-
requirement: *id002
|
47
|
+
version_requirements: *id002
|
49
48
|
name: bundler
|
49
|
+
prerelease: false
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
51
|
+
type: :development
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
53
|
none: false
|
53
54
|
requirements:
|
54
55
|
- - ">="
|
@@ -57,12 +58,12 @@ dependencies:
|
|
57
58
|
segments:
|
58
59
|
- 0
|
59
60
|
version: "0"
|
60
|
-
|
61
|
-
type: :development
|
62
|
-
requirement: *id003
|
61
|
+
version_requirements: *id003
|
63
62
|
name: rcov
|
63
|
+
prerelease: false
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
|
-
|
65
|
+
type: :runtime
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
67
|
none: false
|
67
68
|
requirements:
|
68
69
|
- - ">="
|
@@ -73,10 +74,9 @@ dependencies:
|
|
73
74
|
- 1
|
74
75
|
- 3
|
75
76
|
version: 3.1.3
|
76
|
-
|
77
|
-
type: :runtime
|
78
|
-
requirement: *id004
|
77
|
+
version_requirements: *id004
|
79
78
|
name: rails
|
79
|
+
prerelease: false
|
80
80
|
description: Save time and headaches, and create a more easily maintainable set of pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read, update, delete) user interface needs, leaving you more time to focus on more challenging (and interesting!) problems.
|
81
81
|
email: activescaffold@googlegroups.com
|
82
82
|
executables: []
|
@@ -437,7 +437,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
437
437
|
requirements: []
|
438
438
|
|
439
439
|
rubyforge_project:
|
440
|
-
rubygems_version: 1.8.
|
440
|
+
rubygems_version: 1.8.10
|
441
441
|
signing_key:
|
442
442
|
specification_version: 3
|
443
443
|
summary: Rails 3.1 Version of activescaffold supporting prototype and jquery
|