active_scaffold_batch_vho 3.0.6 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -0,0 +1,17 @@
1
+ ActiveScaffold batch is a gem which adds batch_update, batch_delete and batch_destroy actions
2
+ to activescaffold, which means you can perform operations on more than justone record.
3
+
4
+ Rails 3.0 Gem:
5
+ gem 'active_scaffold_batch_vho'
6
+ or
7
+ gem 'active_scaffold_batch_vho', :git => 'git://github.com/vhochstein/active_scaffold_batch.git', :branch => 'rails-3.0'
8
+
9
+ Rails 3.1 Gem:
10
+ gem 'active_scaffold_config_batch'
11
+ or
12
+ gem 'active_scaffold_config_batch', :git => 'git://github.com/vhochstein/active_scaffold_batch.git'
13
+
14
+
15
+ For further details examples please take a look at:
16
+ http://vhochstein.wordpress.com/2010/12/31/activescaffold-batch-update/
17
+ http://vhochstein.wordpress.com/2011/01/14/activescaffold-batch-destroy/
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ Jeweler::Tasks.new do |gem|
22
22
  gem.description = %Q{You want to destroy/update many records at once with activescaffold?}
23
23
  gem.email = "activescaffold@googlegroups.com"
24
24
  gem.authors = ["Volker Hochstein"]
25
- gem.add_runtime_dependency 'active_scaffold_vho', '> 3.0.13'
25
+ gem.add_runtime_dependency 'active_scaffold_vho', '>= 3.1'
26
26
  # Include your dependencies below. Runtime dependencies are required when using your gem,
27
27
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
28
28
  # gem.add_runtime_dependency 'jabber4r', '> 0.1'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_scaffold_batch_vho}
8
- s.version = "3.0.6"
8
+ s.version = "3.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Volker Hochstein"]
12
- s.date = %q{2011-03-14}
12
+ s.date = %q{2011-11-23}
13
13
  s.description = %q{You want to destroy/update many records at once with activescaffold?}
14
14
  s.email = %q{activescaffold@googlegroups.com}
