glib-web 0.4.67 → 0.4.72
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/glib/json_ui/list_builders.rb +1 -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/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/full_width_height.json.jbuilder +10 -11
- 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
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0537383a32a92f265a5f6c483f710047653915a8'
|
4
|
+
data.tar.gz: f3a05908717cdc7eeb0bc3dfa3c10da75c1362a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a81ef9ef2f78869dd599b78ada3510318da5e2329e1be7eb347db8fd8053f129e476bb71aeff58b7d48b2c12f66e97d8e2ba583100d175e4092b061a59b28f3
|
7
|
+
data.tar.gz: 5221c65c79a617d92e82687cd8d671ea282abfff6d722cba7de3527a78817ead690fc5ac7bfcb5ce18d255b88342e8e0601528dcb906aab36faf7b1ab1d92d55
|
@@ -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
|
@@ -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
|
@@ -1,17 +1,16 @@
|
|
1
1
|
json.title 'Pages'
|
2
2
|
|
3
|
-
json_ui_page json
|
4
|
-
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
page.header padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
|
7
|
+
header.h1 text: 'Header'
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
page.body height: 'matchParent', padding: glib_json_padding_body, childViews: ->(body) do
|
11
|
+
body.button width: 'matchParent', height: 'matchParent', text: 'Full Width/Height'
|
12
|
+
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
14
|
+
page.footer height: 80, padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
|
15
|
+
footer.h1 text: 'Footer'
|
17
16
|
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'
|
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.72
|
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
|
@@ -192,6 +195,8 @@ files:
|
|
192
195
|
- lib/generators/templates/database.yml
|
193
196
|
- lib/generators/templates/dynamic_text.rb
|
194
197
|
- lib/glib-web.rb
|
198
|
+
- lib/glib/crypt.rb
|
199
|
+
- lib/glib/crypt/utils.rb
|
195
200
|
- lib/glib/dynamic_text.rb
|
196
201
|
- lib/glib/dynamic_text/config.rb
|
197
202
|
- lib/glib/engine.rb
|