active_scaffold_duplicate 1.1.0 → 1.1.1

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
- SHA1:
3
- metadata.gz: 3f33c6b409aa8365fbc82a06378a771e1da749f1
4
- data.tar.gz: 4ae381fa4b637f5618789a9467971b63f0984fd8
2
+ SHA256:
3
+ metadata.gz: a23e1eaf748889bb75185074a8e9c389a9aff46484bdcadc30a7c4ac52998156
4
+ data.tar.gz: 5a382d72ce4410e2a8dcf6884fe1f13cee7f0774c487d92a3484838cd75662d4
5
5
  SHA512:
6
- metadata.gz: c2fefc0ed8bd0f20f479c52d8ab209bd1767d7f2c7a33d5932572d02e93c119a4fbf3c835704ae9750d0895b1a2714d2a8e17654056f785cefe8619afeb8c308
7
- data.tar.gz: e45224ee2985b51b65e803322ccc747d6578118ed3fdd809154aaef194da1eb98b1d13e16536aca76d057a0fe688dbdd056a16d61535f177bf4637f3abc76ddf
6
+ metadata.gz: d63a77b9def74011d2f23a74284218794a5f21db982790f22290eac429e56fb0905a126e06aeb06079850ca5d4a59998445e75b8907f8aee4970ba440b2b998d
7
+ data.tar.gz: 88ea42a7e569cec56320a23cd3e07d45f8e282f9f0dbbb00439737fdf73115d2727d1be27e8348481d62b646cef0876b46f3ecb29471180295d5115f0bf7bbe2
@@ -47,15 +47,15 @@ module ActiveScaffold::Actions
47
47
  end
48
48
 
49
49
  def duplicate_respond_to_xml
50
- render :xml => response_object.to_xml(:only => active_scaffold_config.create.columns.names), :content_type => Mime::XML, :status => response_status, :location => response_location
50
+ render :xml => response_object.to_xml(:only => active_scaffold_config.create.columns.visible_columns_names), :content_type => Mime::XML, :status => response_status, :location => response_location
51
51
  end
52
52
 
53
53
  def duplicate_respond_to_json
54
- render :text => response_object.to_json(:only => active_scaffold_config.create.columns.names), :content_type => Mime::JSON, :status => response_status, :location => response_location
54
+ render :text => response_object.to_json(:only => active_scaffold_config.create.columns.visible_columns_names), :content_type => Mime::JSON, :status => response_status, :location => response_location
55
55
  end
56
56
 
57
57
  def duplicate_respond_to_yaml
58
- render :text => Hash.from_xml(response_object.to_xml(:only => active_scaffold_config.create.columns.names)).to_yaml, :content_type => Mime::YAML, :status => response_status, :location => response_location
58
+ render :text => Hash.from_xml(response_object.to_xml(:only => active_scaffold_config.create.columns.visible_columns_names)).to_yaml, :content_type => Mime::YAML, :status => response_status, :location => response_location
59
59
  end
60
60
 
61
61
  private
@@ -4,7 +4,7 @@ module ActiveScaffold
4
4
  def current_form_columns(record, scope, subform_controller = nil)
5
5
  columns = super
6
6
  if columns.nil? && action_name == 'duplicate'
7
- active_scaffold_config.create.columns.names
7
+ active_scaffold_config.create.columns.visible_columns_names
8
8
  else
9
9
  columns
10
10
  end
@@ -1,4 +1,4 @@
1
1
  # Need to open the AS module carefully due to Rails 2.3 lazy loading
2
2
  ActiveScaffold::Config::Core.class_eval do
3
- ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member][:duplicate] = [:post, :get]
3
+ ActiveScaffold::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member][:duplicate] = [:post, :get]
4
4
  end
@@ -2,7 +2,7 @@ module ActiveScaffoldDuplicate
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
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_duplicate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2019-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.0.rc
19
+ version: 3.6.0.pre
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.3.0.rc
27
- - !ruby/object:Gem::Dependency
28
- name: rails
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '4.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '4.0'
26
+ version: 3.6.0.pre
41
27
  description: Clone records using a method from model in ActiveScaffold
42
28
  email: activescaffold@googlegroups.com
43
29
  executables: []
@@ -49,24 +35,15 @@ files:
49
35
  - LICENSE.txt
50
36
  - README.textile
51
37
  - app/views/active_scaffold_overrides/duplicate.js.erb
52
- - app/views/active_scaffold_overrides/duplicate.js.erb~
53
38
  - config/locales/en.yml
54
39
  - config/locales/es.yml
55
40
  - lib/active_scaffold/actions/duplicate.rb
