glib-web 0.4.66 → 0.4.71
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 +4 -4
- data/app/helpers/glib/json_ui/list_builders.rb +1 -0
- data/app/helpers/glib/json_ui/page_helper.rb +6 -0
- data/app/helpers/glib/json_ui/view_builder/panels.rb +3 -0
- data/app/validators/email_typo_validator.rb +38 -0
- data/app/views/json_ui/garage/actions/_timeouts.json.jbuilder +18 -0
- data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -0
- data/app/views/json_ui/garage/forms/basic.json.jbuilder +8 -5
- data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +2 -0
- data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +1 -18
- data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +9 -0
- data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +54 -10
- data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +21 -1
- data/app/views/json_ui/garage/home/slow.json.jbuilder +11 -0
- data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +10 -7
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +2 -1
- data/app/views/json_ui/garage/pages/index.json.jbuilder +9 -5
- data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +10 -0
- data/lib/glib-web.rb +1 -0
- data/lib/glib/crypt.rb +1 -0
- data/lib/glib/crypt/utils.rb +26 -0
- data/lib/glib/dynamic_text.rb +1 -1
- data/lib/glib/json_crawler/action_crawler.rb +3 -3
- data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +20 -6
- data/lib/glib/json_crawler/router.rb +21 -9
- metadata +7 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 484c96e0a3248d0e41548a4d4527edeb53748679
|
|
4
|
+
data.tar.gz: 416c21f0c017de9501bdcd5e2d3444c8f5896056
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2dccc517539bf275df626b273dd724b72fa651ad17f50ef4a7c6d1680f745b5dbbd01d8b061af9b603f0d237312d2139d31a88a538ac901192dad19fb2cea58a
|
|
7
|
+
data.tar.gz: 85fb1678e0bee26f9c53fdd3eb0e1c5a7ea6fe27f8ec06bfafc07df09301ea413c7decd40ea1f3a1a30c292657ee1e8a61faefceda07415605c8b5b8d2397054
|
|
@@ -99,6 +99,8 @@ class Glib::JsonUi::ViewBuilder
|
|
|
99
99
|
|
|
100
100
|
class List < View
|
|
101
101
|
hash :nextPage
|
|
102
|
+
action :onScrollToTop
|
|
103
|
+
action :onScrollToBottom
|
|
102
104
|
|
|
103
105
|
def firstSection(block)
|
|
104
106
|
json.sections [1] do
|
|
@@ -191,6 +193,7 @@ class Glib::JsonUi::ViewBuilder
|
|
|
191
193
|
class Custom < View
|
|
192
194
|
string :template
|
|
193
195
|
hash :data
|
|
196
|
+
action :onClick
|
|
194
197
|
|
|
195
198
|
def content(block)
|
|
196
199
|
json.data do
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
class EmailTypoValidator < ActiveModel::EachValidator
|
|
2
|
+
COMMON_FORMAT = {
|
|
3
|
+
'\.\.' => '.',
|
|
4
|
+
'.con\z' => '.com',
|
|
5
|
+
'.coj\z' => '.com',
|
|
6
|
+
'.vom\z' => '.com',
|
|
7
|
+
'.xom\z' => '.com',
|
|
8
|
+
'.com[a-z]\z' => '.com',
|
|
9
|
+
'.con.' => '.com.',
|
|
10
|
+
'.orf\z' => '.org',
|
|
11
|
+
'.orf.' => '.org.',
|
|
12
|
+
'@hitmail.' => '@hotmail.',
|
|
13
|
+
'@htomail.' => '@hotmail.',
|
|
14
|
+
'@hotnail.' => '@hotmail.',
|
|
15
|
+
'@hotmil.' => '@hotmail.',
|
|
16
|
+
'@hotmal.' => '@hotmail.',
|
|
17
|
+
'@hoymail.' => '@hotmail.',
|
|
18
|
+
'@hormail.' => '@hotmail.',
|
|
19
|
+
'@hotmsil.' => '@hotmail.',
|
|
20
|
+
'@gail.' => '@gmail.',
|
|
21
|
+
'@gnail.' => '@gmail.',
|
|
22
|
+
'@gmil.' => '@gmail.',
|
|
23
|
+
'@gmal.' => '@gmail.',
|
|
24
|
+
'@gmai.' => '@gmail.',
|
|
25
|
+
'@yahho.' => '@yahoo.',
|
|
26
|
+
'@yaho.' => '@yahoo.',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def validate_each(record, attribute, value)
|
|
30
|
+
COMMON_FORMAT.keys.each do |format_key|
|
|
31
|
+
regex = Regexp.new(format_key)
|
|
32
|
+
if match = regex.match(value)
|
|
33
|
+
record.errors.add(attribute, "Invalid, replace #{match[0]} with #{COMMON_FORMAT[format_key]}")
|
|
34
|
+
break
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
3
|
+
header.h3 text: 'Timeouts'
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
section.rows builder: ->(template) do
|
|
7
|
+
template.thumbnail title: 'timeouts/set', onClick: ->(action) do
|
|
8
|
+
action.timeouts_set interval: 1000, onTimeout: ->(subaction) do
|
|
9
|
+
subaction.snackbars_alert message: 'Timeout elapsed'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# section.rows builder: ->(template) do
|
|
15
|
+
# template.thumbnail title: 'timeouts/clear', onClick: ->(action) do
|
|
16
|
+
# action.windows_open url: json_ui_garage_url(path: 'home/blank')
|
|
17
|
+
# end
|
|
18
|
+
# end
|
|
@@ -12,6 +12,8 @@ json_ui_page json do |page|
|
|
|
12
12
|
render "#{@path_prefix}/actions/sheets", section: section
|
|
13
13
|
end, ->(section) do
|
|
14
14
|
render "#{@path_prefix}/actions/windows", section: section
|
|
15
|
+
end, ->(section) do
|
|
16
|
+
render "#{@path_prefix}/actions/timeouts", section: section
|
|
15
17
|
end, ->(section) do
|
|
16
18
|
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
17
19
|
header.h3 text: 'Reload'
|
|
@@ -2,11 +2,11 @@ json.title 'Forms'
|
|
|
2
2
|
|
|
3
3
|
json_ui_page json do |page|
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
|
7
7
|
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
|
|
8
8
|
form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# form.panels_split width: 'matchParent', leftViews: ->(split) do
|
|
11
11
|
# if params[:mode] == 'dialog'
|
|
12
12
|
# split.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
|
@@ -14,7 +14,7 @@ json_ui_page json do |page|
|
|
|
14
14
|
# end, rightViews: ->(split) do
|
|
15
15
|
# split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
16
16
|
# end
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
form.panels_split width: 'matchParent', content: ->(split) do
|
|
19
19
|
split.left childViews: ->(left) do
|
|
20
20
|
if params[:mode] == 'dialog'
|
|
@@ -25,7 +25,10 @@ json_ui_page json do |page|
|
|
|
25
25
|
right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
end
|
|
30
|
-
|
|
30
|
+
# , paramNameForFormData: 'formData', onSubmit: ->(action) do
|
|
31
|
+
# action.http_post url: json_ui_garage_url(path: 'forms/generic_post')
|
|
32
|
+
# end
|
|
33
|
+
|
|
31
34
|
end
|
|
@@ -12,12 +12,14 @@ json_ui_page json do |page|
|
|
|
12
12
|
selectedOptions: [ { value: 'id3', text: 'Item 3' } ],
|
|
13
13
|
url: json_ui_garage_url(path: 'forms/dynamic_select_data')
|
|
14
14
|
|
|
15
|
+
form.spacer height: 14
|
|
15
16
|
form.fields_dynamicSelect name: 'user[preferred_languages][]', width: 'matchParent', label: 'Preferred Languages',
|
|
16
17
|
# value: ['id3', 'id5'], multiple: true,
|
|
17
18
|
selectedOptions: [ { value: 'id3', text: 'Item 3' }, { value: 'id5', text: 'Item 5' } ],
|
|
18
19
|
url: json_ui_garage_url(path: 'forms/dynamic_select_data'),
|
|
19
20
|
multiple: true
|
|
20
21
|
|
|
22
|
+
form.spacer height: 14
|
|
21
23
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
22
24
|
end
|
|
23
25
|
end
|
|
@@ -13,28 +13,11 @@ json.rows do
|
|
|
13
13
|
json.child! do
|
|
14
14
|
index = page * count_per_page + i
|
|
15
15
|
json.template 'thumbnail'
|
|
16
|
-
json.title "City #{index}"
|
|
16
|
+
json.title "City #{index} (#{params[:q]})"
|
|
17
17
|
json.subtitle "State #{index}"
|
|
18
18
|
json.subsubtitle "Country #{index}"
|
|
19
19
|
json.value "id#{index}"
|
|
20
20
|
json.text "Item #{index}"
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
-
|
|
24
|
-
# languages = {
|
|
25
|
-
# 'zh-HK' => 'Hong Kong',
|
|
26
|
-
# 'zh-TW' => 'Taiwan',
|
|
27
|
-
# 'zh-CN' => 'China',
|
|
28
|
-
# 'ja-JP' => 'Japan',
|
|
29
|
-
# 'ko-KR' => 'Korea',
|
|
30
|
-
# 'ru-RU' => 'Russian',
|
|
31
|
-
# 'en-PH' => 'Philippines'
|
|
32
|
-
# }
|
|
33
|
-
# languages.each do |k, v|
|
|
34
|
-
# json.child! do
|
|
35
|
-
# json.value k
|
|
36
|
-
# json.text v
|
|
37
|
-
# end
|
|
38
|
-
# end
|
|
39
|
-
|
|
40
23
|
end
|
|
@@ -5,8 +5,17 @@ json_ui_page json do |page|
|
|
|
5
5
|
|
|
6
6
|
page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
|
7
7
|
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Search', styleClasses: ['outlined', 'rounded']
|
|
8
|
+
|
|
9
|
+
form.spacer height: 14
|
|
8
10
|
form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password', placeholder: 'Type your password', styleClass: 'outlined'
|
|
9
11
|
|
|
12
|
+
form.spacer height: 14
|
|
13
|
+
form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
|
|
14
|
+
|
|
15
|
+
form.spacer height: 14
|
|
16
|
+
form.fields_stripeToken name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
|
|
17
|
+
|
|
18
|
+
form.spacer height: 14
|
|
10
19
|
form.panels_split width: 'matchParent', content: ->(split) do
|
|
11
20
|
# split.left childViews: ->(left) do
|
|
12
21
|
# if params[:mode] == 'dialog'
|
|
@@ -1,19 +1,63 @@
|
|
|
1
1
|
json.title 'Forms'
|
|
2
2
|
|
|
3
|
-
json_ui_page json
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post'), method: 'post', childViews: ->(form) do
|
|
7
8
|
form.label text: 'These buttons get disabled on submit'
|
|
8
|
-
form.spacer height:
|
|
9
|
+
form.spacer height: 14
|
|
9
10
|
form.button text: 'Normal Button', onClick: ->(action) { action.forms_submit }
|
|
10
|
-
form.spacer height:
|
|
11
|
+
form.spacer height: 14
|
|
11
12
|
form.fields_submit text: 'Submit Button'
|
|
12
13
|
|
|
13
|
-
# This needs to be long enough that the FAB is roughly at the bottom of a mobile screen.
|
|
14
|
-
# Ideally the spacer can expand dynamically depending on available space.
|
|
15
|
-
form.spacer height: 400
|
|
16
|
-
|
|
17
14
|
form.fab icon: 'send', onClick: ->(action) { action.forms_submit }
|
|
18
15
|
end
|
|
16
|
+
|
|
17
|
+
scroll.spacer height: 14
|
|
18
|
+
|
|
19
|
+
scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'slow_open'), method: 'post', childViews: ->(form) do
|
|
20
|
+
form.fields_submit text: 'Submit button with slow window/open'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
scroll.spacer height: 14
|
|
24
|
+
|
|
25
|
+
scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'slow_openWeb'), method: 'post', childViews: ->(form) do
|
|
26
|
+
form.fields_submit text: 'Submit button with slow window/openWeb'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
scroll.spacer height: 14
|
|
30
|
+
|
|
31
|
+
scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'timeout_once'), method: 'post', childViews: ->(form) do
|
|
32
|
+
form.fields_submit text: 'Submit Button with timeouts/set once'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
scroll.spacer height: 14
|
|
36
|
+
|
|
37
|
+
scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'timeout_chain', count: 0), method: 'post', childViews: ->(form) do
|
|
38
|
+
form.fields_submit text: 'Submit Button with timeouts/set chain'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# This needs to be long enough that the FAB is roughly at the bottom of a mobile screen.
|
|
42
|
+
# Ideally the spacer can expand dynamically depending on available space.
|
|
43
|
+
scroll.spacer height: 400
|
|
44
|
+
|
|
19
45
|
end
|
|
46
|
+
|
|
47
|
+
# page.form url: json_ui_garage_url(path: 'forms/submission_indicator_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
|
|
48
|
+
# form.label text: 'These buttons get disabled on submit'
|
|
49
|
+
# form.spacer height: 10
|
|
50
|
+
# form.button text: 'Normal Button', onClick: ->(action) { action.forms_submit }
|
|
51
|
+
# form.spacer height: 10
|
|
52
|
+
# form.fields_submit text: 'Submit Button'
|
|
53
|
+
|
|
54
|
+
# # This needs to be long enough that the FAB is roughly at the bottom of a mobile screen.
|
|
55
|
+
# # Ideally the spacer can expand dynamically depending on available space.
|
|
56
|
+
# form.spacer height: 400
|
|
57
|
+
|
|
58
|
+
# form.fab icon: 'send', onClick: ->(action) { action.forms_submit }
|
|
59
|
+
# end
|
|
60
|
+
|
|
61
|
+
# page.form url: json_ui_garage_url(path: 'forms/submission_indicator_post', timeout: true), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
|
|
62
|
+
# form.fields_submit text: 'Submit Button with Timeout'
|
|
63
|
+
# end
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
sleep 0.5
|
|
2
2
|
|
|
3
3
|
json_ui_response json do |action|
|
|
4
|
-
|
|
4
|
+
case params[:mode]
|
|
5
|
+
when 'timeout_once'
|
|
6
|
+
action.timeouts_set interval: 2000, onTimeout: ->(subaction) do
|
|
7
|
+
subaction.dialogs_alert message: 'Success!'
|
|
8
|
+
end
|
|
9
|
+
when 'timeout_chain'
|
|
10
|
+
count = params[:count].to_i
|
|
11
|
+
if count > 3
|
|
12
|
+
action.dialogs_alert message: 'Success!'
|
|
13
|
+
else
|
|
14
|
+
action.timeouts_set interval: 500, onTimeout: ->(subaction) do
|
|
15
|
+
subaction.http_post url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'timeout_chain', count: count + 1)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
when 'slow_open'
|
|
19
|
+
action.windows_open url: json_ui_garage_url(path: 'home/slow')
|
|
20
|
+
when 'slow_openWeb'
|
|
21
|
+
action.windows_openWeb url: 'https://www.google.com'
|
|
22
|
+
else
|
|
23
|
+
action.dialogs_alert message: 'Success!'
|
|
24
|
+
end
|
|
5
25
|
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
sleep 2.0
|
|
2
|
+
|
|
3
|
+
json.title 'Menu'
|
|
4
|
+
|
|
5
|
+
json_ui_page json do |page|
|
|
6
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: false
|
|
7
|
+
|
|
8
|
+
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
9
|
+
scroll.label text: 'Blank page'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -23,13 +23,16 @@ else
|
|
|
23
23
|
# json_body_with_list json, nil, nil, options do
|
|
24
24
|
# render 'json_ui/garage/lists/infinite_scroll_section', json: json, page: page
|
|
25
25
|
# end
|
|
26
|
-
|
|
27
|
-
json_ui_page json
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
|
|
27
|
+
page = json_ui_page json
|
|
28
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
29
|
+
|
|
30
|
+
page.list nextPage: next_page, firstSection: ->(section) do
|
|
31
|
+
render 'json_ui/garage/lists/infinite_scroll_section', json: json, page: page_index
|
|
32
|
+
end, onScrollToBottom: ->(action) do
|
|
33
|
+
action.snackbars_alert message: 'Scrolled to Bottom'
|
|
34
|
+
end, onScrollToTop: ->(action) do
|
|
35
|
+
action.snackbars_alert message: 'Scrolled to Top'
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
end
|
|
@@ -2,18 +2,18 @@ json.title 'Pages'
|
|
|
2
2
|
|
|
3
3
|
json_ui_page json do |page|
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
page.list sections: [
|
|
7
7
|
->(section) do
|
|
8
8
|
section.rows builder: ->(template) do
|
|
9
9
|
template.thumbnail title: 'Hamburger Layout', onClick: ->(action) do
|
|
10
10
|
action.windows_open url: json_ui_garage_url(path: 'pages/layout')
|
|
11
11
|
end
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
template.thumbnail title: 'Full Width/Height', onClick: ->(action) do
|
|
14
14
|
action.windows_open url: json_ui_garage_url(path: 'pages/full_width_height')
|
|
15
15
|
end
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
template.thumbnail title: 'Tab Bar', onClick: ->(action) do
|
|
18
18
|
action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar')
|
|
19
19
|
end
|
|
@@ -21,6 +21,10 @@ json_ui_page json do |page|
|
|
|
21
21
|
template.thumbnail title: 'Nav Buttons', onClick: ->(action) do
|
|
22
22
|
action.windows_open url: json_ui_garage_url(path: 'pages/nav_buttons')
|
|
23
23
|
end
|
|
24
|
+
|
|
25
|
+
template.thumbnail title: 'Loading Indicator', onClick: ->(action) do
|
|
26
|
+
action.windows_open url: json_ui_garage_url(path: 'pages/loading_indicator')
|
|
27
|
+
end
|
|
24
28
|
end
|
|
25
29
|
end,
|
|
26
30
|
->(section) do
|
|
@@ -32,12 +36,12 @@ json_ui_page json do |page|
|
|
|
32
36
|
template.thumbnail title: 'Flat Centered', onClick: ->(action) do
|
|
33
37
|
action.windows_open url: json_ui_garage_url(path: 'pages/flat_centered')
|
|
34
38
|
end
|
|
35
|
-
|
|
39
|
+
|
|
36
40
|
template.thumbnail title: 'Full Width', onClick: ->(action) do
|
|
37
41
|
action.windows_open url: json_ui_garage_url(path: 'pages/full_width')
|
|
38
42
|
end
|
|
39
43
|
end
|
|
40
44
|
end
|
|
41
45
|
]
|
|
42
|
-
|
|
46
|
+
|
|
43
47
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
sleep 1
|
|
2
|
+
|
|
3
|
+
json.title 'Pages'
|
|
4
|
+
|
|
5
|
+
page = json_ui_page json
|
|
6
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
7
|
+
|
|
8
|
+
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
9
|
+
scroll.label text: 'On the web, the loading indicator should be show on the browser tab.'
|
|
10
|
+
end
|
data/lib/glib-web.rb
CHANGED
data/lib/glib/crypt.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative './crypt/utils'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Glib
|
|
2
|
+
module Crypt
|
|
3
|
+
class Utils
|
|
4
|
+
def self.encrypt(original_message, encryption_secret, encryption_salt)
|
|
5
|
+
encryptor = message_encryptor(encryption_secret, encryption_salt)
|
|
6
|
+
CGI.escape(encryptor.encrypt_and_sign(original_message))
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.decrypt(encrypted_message, encryption_secret, encryption_salt)
|
|
10
|
+
encryptor = message_encryptor(encryption_secret, encryption_salt)
|
|
11
|
+
begin
|
|
12
|
+
encryptor.decrypt_and_verify(CGI.unescape(encrypted_message))
|
|
13
|
+
rescue ActiveSupport::MessageEncryptor::InvalidMessage
|
|
14
|
+
nil
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
def self.message_encryptor(encryption_secret, encryption_salt)
|
|
20
|
+
key_generator = ActiveSupport::KeyGenerator.new(encryption_secret, iterations: 1000)
|
|
21
|
+
key_secret = key_generator.generate_key(encryption_salt, 32)
|
|
22
|
+
ActiveSupport::MessageEncryptor.new(key_secret, digest: 'SHA1', serializer: JSON)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/glib/dynamic_text.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require_relative './dynamic_text/config'
|
|
1
|
+
require_relative './dynamic_text/config'
|
|
@@ -5,11 +5,11 @@ module Glib
|
|
|
5
5
|
@http = http
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def click
|
|
8
|
+
def click(object)
|
|
9
9
|
@http.router.step(@http, object)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def crawl
|
|
12
|
+
def crawl(views)
|
|
13
13
|
@http.router.crawl_multiple views, ->(view) do
|
|
14
14
|
click view
|
|
15
15
|
end
|
|
@@ -17,4 +17,4 @@ module Glib
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
end
|
|
20
|
-
end
|
|
20
|
+
end
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
module Glib
|
|
2
2
|
module JsonCrawler
|
|
3
3
|
class FormsSubmit < ActionCrawler
|
|
4
|
-
def initialize(http,
|
|
4
|
+
def initialize(http, form)
|
|
5
5
|
super(http)
|
|
6
6
|
|
|
7
|
+
raise 'Submit action needs to be inside a form' unless form
|
|
8
|
+
|
|
7
9
|
@http = http
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
method = form['method']
|
|
12
|
+
action = "forms/#{method}"
|
|
13
|
+
|
|
14
|
+
case method
|
|
10
15
|
when 'patch', 'put'
|
|
11
16
|
submit_update(form, action)
|
|
12
17
|
else
|
|
13
|
-
|
|
18
|
+
url = form['url']
|
|
19
|
+
http.router.log action, url
|
|
14
20
|
end
|
|
15
21
|
end
|
|
16
22
|
|
|
@@ -19,16 +25,24 @@ module Glib
|
|
|
19
25
|
fields = []
|
|
20
26
|
params = {}
|
|
21
27
|
@http.router.crawl_multiple view['childViews'], ->(child) do
|
|
22
|
-
|
|
28
|
+
name = child['view']
|
|
29
|
+
if name.start_with?('fields/')
|
|
23
30
|
fields << child
|
|
24
|
-
|
|
31
|
+
|
|
32
|
+
include_params = case name
|
|
33
|
+
when 'fields/check', 'fields/check-v1'
|
|
34
|
+
child['checked']
|
|
35
|
+
else
|
|
36
|
+
true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
params[child['name']] = child['value'] if include_params
|
|
25
40
|
end
|
|
26
41
|
end
|
|
27
42
|
|
|
28
43
|
json = @http.patch url, action, params
|
|
29
44
|
click(json)
|
|
30
45
|
end
|
|
31
|
-
|
|
32
46
|
end
|
|
33
47
|
end
|
|
34
48
|
end
|
|
@@ -23,6 +23,15 @@ module Glib
|
|
|
23
23
|
Glib::JsonCrawler::Coverage.coverage_files.add(controller.class.instance_method(http.action_name).source_location.first)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
case args['view']
|
|
27
|
+
when 'fields/submit-v1', 'fields/submit'
|
|
28
|
+
@depth += 1
|
|
29
|
+
forms = @visitor.forms
|
|
30
|
+
JsonCrawler::FormsSubmit.new(http, forms.last)
|
|
31
|
+
@depth -= 1
|
|
32
|
+
return
|
|
33
|
+
end
|
|
34
|
+
|
|
26
35
|
if args.is_a?(Hash) && args['rel'] != 'nofollow'
|
|
27
36
|
if (onClick = (args.fetch('onClick', nil) || args.fetch('onResponse', nil)))
|
|
28
37
|
action = onClick['action']
|
|
@@ -31,27 +40,31 @@ module Glib
|
|
|
31
40
|
|
|
32
41
|
if action.present?
|
|
33
42
|
@depth += 1
|
|
34
|
-
child =
|
|
43
|
+
# child =
|
|
44
|
+
case action
|
|
35
45
|
when 'initiate_navigation'
|
|
36
46
|
@read_only_actions.add([action, params['url']])
|
|
37
47
|
JsonCrawler::NavInitiate.new(http, params, action)
|
|
38
|
-
when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1'
|
|
48
|
+
when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open', 'dialogs/open', 'windows/reload'
|
|
39
49
|
@read_only_actions.add([action, params['url']])
|
|
40
50
|
JsonCrawler::WindowsOpen.new(http, params, action)
|
|
41
|
-
when 'http/post-v1'
|
|
51
|
+
when 'http/post-v1', 'http/post'
|
|
42
52
|
JsonCrawler::ActionHttp.new(:post, http, params, action)
|
|
43
|
-
when 'forms/submit-v1'
|
|
53
|
+
when 'forms/submit-v1', 'forms/submit'
|
|
44
54
|
forms = @visitor.forms
|
|
45
|
-
raise 'Submit action needs to be inside a form' if forms.size < 1
|
|
46
|
-
JsonCrawler::FormsSubmit.new(http,
|
|
55
|
+
# raise 'Submit action needs to be inside a form' if forms.size < 1
|
|
56
|
+
JsonCrawler::FormsSubmit.new(http, forms.last)
|
|
47
57
|
else
|
|
48
|
-
unless [
|
|
58
|
+
unless [
|
|
59
|
+
'http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1',
|
|
60
|
+
'http/delete', 'dialogs/oauth', 'windows/openWeb'
|
|
61
|
+
].include?(action)
|
|
49
62
|
@read_only_actions.add([action, params['url']])
|
|
50
63
|
end
|
|
51
64
|
self.log action, params['url']
|
|
52
65
|
end
|
|
53
66
|
@depth -= 1
|
|
54
|
-
child
|
|
67
|
+
# child
|
|
55
68
|
end
|
|
56
69
|
end
|
|
57
70
|
end
|
|
@@ -74,4 +87,3 @@ module Glib
|
|
|
74
87
|
end
|
|
75
88
|
end
|
|
76
89
|
end
|
|
77
|
-
|
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.4.
|
|
4
|
+
version: 0.4.71
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
@@ -101,6 +101,7 @@ files:
|
|
|
101
101
|
- app/models/glib/dynamic_text_record.rb
|
|
102
102
|
- app/models/glib/text.rb
|
|
103
103
|
- app/policies/glib/application_policy.rb
|
|
104
|
+
- app/validators/email_typo_validator.rb
|
|
104
105
|
- app/validators/email_validator.rb
|
|
105
106
|
- app/validators/url_validator.rb
|
|
106
107
|
- app/views/app/views/json_ui/vue/renderer.html.erb
|
|
@@ -108,6 +109,7 @@ files:
|
|
|
108
109
|
- app/views/json_ui/garage/actions/_dialogs.json.jbuilder
|
|
109
110
|
- app/views/json_ui/garage/actions/_sheets.json.jbuilder
|
|
110
111
|
- app/views/json_ui/garage/actions/_snackbars.json.jbuilder
|
|
112
|
+
- app/views/json_ui/garage/actions/_timeouts.json.jbuilder
|
|
111
113
|
- app/views/json_ui/garage/actions/_windows.json.jbuilder
|
|
112
114
|
- app/views/json_ui/garage/actions/index.json.jbuilder
|
|
113
115
|
- app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder
|
|
@@ -134,6 +136,7 @@ files:
|
|
|
134
136
|
- app/views/json_ui/garage/forms/text_validation.json.jbuilder
|
|
135
137
|
- app/views/json_ui/garage/home/blank.json.jbuilder
|
|
136
138
|
- app/views/json_ui/garage/home/index.json.jbuilder
|
|
139
|
+
- app/views/json_ui/garage/home/slow.json.jbuilder
|
|
137
140
|
- app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder
|
|
138
141
|
- app/views/json_ui/garage/lists/edit_actions.json.jbuilder
|
|
139
142
|
- app/views/json_ui/garage/lists/fab.json.jbuilder
|
|
@@ -147,6 +150,7 @@ files:
|
|
|
147
150
|
- app/views/json_ui/garage/pages/full_width_height.json.jbuilder
|
|
148
151
|
- app/views/json_ui/garage/pages/index.json.jbuilder
|
|
149
152
|
- app/views/json_ui/garage/pages/layout.json.jbuilder
|
|
153
|
+
- app/views/json_ui/garage/pages/loading_indicator.json.jbuilder
|
|
150
154
|
- app/views/json_ui/garage/pages/nav_buttons.json.jbuilder
|
|
151
155
|
- app/views/json_ui/garage/pages/tab_bar.json.jbuilder
|
|
152
156
|
- app/views/json_ui/garage/panels/_styled.json.jbuilder
|
|
@@ -191,6 +195,8 @@ files:
|
|
|
191
195
|
- lib/generators/templates/database.yml
|
|
192
196
|
- lib/generators/templates/dynamic_text.rb
|
|
193
197
|
- lib/glib-web.rb
|
|
198
|
+
- lib/glib/crypt.rb
|
|
199
|
+
- lib/glib/crypt/utils.rb
|
|
194
200
|
- lib/glib/dynamic_text.rb
|
|
195
201
|
- lib/glib/dynamic_text/config.rb
|
|
196
202
|
- lib/glib/engine.rb
|