hancock_cms_goto 1.0.1.1 → 1.0.1.2

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: 68c7d2016e3b3c6e51a5ab4a166c87827df82d9c
4
- data.tar.gz: 5e8c479b149b15720fa51e98ca41f9d17851d0b3
3
+ metadata.gz: f956a9ac74f49b894820747722fb5ec59d717cb6
4
+ data.tar.gz: 974fd7186cd94d06b1a523e3afabeb017c0b1b88
5
5
  SHA512:
6
- metadata.gz: 287aff51b11284a69f262eea6b89985bbe104467c744a6b4c08f27512c9bfa1ac6847a97b7b107097e591ffe7a031305707a6c6145215d77217f85e908ae0d00
7
- data.tar.gz: e0609a0ca7248a06cd0317fe4b7ac6c62b8b7756ee8ac5827afc44a2b2425feb1fd831b468274a0a3f341ff1fafd342c44643ce4b5717d26063661a39214aee7
6
+ metadata.gz: 99d7f0dca2191629974d9a9cb33300f7aaa4b0ab49562ada7decb844b6e25af01b32c56e634cf40e0a9c4504534654f5b11e52626b6fa646a8f75633d8ec74ab
7
+ data.tar.gz: 419ce55f77fdc954df1c7f7221ce35da3a9c82d91cfb1ccfa806f640fbcf6c0d38f35a358414860bf6471f53d56c7e2a7589563c3e0edb81fb470b8948ca4a78
@@ -0,0 +1,18 @@
1
+ module Hancock::Goto::GotoHelper
2
+
3
+ def link_goto(name = nil, options = nil, html_options = nil, &block)
4
+ html_options, options, name = options, name, block if block_given?
5
+ options ||= {}
6
+
7
+ options.merge!({only_path: false}) if options.is_a?(Hash)
8
+ options = {controller: "hancock/goto/transfers", action: 'index', url: url_for(options)}
9
+ html_options.merge!({target: :_blank}) if html_options.is_a?(Hash)
10
+
11
+ if block_given?
12
+ link_to(options, html_options, &block)
13
+ else
14
+ link_to(name, options, html_options)
15
+ end
16
+ end
17
+
18
+ end
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "bundler", "~> 1.10"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
 
33
- spec.add_dependency 'hancock_cms', [">=1.0", "<=2.1"]
33
+ spec.add_dependency 'hancock_cms', [">=1.0.1", "<=2.1"]
34
34
  # spec.add_dependency 'hancock_cms', ["~> 1.0", "~> 2.1"]
35
-
35
+
36
36
  spec.add_dependency 'nokogiri'
37
37
  spec.add_dependency 'addressable'
38
38
  end
@@ -10,7 +10,7 @@ Hancock::Goto.configure do |config|
10
10
  # config.add_noopener = true
11
11
  # config.del_attrs = true
12
12
 
13
- # config.model_settings_support = defined?(RailsAdminModelSettings)
14
- # config.user_abilities_support = defined?(RailsAdminUserAbilities)
15
- # config.ra_comments_support = defined?(RailsAdminComments)
13
+ # config.model_settings_support = !!defined?(RailsAdminModelSettings)
14
+ # config.user_abilities_support = !!defined?(RailsAdminUserAbilities)
15
+ # config.ra_comments_support = !!defined?(RailsAdminComments)
16
16
  end
@@ -12,7 +12,7 @@ module Hancock::Goto::Models
12
12
  copied = true
13
13
  copy_file "#{c}.rb", "app/models/concerns/hancock/goto/decorators/#{c}.rb"
14
14
  end
15
- puts "U need to set controller`s name. One of this: #{permitted_models.join(", ")}." unless copied
15
+ puts "U need to set models`s name. One of this: #{permitted_models.join(", ")}." unless copied
16
16
  end
17
17
 
18
18
  private
@@ -37,9 +37,9 @@ module Hancock
37
37
  @add_noopener = true
38
38
  @del_attrs = true
39
39
 
40
- @model_settings_support = defined?(RailsAdminModelSettings)
41
- @user_abilities_support = defined?(RailsAdminUserAbilities)
42
- @ra_comments_support = defined?(RailsAdminComments)
40
+ @model_settings_support = !!defined?(RailsAdminModelSettings)
41
+ @user_abilities_support = !!defined?(RailsAdminUserAbilities)
42
+ @ra_comments_support = !!defined?(RailsAdminComments)
43
43
  end
44
44
  end
45
45
  end
@@ -29,7 +29,7 @@ module Hancock::Goto
29
29
  status, headers, response = @app.call(env)
30
30
  headers = HeaderHash.new(headers)
31
31
 
32
- if should_process?(status, headers)
32
+ if should_process?(status, headers, env)
33
33
  begin
34
34
  content = extract_content(response)
35
35
  doc = ::Nokogiri::HTML(content)
@@ -68,9 +68,11 @@ module Hancock::Goto
68
68
  end
69
69
 
70
70
  private
71
- def should_process?(status, headers)
72
- !STATUS_WITH_NO_ENTITY_BODY.include?(status) &&
73
- !headers['transfer-encoding'] &&
71
+ def should_process?(status, headers, env)
72
+ cond = (env['hancock_goto_replace'].nil? || (env['hancock_goto_replace'] != false))
73
+ cond &&
74
+ !STATUS_WITH_NO_ENTITY_BODY.include?(status) &&
75
+ !headers['transfer-encoding'] &&
74
76
  headers['content-type'] &&
75
77
  headers['content-type'].include?('text/html')
76
78
  end
@@ -1,5 +1,5 @@
1
1
  module Hancock
2
2
  module Goto
3
- VERSION = "1.0.1.1".freeze
3
+ VERSION = "1.0.1.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hancock_cms_goto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1.1
4
+ version: 1.0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2016-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,7 +44,7 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: 1.0.1
48
48
  - - "<="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '2.1'
@@ -54,7 +54,7 @@ dependencies:
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: '1.0'
57
+ version: 1.0.1
58
58
  - - "<="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.1'
@@ -103,6 +103,7 @@ files:
103
103
  - Rakefile
104
104
  - app/controllers/concerns/hancock/goto/decorators/transfers.rb
105
105
  - app/controllers/hancock/goto/transfers_controller.rb
106
+ - app/helpers/hancock/goto/goto_helper.rb
106
107
  - app/models/concerns/hancock/goto/decorators/transfer.rb
107
108
  - app/models/hancock/goto/transfer.rb
108
109
  - bin/console