glib-web 0.6.4 → 0.6.8
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 +11 -0
- data/app/helpers/glib/json_ui/abstract_builder.rb +14 -0
- data/app/helpers/glib/json_ui/action_builder/commands.rb +7 -0
- data/app/helpers/glib/json_ui/view_builder/multimedia.rb +7 -0
- data/app/helpers/glib/json_ui/view_builder.rb +1 -1
- data/app/validators/url_validator.rb +11 -5
- data/app/views/json_ui/garage/actions/_commands.json.jbuilder +9 -0
- data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -0
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +5 -2
- data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +59 -10
- data/app/views/json_ui/garage/views/controls.json.jbuilder +3 -3
- data/app/views/json_ui/garage/views/index.json.jbuilder +1 -25
- data/app/views/json_ui/garage/views/multimedia.json.jbuilder +26 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: debfa281cad1c3955db718e9bc04f0190e3c3d7af424de2179d83be7e95f6dc0
|
4
|
+
data.tar.gz: 93dc0caef3ad5f2f084c8455bcf04dd26ce29f7bc6b15931be720016c5c93483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 111b791d73b6f8a57b69441d173f62a8bd2fb77b278ed861457a5e9f1e384f93b7fac3e651cdf26c031612710730cc8f9e8dcc6090daba6f247c155f3a4600e3
|
7
|
+
data.tar.gz: b46e226e8736f9cf33ef07fe2d548c1c136781d9216f1041964d574fe7dffc47d69f001b11606391555d3588dfd596c68b191a499708e1f3b196aa00982ac9a9
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'uri'
|
1
2
|
module Glib::Analytics
|
2
3
|
module Funnel
|
3
4
|
extend ActiveSupport::Concern
|
@@ -35,6 +36,16 @@ module Glib::Analytics
|
|
35
36
|
segment = request.headers['GApp-Analytics-Referer-Segment']
|
36
37
|
placement = request.headers['GApp-Analytics-Referer-Placement']
|
37
38
|
|
39
|
+
if group.nil? && action.nil? && !request.headers['referer'].nil?
|
40
|
+
host = URI.parse(request.headers['referer']).host
|
41
|
+
if host == request.host || !/^(.*).#{request.host.sub('www','')}/.match(host).nil?
|
42
|
+
|
43
|
+
route = Rails.application.routes.recognize_path(request.headers['referer'].delete_suffix('/'))
|
44
|
+
group = route[:controller]
|
45
|
+
action = route[:action]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
38
49
|
if group && action
|
39
50
|
return { group: group, action: action, segment: segment, placement: placement }
|
40
51
|
end
|
@@ -113,6 +113,20 @@ module Glib
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
def self.url(propName)
|
117
|
+
define_method(propName) do |value|
|
118
|
+
if (value = value&.to_s)
|
119
|
+
if !Rails.env.production?
|
120
|
+
if !UrlValidator.validate(value)
|
121
|
+
raise "Invalid URL: #{value}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
json.set! propName, value
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
116
130
|
def self.color(propName)
|
117
131
|
define_method(propName) do |value|
|
118
132
|
if (value = value&.to_s)
|
@@ -1,5 +1,11 @@
|
|
1
1
|
class UrlValidator < ActiveModel::EachValidator
|
2
2
|
def validate_each(record, attribute, value)
|
3
|
+
if !self.class.validate(value)
|
4
|
+
record.errors.add(attribute, :invalid)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.validate(value)
|
3
9
|
schemes = ['https', 'http']
|
4
10
|
|
5
11
|
begin
|
@@ -8,13 +14,13 @@ class UrlValidator < ActiveModel::EachValidator
|
|
8
14
|
scheme = uri && uri.scheme
|
9
15
|
|
10
16
|
valid_scheme = host && scheme && schemes.include?(scheme)
|
11
|
-
valid_raw_url = scheme && value.match?(URI
|
17
|
+
valid_raw_url = scheme && value.match?(URI.regexp([scheme]))
|
12
18
|
|
13
|
-
unless valid_raw_url && valid_scheme
|
14
|
-
record.errors.add(attribute, :invalid)
|
15
|
-
end
|
19
|
+
return false unless valid_raw_url && valid_scheme
|
16
20
|
rescue URI::InvalidURIError
|
17
|
-
|
21
|
+
return false
|
18
22
|
end
|
23
|
+
|
24
|
+
true
|
19
25
|
end
|
20
26
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
2
|
+
header.h3 text: 'Commands'
|
3
|
+
end
|
4
|
+
|
5
|
+
section.rows builder: ->(template) do
|
6
|
+
template.thumbnail title: 'commands/copy', onClick: ->(action) do
|
7
|
+
action.commands_copy text: 'Paste this somewhere else'
|
8
|
+
end
|
9
|
+
end
|
@@ -20,5 +20,7 @@ page.list sections: [
|
|
20
20
|
render "#{@path_prefix}/actions/timeouts", section: section
|
21
21
|
end, ->(section) do
|
22
22
|
render "#{@path_prefix}/actions/http", section: section
|
23
|
+
end, ->(section) do
|
24
|
+
render "#{@path_prefix}/actions/commands", section: section
|
23
25
|
end
|
24
26
|
]
|
@@ -10,14 +10,14 @@ page = json_ui_page json
|
|
10
10
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
11
11
|
|
12
12
|
page.form options.merge(childViews: ->(form) do
|
13
|
-
rules = { fileType: 'image
|
13
|
+
rules = { fileType: 'image', maxFileSize: 5000 }
|
14
14
|
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Landscape Photo', accepts: rules, directUploadUrl: rails_direct_uploads_url,
|
15
15
|
value: 'eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4',
|
16
16
|
fileUrl: 'https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100',
|
17
17
|
fileTitle: '1 month ago',
|
18
18
|
placeholderView: { type: 'image', width: 100, height: 75, url: 'https://www.atms.com.au/wp-content/uploads/2019/10/placeholder-1-1024x683.png?x93630' }
|
19
19
|
|
20
|
-
rules = { fileType: 'image
|
20
|
+
rules = { fileType: 'image', maxFileSize: 1, fileTypeErrorText: 'Invalid!', maxFileSizeErrorText: 'Too big!' }
|
21
21
|
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Avatar', accepts: rules, directUploadUrl: rails_direct_uploads_url,
|
22
22
|
placeholderView: { type: 'avatar', width: 100, height: 100, url: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMREBUREhAWFhUWGBcVFRgXFxUVFxcWGRUWFxYVFRUYHSggGB0lHRgVITEhJSkrLi4uGB8zODMtNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAOMA3gMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABgcBAwQFAv/EAEAQAAECAwMKAwYEBAYDAAAAAAEAAgMRIQQSMQUGIjJBUWFxgZEHE6FCUnKxwdEUI2LwM4KSskNzg6LC4WOz8f/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwC6XuvCQRj7okcUe27UYoxt4TOKDDG3Knkjm3jeGCMdeoeaOcWmQwQZe6/Qc0a+6Lpx+6PbcqOSNbeF44oMMbcqeSOZeN4YIx1+h5oXEG6MEGXuv0HNGuui6cfuvMytl6zWTXi6XuN039hh1koflPxDe4nyILW/qfpO/pFB6oLDhMLTX0XLbLbChmcSNDZ8T2tPqVUNuy/aY38S0PI3A3W/0tkF5qC4bVnZYsPxLT8Ic71AWgZ72ICXmuP+m/7KpUQWzAzzsQP8Y9Ybx9F0szlsb3TFqhjDWJZ6uAVOogvcR2RR+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svIOrj2ojSAJOx7+qAW3KiuxAy9pfuiwwEa2HeqOBJmMO3OiAHX6Gm1C65QV2rLzPVx7IwgUdj3QfVp1eqWfVREGqy49PskfW7IiDZasOv3WYGr3REGuy49FiPrdkRBstWHX7rMHV7rKINVlx6LEXX7IiDZasBzWYOp3+qyiDVZcTyWIuv2+iIg2WrAc1mHqdD9URB8WXEr5fr9R9ERBttOr1Sz6vdZRBpsuPT7JH1uyIg2WrDqswdTuiINdlxPJYtOt0REH//2Q==' }
|
23
23
|
|
@@ -28,6 +28,9 @@ page.form options.merge(childViews: ->(form) do
|
|
28
28
|
rules = { fileType: 'pdf', maxFileSize: 5000 }
|
29
29
|
form.fields_file name: 'user[pdf2][]', width: 'matchParent', label: 'PDF Document', accepts: rules, directUploadUrl: rails_direct_uploads_url
|
30
30
|
|
31
|
+
rules = { fileType: 'zip', maxFileSize: 5000 }
|
32
|
+
form.fields_file name: 'user[zip][]', width: 'matchParent', label: 'ZIP Document', accepts: rules, directUploadUrl: rails_direct_uploads_url
|
33
|
+
|
31
34
|
# TODO
|
32
35
|
# rules = { fileType: 'image/*', maxFileSize: 1, fileTypeErrorText: 'Invalid!', maxFileSizeErrorText: 'Too big!' }
|
33
36
|
# form.fields_multiImage name: 'user[photos][]', width: 'matchParent', label: 'Avatar', accepts: rules, directUploadUrl: rails_direct_uploads_url,
|
@@ -4,14 +4,63 @@ page = json_ui_page json
|
|
4
4
|
|
5
5
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
6
6
|
|
7
|
-
page.form url: json_ui_garage_url(path: 'forms/submission_flow_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
# page.form url: json_ui_garage_url(path: 'forms/submission_flow_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
|
8
|
+
# form.fields_radioGroup name: 'user[flow]', childViews: ->(group) do
|
9
|
+
# group.h3 text: 'Flow'
|
10
|
+
# group.spacer height: 6
|
11
|
+
# group.fields_radio value: 'open', label: 'open - useful for form create'
|
12
|
+
# group.fields_radio value: 'close_with_reload', label: 'closeWithReload - useful for form update'
|
13
|
+
# group.fields_radio value: 'close_alert', label: 'close+alert - useful for non-model form (e.g. contact us)'
|
14
|
+
# group.fields_radio value: 'alert_close', label: 'alert+close - useful for non-model form (e.g. contact us)'
|
15
|
+
# group.fields_radio value: 'on_submit', label: 'onSubmit - useful for performing an action prior to submitting'
|
16
|
+
# end
|
17
|
+
|
18
|
+
# form.spacer height: 14
|
19
|
+
# form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
20
|
+
# end
|
21
|
+
|
22
|
+
|
23
|
+
page.scroll childViews: ->(scroll) do
|
24
|
+
scroll.panels_form \
|
25
|
+
url: json_ui_garage_url(path: 'forms/submission_flow_post'),
|
26
|
+
method: 'post',
|
27
|
+
padding: { top: 12, left: 20, right: 20, bottom: 12 },
|
28
|
+
childViews: ->(form) do
|
29
|
+
form.h3 text: 'Submission flow best practices'
|
30
|
+
form.spacer height: 6
|
31
|
+
|
32
|
+
form.fields_radioGroup name: 'user[flow]', childViews: ->(group) do
|
33
|
+
group.fields_radio value: 'open', label: 'open - useful for form create'
|
34
|
+
group.fields_radio value: 'close_with_reload', label: 'closeWithReload - useful for form update'
|
35
|
+
group.fields_radio value: 'close_alert', label: 'close+alert - useful for non-model form (e.g. contact us)'
|
36
|
+
group.fields_radio value: 'alert_close', label: 'alert+close - useful for non-model form (e.g. contact us)'
|
37
|
+
end
|
38
|
+
|
39
|
+
form.spacer height: 14
|
40
|
+
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
41
|
+
end
|
42
|
+
|
43
|
+
scroll.panels_form \
|
44
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
45
|
+
method: 'post',
|
46
|
+
padding: { top: 12, left: 20, right: 20, bottom: 12 },
|
47
|
+
childViews: ->(form) do
|
48
|
+
form.h3 text: 'Perform custom actions on submit'
|
49
|
+
|
50
|
+
form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[text]', value: 'Hello'
|
51
|
+
|
52
|
+
form.spacer height: 14
|
53
|
+
# form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
54
|
+
|
55
|
+
form.fields_submit text: 'Submit'
|
56
|
+
end,
|
57
|
+
onSubmit: ->(action) do
|
58
|
+
# action.forms_submit
|
59
|
+
|
60
|
+
action.dialogs_alert \
|
61
|
+
message: 'The form will submit after the dialog is closed',
|
62
|
+
onClose: ->(subaction) do
|
63
|
+
subaction.forms_submit
|
64
|
+
end
|
65
|
+
end
|
17
66
|
end
|
@@ -9,15 +9,15 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
9
9
|
|
10
10
|
scroll.button text: 'Button', onClick: ->(action) do
|
11
11
|
action.dialogs_alert message: 'Perform action'
|
12
|
-
end
|
12
|
+
end, tour: { index: 0, key: 'quiz1', title: 'Tutorial Step 1', message: 'This is step 1 of the tutorial' }
|
13
13
|
scroll.spacer height: 20
|
14
14
|
|
15
15
|
scroll.button text: 'Buton with build-in classes', styleClasses: ['rounded', 'outlined', 'tile', 'depressed'], onClick: ->(action) do
|
16
16
|
action.dialogs_alert message: 'Perform action'
|
17
|
-
end
|
17
|
+
end, tour: { index: 1, key: 'quiz1', title: 'Tutorial Step 2', message: 'This is step 2 of the tutorial' }
|
18
18
|
scroll.spacer height: 20
|
19
19
|
|
20
|
-
scroll.button icon: 'info', text: 'Button with Icon and Tooltip', tooltip: { text: 'Tooltip text'}, onClick: ->(action) do
|
20
|
+
scroll.button icon: 'info', text: 'Button with Icon and Tooltip', tooltip: { text: 'Tooltip text' }, onClick: ->(action) do
|
21
21
|
action.dialogs_alert message: 'Perform action'
|
22
22
|
end
|
23
23
|
scroll.spacer height: 20
|
@@ -10,35 +10,11 @@ json_ui_page json do |page|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
section.rows builder: ->(template) do
|
13
|
-
['texts', 'controls', 'images', 'charts', 'banners', 'maps', 'misc', 'icons', 'progress'].each do |component|
|
13
|
+
['texts', 'controls', 'images', 'multimedia', 'charts', 'banners', 'maps', 'misc', 'icons', 'progress'].each do |component|
|
14
14
|
template.thumbnail title: component.humanize, onClick: ->(action) do
|
15
15
|
action.windows_open url: json_ui_garage_url(path: "views/#{component}")
|
16
16
|
end
|
17
17
|
end
|
18
|
-
# template.thumbnail title: 'Texts', onClick: ->(action) do
|
19
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/texts')
|
20
|
-
# end
|
21
|
-
# template.thumbnail title: 'Controls', onClick: ->(action) do
|
22
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/controls')
|
23
|
-
# end
|
24
|
-
# template.thumbnail title: 'Images', onClick: ->(action) do
|
25
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/images')
|
26
|
-
# end
|
27
|
-
# template.thumbnail title: 'Charts', onClick: ->(action) do
|
28
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/charts')
|
29
|
-
# end
|
30
|
-
# template.thumbnail title: 'Banners', onClick: ->(action) do
|
31
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/banners')
|
32
|
-
# end
|
33
|
-
# template.thumbnail title: 'Maps', onClick: ->(action) do
|
34
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/maps')
|
35
|
-
# end
|
36
|
-
# template.thumbnail title: 'Misc', onClick: ->(action) do
|
37
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/misc')
|
38
|
-
# end
|
39
|
-
# template.thumbnail title: 'Icons', onClick: ->(action) do
|
40
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/icons')
|
41
|
-
# end
|
42
18
|
end
|
43
19
|
end,
|
44
20
|
->(section) do
|
@@ -0,0 +1,26 @@
|
|
1
|
+
json.title 'Views'
|
2
|
+
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
|
+
|
6
|
+
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
scroll.h2 text: 'Youtube (long URL)'
|
8
|
+
scroll.spacer height: 6
|
9
|
+
scroll.multimedia_video width: 560, height: 315, url: 'https://www.youtube.com/watch?v=947op8yKJRY'
|
10
|
+
|
11
|
+
scroll.spacer height: 24
|
12
|
+
scroll.h2 text: 'Youtube (shorten URL)'
|
13
|
+
scroll.spacer height: 6
|
14
|
+
scroll.multimedia_video width: 560, height: 315, url: 'https://youtu.be/ATnpEOo3GJA'
|
15
|
+
|
16
|
+
scroll.spacer height: 24
|
17
|
+
scroll.h2 text: 'Youtube (specific width)'
|
18
|
+
scroll.label text: 'If height is not specified, it will be auto-calculated using 16:9 ratio.'
|
19
|
+
scroll.spacer height: 6
|
20
|
+
scroll.multimedia_video width: 640, url: 'https://youtu.be/ATnpEOo3GJA'
|
21
|
+
|
22
|
+
scroll.spacer height: 24
|
23
|
+
scroll.h2 text: 'Youtube (full width)'
|
24
|
+
scroll.spacer height: 6
|
25
|
+
scroll.multimedia_video width: 'matchParent', url: 'https://youtu.be/ATnpEOo3GJA'
|
26
|
+
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.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- app/helpers/glib/forms_helper.rb
|
92
92
|
- app/helpers/glib/json_ui/abstract_builder.rb
|
93
93
|
- app/helpers/glib/json_ui/action_builder.rb
|
94
|
+
- app/helpers/glib/json_ui/action_builder/commands.rb
|
94
95
|
- app/helpers/glib/json_ui/action_builder/dialogs.rb
|
95
96
|
- app/helpers/glib/json_ui/action_builder/http.rb
|
96
97
|
- app/helpers/glib/json_ui/action_builder/iap.rb
|
@@ -112,6 +113,7 @@ files:
|
|
112
113
|
- app/helpers/glib/json_ui/view_builder/charts.rb
|
113
114
|
- app/helpers/glib/json_ui/view_builder/fields.rb
|
114
115
|
- app/helpers/glib/json_ui/view_builder/iap.rb
|
116
|
+
- app/helpers/glib/json_ui/view_builder/multimedia.rb
|
115
117
|
- app/helpers/glib/json_ui/view_builder/panels.rb
|
116
118
|
- app/helpers/glib/urls_helper.rb
|
117
119
|
- app/models/concerns/glib/soft_deletable.rb
|
@@ -125,6 +127,7 @@ files:
|
|
125
127
|
- app/validators/email_validator.rb
|
126
128
|
- app/validators/url_validator.rb
|
127
129
|
- app/views/json_ui/garage/_nav_menu.json.jbuilder
|
130
|
+
- app/views/json_ui/garage/actions/_commands.json.jbuilder
|
128
131
|
- app/views/json_ui/garage/actions/_dialogs.json.jbuilder
|
129
132
|
- app/views/json_ui/garage/actions/_http.json.jbuilder
|
130
133
|
- app/views/json_ui/garage/actions/_panels.json.jbuilder
|
@@ -231,6 +234,7 @@ files:
|
|
231
234
|
- app/views/json_ui/garage/views/maps.json.jbuilder
|
232
235
|
- app/views/json_ui/garage/views/markdowns.json.jbuilder
|
233
236
|
- app/views/json_ui/garage/views/misc.json.jbuilder
|
237
|
+
- app/views/json_ui/garage/views/multimedia.json.jbuilder
|
234
238
|
- app/views/json_ui/garage/views/progress.json.jbuilder
|
235
239
|
- app/views/json_ui/garage/views/texts.json.jbuilder
|
236
240
|
- app/views/layouts/json_ui/renderer.html.erb
|