glib-web 0.5.21 → 0.5.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/analytics/funnel.rb +60 -0
- data/app/controllers/concerns/glib/json/libs.rb +4 -4
- data/app/controllers/concerns/glib/json/ui.rb +11 -0
- data/app/helpers/glib/json_ui/action_builder.rb +2 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +37 -0
- data/app/helpers/glib/json_ui/page_helper.rb +11 -0
- data/app/helpers/glib/json_ui/view_builder.rb +36 -19
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d40fabbd2b44ff3a4c13a7095ea2f19b6b560de5d0c5d6a58616c94d000df1a
|
4
|
+
data.tar.gz: 1c4b8787db5d9fa131b18346e6b4d201b6c9b279f5a5e58d5debf6c4024475c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d75eca6f60a6cfe859d529216300a16987fde43fc4960df8a1923080c0142be524f21e0ddf32e6f3c66182fa0c12d9f6d8f85bd65d2671ad34e921dd02c89f9
|
7
|
+
data.tar.gz: 1c0225f8bd8979c62e74e69941b033afc98067c93e1a699d4402a347c9e7f7bb3076df798d88fd79d02216da6c067112950249cd1b0d0740c23b895911cdf143
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Glib::Analytics
|
2
|
+
module Funnel
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
# include Overrides
|
7
|
+
extend ClassMethods
|
8
|
+
|
9
|
+
helper_method :glib_analytics_feature_segment
|
10
|
+
helper_method :glib_analytics_feature_referer
|
11
|
+
end
|
12
|
+
|
13
|
+
# module Overrides
|
14
|
+
|
15
|
+
# # Expose protected method
|
16
|
+
# public # Override
|
17
|
+
# def policy_scope(*args)
|
18
|
+
# super
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
|
22
|
+
def glib_analytics_included?
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def glib_analytics_feature_segment
|
27
|
+
# To be overridden
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def glib_analytics_feature_referer
|
32
|
+
group = request.headers['GApp-Analytics-Referer-Group']
|
33
|
+
action = request.headers['GApp-Analytics-Referer-Action']
|
34
|
+
segment = request.headers['GApp-Analytics-Referer-Segment']
|
35
|
+
placement = request.headers['GApp-Analytics-Referer-Placement']
|
36
|
+
|
37
|
+
if group && action
|
38
|
+
return { group: group, action: action, segment: segment, placement: placement }
|
39
|
+
end
|
40
|
+
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
module ClassMethods
|
47
|
+
# def glib_auth_inited?
|
48
|
+
# @@__glib_auth_init ||= false
|
49
|
+
# end
|
50
|
+
|
51
|
+
# def glib_analytics_init
|
52
|
+
# @@__glib_analytics_init = true
|
53
|
+
# end
|
54
|
+
|
55
|
+
# def glib_analytics_inited?
|
56
|
+
# @@__glib_analytics_init ||= false
|
57
|
+
# end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -9,17 +9,17 @@ module Glib::Json::Libs
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def json_ui_app_bundle_id
|
12
|
-
@json_ui_app_bundle_id ||= request.headers['JsonUiApp-Bundle-Id']
|
12
|
+
@json_ui_app_bundle_id ||= request.headers['GApp-Bundle-Id'] || request.headers['JsonUiApp-Bundle-Id']
|
13
13
|
end
|
14
14
|
|
15
15
|
def json_ui_app_build_version
|
16
|
-
@json_ui_app_build_version ||= request.headers['JsonUiApp-Build-Version']
|
16
|
+
@json_ui_app_build_version ||= request.headers['GApp-Build-Version'] || request.headers['JsonUiApp-Build-Version']
|
17
17
|
@json_ui_app_build_version = params[:build_version] if @json_ui_app_build_version.nil? && Rails.env.development? # For easy testing
|
18
18
|
@json_ui_app_build_version
|
19
19
|
end
|
20
20
|
|
21
21
|
def json_ui_app_device_os
|
22
|
-
@json_ui_app_device_os ||= request.headers['JsonUiApp-Device-Os']
|
22
|
+
@json_ui_app_device_os ||= request.headers['GApp-Device-Os'] || request.headers['JsonUiApp-Device-Os']
|
23
23
|
@json_ui_app_device_os = params[:device_os] if @json_ui_app_device_os.nil? && Rails.env.development? # For easy testing
|
24
24
|
@json_ui_app_device_os || 'web'
|
25
25
|
end
|
@@ -59,7 +59,7 @@ module Glib::Json::Libs
|
|
59
59
|
# raise exception
|
60
60
|
# end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
def glib_json_handle_500(exception)
|
64
64
|
if json_ui_activated? && Rails.env.production?
|
65
65
|
Rollbar.error(exception) if defined?(Rollbar)
|
@@ -38,6 +38,17 @@ module Glib::Json::Ui
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
def json_ui_response_lifecycle_prop
|
42
|
+
prop_name = 'onResponse'
|
43
|
+
if (hash = json_transformation_start).is_a?(Hash) && hash[prop_name] # A valid response
|
44
|
+
if hash[prop_name]['action'] != 'runMultiple'
|
45
|
+
childActions = [hash[prop_name]]
|
46
|
+
hash[prop_name] = { 'action' => 'runMultiple', 'childActions' => childActions }
|
47
|
+
childActions
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
41
52
|
def __json_ui_start(options)
|
42
53
|
@__json_ui_activated = false
|
43
54
|
@__json_ui_rendering = nil
|
@@ -16,6 +16,7 @@ module Glib
|
|
16
16
|
end
|
17
17
|
|
18
18
|
class Action < JsonUiElement
|
19
|
+
# TODO: Deprecated
|
19
20
|
def analytics(value)
|
20
21
|
if value.is_a?(String)
|
21
22
|
@analyticsEnabled = true
|
@@ -27,6 +28,7 @@ module Glib
|
|
27
28
|
|
28
29
|
# Override
|
29
30
|
def created
|
31
|
+
# TODO: Deprecated
|
30
32
|
if @analyticsEnabled
|
31
33
|
suffix = @analyticsId
|
32
34
|
# TODO: recognize_path() needs `method` as a second argument for POST request
|
@@ -6,6 +6,36 @@ module Glib
|
|
6
6
|
end
|
7
7
|
|
8
8
|
class MenuItem < JsonUiElement
|
9
|
+
hash :analytics
|
10
|
+
|
11
|
+
# def initialize(json, page)
|
12
|
+
# super(json, page)
|
13
|
+
|
14
|
+
# # Can be improved by making it configurable site-wide.
|
15
|
+
# @analyticsEnabled = true
|
16
|
+
# end
|
17
|
+
|
18
|
+
# def analytics(value)
|
19
|
+
# if value.is_a?(Hash)
|
20
|
+
# @analyticsEnabled = true
|
21
|
+
# @analyticsId = value
|
22
|
+
# else
|
23
|
+
# @analyticsEnabled = value == true
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
|
27
|
+
# # Override
|
28
|
+
# def created
|
29
|
+
# json.analytics do
|
30
|
+
# if @analyticsEnabled
|
31
|
+
# if @analyticsId
|
32
|
+
# json.placement @analyticsId
|
33
|
+
# end
|
34
|
+
# else
|
35
|
+
# json.disabled true
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# end
|
9
39
|
end
|
10
40
|
|
11
41
|
class Button < MenuItem
|
@@ -21,7 +51,10 @@ module Glib
|
|
21
51
|
end
|
22
52
|
end
|
23
53
|
|
54
|
+
# Override
|
24
55
|
def created
|
56
|
+
super
|
57
|
+
|
25
58
|
json.type 'button'
|
26
59
|
end
|
27
60
|
end
|
@@ -29,6 +62,8 @@ module Glib
|
|
29
62
|
class Divider < MenuItem
|
30
63
|
# Override
|
31
64
|
def created
|
65
|
+
super
|
66
|
+
|
32
67
|
json.type 'divider'
|
33
68
|
end
|
34
69
|
end
|
@@ -39,6 +74,8 @@ module Glib
|
|
39
74
|
|
40
75
|
# Override
|
41
76
|
def created
|
77
|
+
super
|
78
|
+
|
42
79
|
json.type 'label'
|
43
80
|
end
|
44
81
|
end
|
@@ -17,6 +17,17 @@ module Glib
|
|
17
17
|
# TODO: Remove the block
|
18
18
|
def json_ui_page(json, &block)
|
19
19
|
@__json_ui_page ||= Page.new(json, self)
|
20
|
+
|
21
|
+
if try(:glib_analytics_included?)
|
22
|
+
json.analytics do
|
23
|
+
json.feature do
|
24
|
+
json.group controller_name
|
25
|
+
json.action action_name
|
26
|
+
json.segment glib_analytics_feature_segment
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
20
31
|
block&.call @__json_ui_page
|
21
32
|
@__json_ui_page
|
22
33
|
end
|
@@ -28,29 +28,46 @@ module Glib
|
|
28
28
|
length :height
|
29
29
|
color :backgroundColor
|
30
30
|
hash :padding
|
31
|
-
# array :styleClasses
|
32
31
|
singleton_array :styleClass, :styleClasses
|
33
32
|
hash :showIf
|
33
|
+
hash :analytics
|
34
34
|
|
35
|
-
def
|
36
|
-
|
37
|
-
@analyticsEnabled = true
|
38
|
-
@analyticsId = value
|
39
|
-
else
|
40
|
-
@analyticsEnabled = value == true
|
41
|
-
end
|
42
|
-
end
|
35
|
+
# def initialize(json, page)
|
36
|
+
# super(json, page)
|
43
37
|
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
38
|
+
# # Can be improved by making it configurable site-wide.
|
39
|
+
# @analyticsEnabled = true
|
40
|
+
# end
|
41
|
+
|
42
|
+
# def analytics(value)
|
43
|
+
# if value.is_a?(String)
|
44
|
+
# @analyticsEnabled = true
|
45
|
+
# @analyticsId = value
|
46
|
+
# else
|
47
|
+
# @analyticsEnabled = value == true
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
|
51
|
+
# # Override
|
52
|
+
# def created
|
53
|
+
# # if @analyticsEnabled
|
54
|
+
# # context = page.context
|
55
|
+
# # json.analytics do
|
56
|
+
# # content = @analyticsId || (@text || @icon)&.gsub(/\s+/, '_')&.downcase || 'nil'
|
57
|
+
# # json.namePrefix [context.controller_name, context.action_name, content].join('_')
|
58
|
+
# # end
|
59
|
+
# # end
|
60
|
+
|
61
|
+
# json.analytics do
|
62
|
+
# if @analyticsEnabled
|
63
|
+
# if @analyticsId
|
64
|
+
# json.placement @analyticsId
|
65
|
+
# end
|
66
|
+
# else
|
67
|
+
# json.disabled true
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
# end
|
54
71
|
|
55
72
|
end
|
56
73
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -64,6 +64,7 @@ executables: []
|
|
64
64
|
extensions: []
|
65
65
|
extra_rdoc_files: []
|
66
66
|
files:
|
67
|
+
- app/controllers/concerns/glib/analytics/funnel.rb
|
67
68
|
- app/controllers/concerns/glib/auth/policy.rb
|
68
69
|
- app/controllers/concerns/glib/json/dynamic_text.rb
|
69
70
|
- app/controllers/concerns/glib/json/libs.rb
|