glib-web 0.5.19 → 0.5.24
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 +61 -0
- data/app/controllers/concerns/glib/json/libs.rb +4 -4
- data/app/controllers/concerns/glib/json/traversal.rb +1 -0
- data/app/controllers/concerns/glib/json/ui.rb +11 -0
- data/app/helpers/glib/json_ui/action_builder.rb +27 -28
- data/app/helpers/glib/json_ui/analytics_helper.rb +17 -0
- data/app/helpers/glib/json_ui/list_builders.rb +3 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +37 -0
- data/app/helpers/glib/json_ui/page_helper.rb +3 -0
- data/app/helpers/glib/json_ui/response_helper.rb +2 -0
- data/app/helpers/glib/json_ui/view_builder.rb +36 -19
- data/app/views/json_ui/garage/lists/_autoload_section.json.jbuilder +7 -1
- data/app/views/json_ui/garage/lists/index.json.jbuilder +3 -0
- data/app/views/json_ui/garage/lists/reordering.json.jbuilder +24 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc406a3897c823c3c4c9d9470811460a5c08a469178fcb965459b91cbef9b37a
|
4
|
+
data.tar.gz: 3e38269b7c876f08e084aaa83a12bbe7476cc8724775e8f09ce429d927a133a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b048d67cd2cf79dc3b7e4f72d0da7ecfb8001a6d504cf933bacc46875f9ad044c1d704621794fea22439eb17bbabd3ca90e5c0ae8cd7b77e5b8e14c0fde86469
|
7
|
+
data.tar.gz: b58a6fcacead2d9a23e37220fa39a108e1fb147d6e8109d1fabeabb17020647dba8968052015e083824d013c6decd3d3bb9df6ebae9389e2e7d532e35c890ed6
|
@@ -0,0 +1,61 @@
|
|
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
|
+
helper_method :glib_analytics_included?
|
12
|
+
end
|
13
|
+
|
14
|
+
# module Overrides
|
15
|
+
|
16
|
+
# # Expose protected method
|
17
|
+
# public # Override
|
18
|
+
# def policy_scope(*args)
|
19
|
+
# super
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
|
23
|
+
def glib_analytics_included?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def glib_analytics_feature_segment
|
28
|
+
# To be overridden
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
def glib_analytics_feature_referer
|
33
|
+
group = request.headers['GApp-Analytics-Referer-Group']
|
34
|
+
action = request.headers['GApp-Analytics-Referer-Action']
|
35
|
+
segment = request.headers['GApp-Analytics-Referer-Segment']
|
36
|
+
placement = request.headers['GApp-Analytics-Referer-Placement']
|
37
|
+
|
38
|
+
if group && action
|
39
|
+
return { group: group, action: action, segment: segment, placement: placement }
|
40
|
+
end
|
41
|
+
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
module ClassMethods
|
48
|
+
# def glib_auth_inited?
|
49
|
+
# @@__glib_auth_init ||= false
|
50
|
+
# end
|
51
|
+
|
52
|
+
# def glib_analytics_init
|
53
|
+
# @@__glib_analytics_init = true
|
54
|
+
# end
|
55
|
+
|
56
|
+
# def glib_analytics_inited?
|
57
|
+
# @@__glib_analytics_init ||= false
|
58
|
+
# end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
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,34 +16,33 @@ module Glib
|
|
16
16
|
end
|
17
17
|
|
18
18
|
class Action < JsonUiElement
|
19
|
-
def analytics(value)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
# Override
|
29
|
-
def created
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
|
19
|
+
# def analytics(value)
|
20
|
+
# if value.is_a?(String)
|
21
|
+
# @analyticsEnabled = true
|
22
|
+
# @analyticsId = value
|
23
|
+
# else
|
24
|
+
# @analyticsEnabled = value == true
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# # Override
|
29
|
+
# def created
|
30
|
+
# if @analyticsEnabled
|
31
|
+
# suffix = @analyticsId
|
32
|
+
# # TODO: recognize_path() needs `method` as a second argument for POST request
|
33
|
+
# if suffix.nil? && @url && (route = Rails.application.routes.recognize_path(@url))
|
34
|
+
# suffix = "#{route[:controller]}_#{route[:action]}"
|
35
|
+
# end
|
36
|
+
|
37
|
+
# if suffix
|
38
|
+
# json.analytics do
|
39
|
+
# json.track :event
|
40
|
+
# json.nameSuffix suffix
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
|
44
|
+
# end
|
45
|
+
# end
|
47
46
|
end
|
48
47
|
|
49
48
|
### Action definitions
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Glib
|
2
|
+
module JsonUi
|
3
|
+
module AnalyticsHelper
|
4
|
+
def __json_ui_analytics(json)
|
5
|
+
if try(:glib_analytics_included?)
|
6
|
+
json.analytics do
|
7
|
+
json.feature do
|
8
|
+
json.group controller_name
|
9
|
+
json.action action_name
|
10
|
+
json.segment glib_analytics_feature_segment
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -35,6 +35,9 @@ module Glib
|
|
35
35
|
action :onLongPress
|
36
36
|
icon :icon
|
37
37
|
bool :avatar
|
38
|
+
action :onReorder
|
39
|
+
string :paramNameForFormData
|
40
|
+
string :paramNameForNewIndex
|
38
41
|
|
39
42
|
# # NOTE: Experimental. Still deciding whether this needs to be a full blown panel or
|
40
43
|
# # an array of badges (with relevant properties, e.g. text, color, etc)
|
@@ -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
|
@@ -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
|
|
@@ -17,6 +17,12 @@ section.rows builder: ->(row) do
|
|
17
17
|
batch_count = 30
|
18
18
|
batch_count.times do |i|
|
19
19
|
index = page_index * batch_count + i
|
20
|
-
|
20
|
+
if local_assigns[:reorder]
|
21
|
+
row.thumbnail title: "Item #{index}", onReorder: ->(action) do
|
22
|
+
action.dialogs_alert
|
23
|
+
end, paramNameForFormData: 'message', paramNameForNewIndex: 'new_index'
|
24
|
+
else
|
25
|
+
row.thumbnail title: "Item #{index}"
|
26
|
+
end
|
21
27
|
end
|
22
28
|
end
|
@@ -23,6 +23,9 @@ json_ui_page json do |page|
|
|
23
23
|
template.thumbnail title: 'Autoload All', onClick: ->(action) do
|
24
24
|
action.windows_open url: json_ui_garage_url(path: 'lists/autoload_all')
|
25
25
|
end
|
26
|
+
template.thumbnail title: 'Reordering', onClick: ->(action) do
|
27
|
+
action.windows_open url: json_ui_garage_url(path: 'lists/reordering')
|
28
|
+
end
|
26
29
|
end
|
27
30
|
|
28
31
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
page_index = params[:page].to_i
|
2
|
+
next_page = {
|
3
|
+
url: json_ui_garage_url(path: 'lists/reordering', page: page_index + 1, section_only: 'v1'),
|
4
|
+
autoload: 'asNeeded'
|
5
|
+
}
|
6
|
+
|
7
|
+
page = json_ui_page json
|
8
|
+
|
9
|
+
if params[:section_only].present?
|
10
|
+
json.nextPage next_page if page_index < 3
|
11
|
+
json.sections do
|
12
|
+
json.child! do
|
13
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index, reorder: true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
else
|
17
|
+
json.title 'Lists'
|
18
|
+
|
19
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
20
|
+
|
21
|
+
page.list nextPage: next_page, firstSection: ->(section) do
|
22
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index, reorder: true
|
23
|
+
end
|
24
|
+
end
|
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.24
|
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
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- app/helpers/glib/json_ui/action_builder/sheets.rb
|
85
86
|
- app/helpers/glib/json_ui/action_builder/snackbars.rb
|
86
87
|
- app/helpers/glib/json_ui/action_builder/windows.rb
|
88
|
+
- app/helpers/glib/json_ui/analytics_helper.rb
|
87
89
|
- app/helpers/glib/json_ui/dynamic_field_builders.rb
|
88
90
|
- app/helpers/glib/json_ui/generic_builders.rb
|
89
91
|
- app/helpers/glib/json_ui/list_builders.rb
|
@@ -149,6 +151,7 @@ files:
|
|
149
151
|
- app/views/json_ui/garage/lists/edit_actions.json.jbuilder
|
150
152
|
- app/views/json_ui/garage/lists/fab.json.jbuilder
|
151
153
|
- app/views/json_ui/garage/lists/index.json.jbuilder
|
154
|
+
- app/views/json_ui/garage/lists/reordering.json.jbuilder
|
152
155
|
- app/views/json_ui/garage/lists/templating.json.jbuilder
|
153
156
|
- app/views/json_ui/garage/notifications/android_post.json.jbuilder
|
154
157
|
- app/views/json_ui/garage/notifications/index.json.jbuilder
|