56
- - lib/active_scaffold/actions/duplicate.rb~
57
41
  - lib/active_scaffold/config/duplicate.rb
58
- - lib/active_scaffold/config/duplicate.rb~
59
42
  - lib/active_scaffold/helpers/duplicate_helpers.rb
60
- - lib/active_scaffold_clone.rb~
61
43
  - lib/active_scaffold_duplicate.rb
62
- - lib/active_scaffold_duplicate.rb~
63
44
  - lib/active_scaffold_duplicate/config/core.rb
64
- - lib/active_scaffold_duplicate/config/core.rb~
65
- - lib/active_scaffold_duplicate/core.rb~
66
45
  - lib/active_scaffold_duplicate/engine.rb
67
- - lib/active_scaffold_duplicate/engine.rb~
68
46
  - lib/active_scaffold_duplicate/version.rb
69
- - lib/active_scaffold_duplicate/version.rb~
70
47
  homepage: http://github.com/activescaffold/active_scaffold_duplicate
71
48
  licenses:
72
49
  - MIT
@@ -87,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
64
  version: '0'
88
65
  requirements: []
89
66
  rubyforge_project:
90
- rubygems_version: 2.6.10
67
+ rubygems_version: 2.7.8
91
68
  signing_key:
92
69
  specification_version: 4
93
70
  summary: Clone record gem for Activescaffold
