bizside 2.1.12 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 684b653ee4921f968ac5419615dbd04e4ec314581a8942c0a7626711833247c5
|
|
4
|
+
data.tar.gz: c740c936e8027d969db49e66f63d75725cb10515f4a526e1631bd6b489af47d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48bd0994fce119c1e5681d242b095dab1cf5d812bcebb18ef28ebb89c3af66b6295bddb5c571240b1065443e7711f453119ace5988aa05921ec2a910b9066871
|
|
7
|
+
data.tar.gz: b2467222740be9070d261e61a30dac64ec44920617fc2dc49620c45a5e020b9d93e92f1e8b5b369484c1f64859237799c0918322cd2266e2de93df638660a515
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'action_view'
|
|
2
|
+
|
|
3
|
+
class ActionView::TemplateRenderer
|
|
4
|
+
|
|
5
|
+
def render(context, options)
|
|
6
|
+
@details = extract_details(options)
|
|
7
|
+
template = get_template_by_user_agent(context, options)
|
|
8
|
+
|
|
9
|
+
prepend_formats(template.format)
|
|
10
|
+
|
|
11
|
+
render_template(context, template, options[:layout], options[:locals] || {})
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def get_user_agent(context)
|
|
17
|
+
if context.respond_to?(:user_agent)
|
|
18
|
+
if context.respond_to?(:controller)
|
|
19
|
+
if context.controller.respond_to?(:session)
|
|
20
|
+
context.user_agent
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get_template_by_user_agent(context, options)
|
|
27
|
+
ret = nil
|
|
28
|
+
option_for_template = options[:template]
|
|
29
|
+
|
|
30
|
+
ua = get_user_agent(context)
|
|
31
|
+
if ua
|
|
32
|
+
ua.priorities.each do |priority|
|
|
33
|
+
begin
|
|
34
|
+
options[:template] = option_for_template + '.' + priority
|
|
35
|
+
ret = determine_template(options)
|
|
36
|
+
break
|
|
37
|
+
rescue ActionView::MissingTemplate
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
unless ret
|
|
43
|
+
options[:template] = option_for_template
|
|
44
|
+
ret = determine_template(options)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
Rails.logger.debug "UserAgent: #{ua ? ua.name : 'unknown'} => #{ret.identifier}"
|
|
48
|
+
ret
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -5,6 +5,12 @@ when 5
|
|
|
5
5
|
else
|
|
6
6
|
load File.expand_path(File.join('action_view', 'action_view_4.rb'), __dir__)
|
|
7
7
|
end
|
|
8
|
+
when 6
|
|
9
|
+
if Bizside.config.user_agent.use_variant?
|
|
10
|
+
load File.expand_path(File.join('action_view', 'use_variant.rb'), __dir__)
|
|
11
|
+
else
|
|
12
|
+
load File.expand_path(File.join('action_view', 'action_view_6.rb'), __dir__)
|
|
13
|
+
end
|
|
8
14
|
else
|
|
9
15
|
raise "Rails#{Rails::VERSION::MAJOR} はサポートしていません。"
|
|
10
16
|
end
|
|
@@ -5,11 +5,7 @@ module Bizside
|
|
|
5
5
|
|
|
6
6
|
included do
|
|
7
7
|
case Rails::VERSION::MAJOR
|
|
8
|
-
when
|
|
9
|
-
before_filter :detect_user_agent
|
|
10
|
-
when 4
|
|
11
|
-
before_action :detect_user_agent
|
|
12
|
-
when 5
|
|
8
|
+
when 5, 6
|
|
13
9
|
before_action :detect_user_agent
|
|
14
10
|
else
|
|
15
11
|
raise "Rails-#{Rails::VERSION::MAJOR} は未対応です。"
|
data/lib/bizside/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bizside
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- bizside-developers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-12-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: 5.0.0
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
22
|
+
version: 7.0.0
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: 5.0.0
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 7.0.0
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: aws-sdk-s3
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -301,7 +301,7 @@ dependencies:
|
|
|
301
301
|
version: 5.0.0
|
|
302
302
|
- - "<"
|
|
303
303
|
- !ruby/object:Gem::Version
|
|
304
|
-
version:
|
|
304
|
+
version: 7.0.0
|
|
305
305
|
type: :development
|
|
306
306
|
prerelease: false
|
|
307
307
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -311,7 +311,7 @@ dependencies:
|
|
|
311
311
|
version: 5.0.0
|
|
312
312
|
- - "<"
|
|
313
313
|
- !ruby/object:Gem::Version
|
|
314
|
-
version:
|
|
314
|
+
version: 7.0.0
|
|
315
315
|
- !ruby/object:Gem::Dependency
|
|
316
316
|
name: resque
|
|
317
317
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -444,6 +444,7 @@ files:
|
|
|
444
444
|
- lib/bizside/user_agent.rb
|
|
445
445
|
- lib/bizside/user_agent/action_view.rb
|
|
446
446
|
- lib/bizside/user_agent/action_view/action_view_4.rb
|
|
447
|
+
- lib/bizside/user_agent/action_view/action_view_6.rb
|
|
447
448
|
- lib/bizside/user_agent/action_view/use_variant.rb
|
|
448
449
|
- lib/bizside/user_agent/controller_helper.rb
|
|
449
450
|
- lib/bizside/validations.rb
|