15
15
  s.extra_rdoc_files = [
@@ -31,9 +31,9 @@ Gem::Specification.new do |s|
31
31
  "frontends/default/views/_batch_update_form_body.html.erb",
32
32
  "frontends/default/views/batch_create.html.erb",
33
33
  "frontends/default/views/batch_update.html.erb",
34
- "frontends/default/views/on_batch_base.js.rjs",
35
- "frontends/default/views/on_batch_create.js.rjs",
36
- "frontends/default/views/on_batch_update.js.rjs",
34
+ "frontends/default/views/on_batch_base.js.erb",
35
+ "frontends/default/views/on_batch_create.js.erb",
36
+ "frontends/default/views/on_batch_update.js.erb",
37
37
  "init.rb",
38
38
  "lib/active_scaffold/actions/batch_base.rb",
39
39
  "lib/active_scaffold/actions/batch_create.rb",
@@ -66,24 +66,18 @@ Gem::Specification.new do |s|
66
66
  s.specification_version = 3
67
67
 
68
68
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
- s.add_development_dependency(%q<shoulda>, [">= 0"])
70
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
71
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
69
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
72
70
  s.add_development_dependency(%q<rcov>, [">= 0"])
73
- s.add_runtime_dependency(%q<active_scaffold_vho>, ["> 3.0.13"])
71
+ s.add_runtime_dependency(%q<active_scaffold_vho>, [">= 3.1"])
74
72
  else
75
- s.add_dependency(%q<shoulda>, [">= 0"])
76
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
77
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
73
+ s.add_dependency(%q<jeweler>, [">= 0"])
78
74
  s.add_dependency(%q<rcov>, [">= 0"])
79
- s.add_dependency(%q<active_scaffold_vho>, ["> 3.0.13"])
75
+ s.add_dependency(%q<active_scaffold_vho>, [">= 3.1"])
80
76
  end
81
77
  else
82
- s.add_dependency(%q<shoulda>, [">= 0"])
83
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
84
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
78
+ s.add_dependency(%q<jeweler>, [">= 0"])
85
79
  s.add_dependency(%q<rcov>, [">= 0"])
86
- s.add_dependency(%q<active_scaffold_vho>, ["> 3.0.13"])
80
+ s.add_dependency(%q<active_scaffold_vho>, [">= 3.1"])
87
81
  end
88
82
  end
89
83
 
@@ -1,6 +1,8 @@
1
+ <%
1
2
  unless @error_records.empty?
2
3
  flash[:error] = @error_records.collect do |record|
3
4
  active_scaffold_error_messages_for(record, :object_name => "#{record.class.model_name.human.downcase}#{record.new_record? ? '' : ": #{record.to_label}"}", :header_message => '', :message => "#{record.class.model_name.human.downcase}#{record.new_record? ? '' : ": #{record.to_label}"}", :container_tag => nil, :list_type => :br)
4
5
  end.join.html_safe
5
6
  end
6
- page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
7
+ %>
8
+ ActiveScaffold.replace_html('<%= active_scaffold_content_id%>','<%=escape_javascript(render(:partial => 'list', :layout => false))%>');
@@ -0,0 +1,18 @@
1
+ <% form_selector = "#{element_form_id(:action => :batch_create)}" %>
2
+
3
+ <% if controller.send :batch_successful? %>
4
+ <% called_by_controller = params.delete(:batch_create_by) %>
5
+ <% if called_by_controller.nil? %>
6
+ ActiveScaffold.replace_html('<%= active_scaffold_content_id%>','<%=escape_javascript(render(:partial => 'list', :layout => false))%>');
7
+ <% else %>
8
+ <% options = {:checked => false,
9
+ :include_mark_all => false} %>
10
+ <% tbody_id = "#{controller_id(called_by_controller)}-tbody" %>
11
+ ActiveScaffold.mark_records('<%=tbody_id%>', <%=options.to_json%>);
12
+ <% end %>
13
+ ActiveScaffold.find_action_link('<%=form_selector%>').close();
14
+ <% else %>
15
+ ActiveScaffold.find_action_link('<%=form_selector%>').update_flash_messages('<%=escape_javascript(render(:partial => 'messages').strip)%>');
16
+ ActiveScaffold.replace('<%=form_selector%>', '<%=escape_javascript(render(:partial => 'batch_create_form', :locals => {:xhr => true}))%>');
17
+ ActiveScaffold.scroll_to('<%=form_selector%>');
18
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% form_selector = "#{element_form_id(:action => :batch_update)}" %>
2
+
3
+ <% if controller.send :batch_successful? %>
4
+ ActiveScaffold.replace_html('<%= active_scaffold_content_id%>','<%=escape_javascript(render(:partial => 'list', :layout => false))%>');
5
+ ActiveScaffold.find_action_link('<%=form_selector%>').close();
6
+ <% else %>
7
+ ActiveScaffold.find_action_link('<%=form_selector%>').update_flash_messages('<%=escape_javascript(render(:partial => 'messages').strip)%>');
8
+ ActiveScaffold.replace('<%=form_selector%>', '<%=escape_javascript(render(:partial => 'batch_update_form', :locals => {:xhr => true}))%>');
9
+ ActiveScaffold.scroll_to('<%=form_selector%>');
10
+ <% end %>
@@ -206,6 +206,7 @@ module ActiveScaffold::Actions
206
206
 
207
207
  def attribute_values_from_params(columns, attributes)
208
208
  values = {}
209
+ attributes = {} unless attributes.is_a?(Hash)
209
210
  columns.each :for => new_model, :crud_type => :update, :flatten => true do |column|
210
211
  values[column.name] = {:column => column, :value => attributes[column.name].merge(:value => column_value_from_param_value(nil, column, attributes[column.name][:value]))} if selected_columns.include? column.name
211
212
  end
@@ -1,8 +1,8 @@
1
1
  module ActiveScaffoldBatch
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 0
5
- PATCH = 6
4
+ MINOR = 1
5
+ PATCH = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -32,7 +32,6 @@ I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'active_scaffold_batch',
32
32
  ##
33
33
  Rails::Application.initializer("active_scaffold_batch.install_assets", :after => "active_scaffold.install_assets") do
34
34
  begin
35
- ActiveScaffoldAssets.copy_to_public(ActiveScaffoldBatch.root)
36
35
  ActionView::Base.class_eval do
37
36
  include ActiveScaffold::Helpers::UpdateColumnHelpers
38
37
  if ActiveScaffold.js_framework == :jquery
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_batch_vho
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
4
  prerelease: false
6
5
  segments:
7
6
  - 3
7
+ - 1
8
8
  - 0
9
- - 6
10
- version: 3.0.6
9
+ segments_generated: true
10
+ version: 3.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Volker Hochstein
@@ -15,85 +15,52 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-14 00:00:00 +01:00
18
+ date: 2011-11-23 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- name: shoulda
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ name: jeweler
23
+ requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
30
+ segments_generated: true
32
31
  version: "0"
33
- requirement: *id001
34
32
  type: :development
35
- - !ruby/object:Gem::Dependency
36
33
  prerelease: false
37
- name: bundler
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 23
44
- segments:
45
- - 1
46
- - 0
47
- - 0
48
- version: 1.0.0
49
- requirement: *id002
50
- type: :development
34
+ version_requirements: *id001
51
35
  - !ruby/object:Gem::Dependency
52
- prerelease: false
53
- name: jeweler
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 7
60
- segments:
61
- - 1
62
- - 5
63
- - 2
64
- version: 1.5.2
65
- requirement: *id003
66
- type: :development
67
- - !ruby/object:Gem::Dependency
68
- prerelease: false
69
36
  name: rcov
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
37
+ requirement: &id002 !ruby/object:Gem::Requirement
71
38
  none: false
72
39
  requirements:
73
40
  - - ">="
74
41
  - !ruby/object:Gem::Version
75
- hash: 3
76
42
  segments:
77
43
  - 0
44
+ segments_generated: true
78
45
  version: "0"
79
- requirement: *id004
80
46
  type: :development
81
- - !ruby/object:Gem::Dependency
82
47
  prerelease: false
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
83
50
  name: active_scaffold_vho
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
51
+ requirement: &id003 !ruby/object:Gem::Requirement
85
52
  none: false
86
53
  requirements:
87
- - - ">"
54
+ - - ">="
88
55
  - !ruby/object:Gem::Version
89
- hash: 29
90
56
  segments:
91
57
  - 3
92
- - 0
93
- - 13
94
- version: 3.0.13
95
- requirement: *id005
58
+ - 1
59
+ segments_generated: true
60
+ version: "3.1"
96
61
  type: :runtime
62
+ prerelease: false
63
+ version_requirements: *id003
97
64
  description: You want to destroy/update many records at once with activescaffold?
98
65
  email: activescaffold@googlegroups.com
99
66
  executables: []
@@ -118,9 +85,9 @@ files:
118
85
  - frontends/default/views/_batch_update_form_body.html.erb
119
86
  - frontends/default/views/batch_create.html.erb
120
87
  - frontends/default/views/batch_update.html.erb
121
- - frontends/default/views/on_batch_base.js.rjs
122
- - frontends/default/views/on_batch_create.js.rjs
123
- - frontends/default/views/on_batch_update.js.rjs
88
+ - frontends/default/views/on_batch_base.js.erb
89
+ - frontends/default/views/on_batch_create.js.erb
90
+ - frontends/default/views/on_batch_update.js.erb
124
91
  - init.rb
125
92
  - lib/active_scaffold/actions/batch_base.rb
126
93
  - lib/active_scaffold/actions/batch_create.rb
@@ -155,18 +122,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
122
  requirements:
156
123
  - - ">="
157
124
  - !ruby/object:Gem::Version
158
- hash: 3
125
+ hash: 1574814307821251551
159
126
  segments:
160
127
  - 0
128
+ segments_generated: true
161
129
  version: "0"
162
130
  required_rubygems_version: !ruby/object:Gem::Requirement
163
131
  none: false
164
132
  requirements:
165
133
  - - ">="
166
134
  - !ruby/object:Gem::Version
167
- hash: 3
168
135
  segments:
169
136
  - 0
137
+ segments_generated: true
170
138
  version: "0"
171
139
  requirements: []
172
140
 
@@ -1,19 +0,0 @@
1
- form_selector = "#{element_form_id(:action => :batch_create)}"
2
-
3
- if controller.send :batch_successful?
4
- called_by_controller = params.delete(:batch_create_by)
5
- if called_by_controller.nil?
6
- page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
7
- else
8
- options = {:checked => false,
9
- :include_mark_all => false}
10
- tbody_id = "#{controller_id(called_by_controller)}-tbody"
11
- page << "ActiveScaffold.mark_records('#{tbody_id}', #{options.to_json});"
12
- end
13
- page << "ActiveScaffold.find_action_link('#{form_selector}').close();"
14
- else
15
- page << "ActiveScaffold.find_action_link('#{form_selector}').update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');"
16
- page.call 'ActiveScaffold.replace', form_selector, render(:partial => 'batch_create_form', :locals => {:xhr => true})
17
- page.call 'ActiveScaffold.scroll_to', form_selector
18
- #have to uncheck successfully created marked_records
19
- end
@@ -1,10 +0,0 @@
1
- form_selector = "#{element_form_id(:action => :batch_update)}"
2
-
3
- if controller.send :batch_successful?
4
- page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
5
- page << "ActiveScaffold.find_action_link('#{form_selector}').close();"
6
- else
7
- page << "ActiveScaffold.find_action_link('#{form_selector}').update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');"
8
- page.call 'ActiveScaffold.replace', form_selector, render(:partial => 'batch_update_form', :locals => {:xhr => true})
9
- page.call 'ActiveScaffold.scroll_to', form_selector
10
- end