@@ -1,19 +0,0 @@
1
- try {
2
- <% insert_at ||= :top %>
3
- <%= render :partial => 'update_messages', :locals => {:messages_id => active_scaffold_messages_id} %>
4
- <% if controller.send :successful? %>
5
- <% if (active_scaffold_config.duplicate.refresh_list) %>
6
- <%= render :partial => 'refresh_list' %>
7
- <% else %>
8
- <% new_row = render :partial => 'list_record', :locals => {:record => @record} %>
9
- ActiveScaffold.create_record_row('<%= active_scaffold_id %>','<%= escape_javascript(new_row) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
10
- <%= render :partial => 'update_calculations', :formats => [:js] %>
11
- <% end %>
12
-
13
- action_link.close();
14
- <% if (active_scaffold_config.duplicate.action_after_clone) %>
15
- var link = ActiveScaffold.find_action_link('<%= action_link_id active_scaffold_config.duplicate.action_after_clone, @record.id %>');
16
- if (link) (function() { link.open() })<%= '.defer' if ActiveScaffold.js_framework == :prototype %>();
17
- <% end %>
18
- <% end %>
19
- } catch (e) { alert('RJS error:\n\n' + e.toString());}
@@ -1,59 +0,0 @@
1
- module ActiveScaffold::Actions
2
- module Duplicate
3
- def self.included(base)
4
- base.before_filter :duplicate_authorized_filter, :only => :duplicate
5
- end
6
-
7
- def duplicate
8
- old_record = find_if_allowed(params[:id], :read)
9
- @record = old_record.send(active_scaffold_config.duplicate.method)
10
- debugger
11
- self.successful = @record.save
12
- respond_to_action(:duplicate)
13
- end
14
-
15
- protected
16
- def duplicate_authorized?(record = nil)
17
- (record || self).authorized_for?(:crud_type => :create, :action => :duplicate)
18
- end
19
-
20
- def duplicate_respond_to_html
21
- if successful?
22
- flash[:info] = as_(:created_model, :model => @record.to_label)
23
- if action = active_scaffold_config.duplicate.action_after_clone
24
- redirect_to params_for(:action => action, :id => @record.id)
25
- else
26
- return_to_main
27
- end
28
- else
29
- return_to_main
30
- end
31
- end
32
-
33
- def duplicate_respond_to_js
34
- do_refresh_list if successful? && active_scaffold_config.duplicate.refresh_list
35
- render :action => 'duplicate'
36
- end
37
-
38
- def duplicate_respond_to_xml
39
- render :xml => response_object.to_xml(:only => active_scaffold_config.create.columns.names), :content_type => Mime::XML, :status => response_status, :location => response_location
40
- end
41
-
42
- def duplicate_respond_to_json
43
- render :text => response_object.to_json(:only => active_scaffold_config.create.columns.names), :content_type => Mime::JSON, :status => response_status, :location => response_location
44
- end
45
-
46
- def duplicate_respond_to_yaml
47
- render :text => Hash.from_xml(response_object.to_xml(:only => active_scaffold_config.create.columns.names)).to_yaml, :content_type => Mime::YAML, :status => response_status, :location => response_location
48
- end
49
-
50
- private
51
- def duplicate_authorized_filter
52
- link = active_scaffold_config.duplicate.link || active_scaffold_config.duplicate.class.link
53
- raise ActiveScaffold::ActionNotAllowed unless self.send(link.security_method)
54
- end
55
- def duplicate_formats
56
- (default_formats + active_scaffold_config.formats + active_scaffold_config.duplicate.formats).uniq
57
- end
58
- end
59
- end
@@ -1,44 +0,0 @@
1
- module ActiveScaffold::Config
2
- class Duplicate < Base
3
- self.crud_type = :create
4
-
5
- def initialize(core_config)
6
- @core = core_config
7
- self.method = self.class.method
8
- self.link = self.class.link.clone
9
- self.action_after_clone = self.class.action_after_clone
10
- self.refresh_list = self.class.refresh_list
11
- end
12
-
13
- # the method to clone records
14
- cattr_accessor :method
15
- @@method = :dup
16
-
17
- # which action render after clone
18
- cattr_accessor :action_after_clone
19
- @@action_after_clone = nil
20
-
21
- # whether we should refresh list after clone or not
22
- cattr_accessor :refresh_list
23
- @@refresh_list = false
24
-
25
- # the ActionLink for this action
26
- cattr_accessor :link
27
- @@link = ActiveScaffold::DataStructures::ActionLink.new(:duplicate, :label => :clone, :type => :member, :method => :post, :position => false, :security_method => :duplicate_authorized?, :ignore_method => :duplicate_ignore?)
28
-
29
- # instance-level configuration
30
- # ----------------------------
31
-
32
- # the ActionLink for this action
33
- attr_accessor :link
34
-
35
- # the method to clone records
36
- attr_accessor :method
37
-
38
- # which action render after clone
39
- attr_accessor :action_after_clone
40
-
41
- # whether we should refresh list after clone or not
42
- attr_accessor :refresh_list
43
- end
44
- end
@@ -1,24 +0,0 @@
1
- require "active_scaffold_clone/config/core.rb"
2
- require "active_scaffold_clone/engine.rb"
3
-
4
- module ActiveScaffoldClone
5
- def self.root
6
- File.dirname(__FILE__) + "/.."
7
- end
8
- end
9
-
10
- module ActiveScaffold
11
- module Actions
12
- ActiveScaffold.autoload_subdir('actions', self, File.dirname(__FILE__))
13
- end
14
-
15
- module Config
16
- ActiveScaffold.autoload_subdir('config', self, File.dirname(__FILE__))
17
- end
18
-
19
- module Helpers
20
- ActiveScaffold.autoload_subdir('helpers', self, File.dirname(__FILE__))
21
- end
22
- end
23
-
24
- ActiveScaffold::Config::Core.send :include, ActiveScaffoldClone::Core
@@ -1,18 +0,0 @@
1
- require "active_scaffold_duplicate/config/core.rb"
2
- require "active_scaffold_duplicate/engine.rb"
3
-
4
- module ActiveScaffoldClone
5
- def self.root
6
- File.dirname(__FILE__) + "/.."
7
- end
8
- end
9
-
10
- module ActiveScaffold
11
- module Actions
12
- ActiveScaffold.autoload_subdir('actions', self, File.dirname(__FILE__))
13
- end
14
-
15
- module Config
16
- ActiveScaffold.autoload_subdir('config', self, File.dirname(__FILE__))
17
- end
18
- end
@@ -1,4 +0,0 @@
1
- # Need to open the AS module carefully due to Rails 2.3 lazy loading
2
- ActiveScaffold::Config::Core.class_eval do
3
- ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member][:clone] = :post
4
- end
@@ -1,13 +0,0 @@
1
- module ActiveScaffoldSortable
2
- module Core
3
- def self.included(base)
4
- base.alias_method_chain :initialize, :sortable
5
- end
6
-
7
- def initialize_with_sortable(model_id)
8
- initialize_without_sortable(model_id)
9
- # seems some rubies are returning strings in instance_methods and other symbols...
10
- self.actions << :sortable if !(model.instance_methods & ['acts_as_list_class', :acts_as_list_class, 'nested_set_scope', :nested_set_scope]).empty?
11
- end
12
- end
13
- end
@@ -1,4 +0,0 @@
1
- module ActiveScaffoldClone
2
- class Engine < ::Rails::Engine
3
- end
4
- end
@@ -1,9 +0,0 @@
1
- module ActiveScaffoldClone
2
- module Version
3
- MAJOR = 1
4
- MINOR = 0
5
- PATCH = 0
6
-
7
- STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
- end
9
- end