glib-web 0.5.26 → 0.5.31
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/json/new_dynamic_text.rb +1 -1
- data/app/helpers/glib/dynamic_texts_helper.rb +1 -1
- data/app/helpers/glib/json_ui/action_builder.rb +8 -0
- data/app/helpers/glib/json_ui/action_builder/http.rb +28 -8
- data/app/helpers/glib/json_ui/view_builder.rb +3 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +4 -1
- data/app/helpers/glib/json_ui/view_builder/panels.rb +3 -1
- data/app/views/json_ui/garage/actions/_http.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/index.json.jbuilder +6 -0
- data/app/views/json_ui/garage/forms/new_rich_text.json.jbuilder +40 -0
- data/app/views/json_ui/garage/forms/pickers.json.jbuilder +4 -4
- data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +3 -3
- data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +9 -8
- data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +2 -21
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +3 -3
- data/lib/glib-web.rb +1 -0
- data/lib/glib/json_crawler/router.rb +3 -0
- data/lib/glib/mailer_tester.rb +36 -0
- data/lib/glib/test_helpers.rb +0 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56bb31a5794bda0312e8b8f9003ec3c04a43db3fdae8d56934edd0a535da9a32
|
4
|
+
data.tar.gz: 4d9011e44c43d8cca90372104ff2bbd240daaa8dc46886ab428be8b7f05afce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad38bdfa2517196a9e4a4ea4a86e4805e06b97d6f973b4708ae3cac8214648c4f85f68226452f5e81b9f1546d0f440c9d41a5366c7f187c7481a9ab20c350c1d
|
7
|
+
data.tar.gz: a3824b557aca434cbd17df66e9a6f32cc669993e17e406ce9184aa405ddd6a2c1a8c982099be21350eba82c57993bc90f62473f2386dbde9c346cffd493ca42a
|
@@ -112,7 +112,7 @@ module Glib::Json::NewDynamicText
|
|
112
112
|
def substitute_image_with(images)
|
113
113
|
view[prop] = view[prop].gsub(/\{\{image(\d)\}\}/) {
|
114
114
|
if image = images[$1.to_i - 1]
|
115
|
-
ApplicationController.helpers.
|
115
|
+
ApplicationController.helpers.glib_dynamic_image_url(image.blob.key)
|
116
116
|
else
|
117
117
|
"{{image#{$1}}}"
|
118
118
|
end
|
@@ -1,18 +1,38 @@
|
|
1
1
|
class Glib::JsonUi::ActionBuilder
|
2
2
|
module Http
|
3
|
-
class
|
3
|
+
class AbstractHttp < Action
|
4
4
|
string :url, cache: true
|
5
|
-
|
5
|
+
|
6
|
+
def formData(hash)
|
7
|
+
form_data = {}
|
8
|
+
hash.each do |key, value|
|
9
|
+
flatten_nested_params(form_data, key, value)
|
10
|
+
end
|
11
|
+
json.formData form_data
|
12
|
+
end
|
13
|
+
|
14
|
+
def flatten_nested_params(form_data, key, value)
|
15
|
+
if value.is_a?(Hash)
|
16
|
+
value.each do |nested_key, nested_value|
|
17
|
+
flatten_nested_params(form_data, "#{key}[#{nested_key}]", nested_value)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
form_data[key] = value
|
21
|
+
end
|
22
|
+
end
|
6
23
|
end
|
7
24
|
|
8
|
-
class
|
9
|
-
string :url, cache: true
|
10
|
-
hash :formData
|
25
|
+
class Post < AbstractHttp
|
11
26
|
end
|
12
27
|
|
13
|
-
class
|
14
|
-
string :url, cache: true
|
15
|
-
hash :formData
|
28
|
+
class Patch < AbstractHttp
|
29
|
+
# string :url, cache: true
|
30
|
+
# hash :formData
|
31
|
+
end
|
32
|
+
|
33
|
+
class Delete < AbstractHttp
|
34
|
+
# string :url, cache: true
|
35
|
+
# hash :formData
|
16
36
|
end
|
17
37
|
|
18
38
|
end
|
@@ -207,7 +207,7 @@ class Glib::JsonUi::ViewBuilder
|
|
207
207
|
date_time :max
|
208
208
|
end
|
209
209
|
|
210
|
-
class
|
210
|
+
class Location < AbstractField
|
211
211
|
hash :latitudeField
|
212
212
|
hash :longitudeField
|
213
213
|
hash :zoomField
|
@@ -217,5 +217,8 @@ class Glib::JsonUi::ViewBuilder
|
|
217
217
|
string :publicKey
|
218
218
|
end
|
219
219
|
|
220
|
+
class CreditCard < AbstractField
|
221
|
+
string :publicKey
|
222
|
+
end
|
220
223
|
end
|
221
224
|
end
|
@@ -6,7 +6,7 @@ end
|
|
6
6
|
section.rows builder: ->(template) do
|
7
7
|
template.thumbnail title: 'http/post', onClick: ->(action) do
|
8
8
|
action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
|
9
|
-
subaction.http_post url: json_ui_garage_url(path: 'forms/basic_post'), formData: {
|
9
|
+
subaction.http_post url: json_ui_garage_url(path: 'forms/basic_post'), formData: { user: { name: { first: 'New', last: 'Joe' } } }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
File without changes
|
@@ -76,6 +76,12 @@ json_ui_page json do |page|
|
|
76
76
|
template.thumbnail title: 'Rich Text Editor', onClick: ->(action) do
|
77
77
|
action.windows_open url: json_ui_garage_url(path: 'forms/rich_text')
|
78
78
|
end
|
79
|
+
end
|
80
|
+
|
81
|
+
section.rows builder: ->(template) do
|
82
|
+
template.thumbnail title: 'New Rich Text Editor', onClick: ->(action) do
|
83
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/new_rich_text')
|
84
|
+
end
|
79
85
|
|
80
86
|
end
|
81
87
|
end, ->(section) do
|
@@ -0,0 +1,40 @@
|
|
1
|
+
json.title 'Forms'
|
2
|
+
|
3
|
+
json_ui_page json do |page|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
|
+
|
6
|
+
page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
|
7
|
+
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
|
8
|
+
|
9
|
+
# images = [
|
10
|
+
# {
|
11
|
+
# value: "eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4",
|
12
|
+
# fileUrl: "https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100"
|
13
|
+
# }
|
14
|
+
# ]
|
15
|
+
# form.fields_richText name: 'user[bio]', width: 'matchParent', label: 'Content', images: images, value: '<p>Test {{image1}}</p>'
|
16
|
+
|
17
|
+
json.child! do
|
18
|
+
json.view 'fields/newRichText-v1'
|
19
|
+
json.width 'matchParent'
|
20
|
+
json.label 'Content'
|
21
|
+
json.name 'user[bio]'
|
22
|
+
json.value '<p>Test {{image1}}</p>'
|
23
|
+
|
24
|
+
json.images do
|
25
|
+
json.child! do
|
26
|
+
json.value "eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4"
|
27
|
+
# json.fileTitle "hita i hanom hg.jpg"
|
28
|
+
json.fileUrl "https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
json.imageUploader do
|
33
|
+
json.accepts(fileType: "image/*", maxFileSize: 5000)
|
34
|
+
json.directUploadUrl rails_direct_uploads_url
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
39
|
+
end
|
40
|
+
end
|
@@ -34,10 +34,10 @@ json_ui_page json do |page|
|
|
34
34
|
form.spacer height: 20
|
35
35
|
form.h2 text: 'Map'
|
36
36
|
form.spacer height: 6
|
37
|
-
form.
|
38
|
-
latitudeField: { name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
|
39
|
-
longitudeField: { name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true },
|
40
|
-
zoomField: { name: 'user[zoom]', label: 'Zoom' }
|
37
|
+
form.fields_location name: 'user[address]', width: 'matchParent', label: 'Type an address', value: 'Sydney Harbour Bridge',
|
38
|
+
latitudeField: { view: 'fields/text', name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
|
39
|
+
longitudeField: { view: 'fields/text', name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true },
|
40
|
+
zoomField: { view: 'fields/text', name: 'user[zoom]', label: 'Zoom' }
|
41
41
|
|
42
42
|
form.spacer height: 20
|
43
43
|
form.fields_submit text: 'Submit'
|
@@ -2,12 +2,12 @@ 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: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
|
7
7
|
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
|
8
8
|
|
9
9
|
# images = [
|
10
|
-
# {
|
10
|
+
# {
|
11
11
|
# value: "eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4",
|
12
12
|
# fileUrl: "https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100"
|
13
13
|
# }
|
@@ -28,7 +28,7 @@ json_ui_page json do |page|
|
|
28
28
|
json.fileUrl "https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100"
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
json.imageUploader do
|
33
33
|
json.accepts(fileType: "image/*", maxFileSize: 5000)
|
34
34
|
json.directUploadUrl rails_direct_uploads_url
|
@@ -12,21 +12,22 @@ json_ui_page json do |page|
|
|
12
12
|
form.spacer height: 14
|
13
13
|
form.fields_textarea name: 'user[bio]', width: 'matchParent', label: 'Bio', placeholder: 'Enter your bio', styleClasses: ['outlined']
|
14
14
|
|
15
|
+
# form.spacer height: 14
|
16
|
+
# form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
|
17
|
+
|
18
|
+
# form.spacer height: 14
|
19
|
+
# form.fields_stripeToken name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
|
20
|
+
|
15
21
|
form.spacer height: 14
|
16
|
-
form.
|
22
|
+
form.fields_creditCard name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
|
17
23
|
|
18
24
|
form.spacer height: 14
|
19
|
-
form.
|
25
|
+
form.fields_creditCard name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
|
20
26
|
|
21
27
|
form.spacer height: 14
|
22
28
|
form.panels_split width: 'matchParent', content: ->(split) do
|
23
|
-
# split.left childViews: ->(left) do
|
24
|
-
# if params[:mode] == 'dialog'
|
25
|
-
# left.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
26
|
-
# end
|
27
|
-
# end
|
28
29
|
split.right childViews: ->(right) do
|
29
|
-
right.
|
30
|
+
right.fields_submit text: 'Submit'
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -5,7 +5,7 @@ liked = params[:liked] == 'true'
|
|
5
5
|
page = json_ui_page json
|
6
6
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
7
7
|
|
8
|
-
json.
|
8
|
+
json.phoenixSocket({
|
9
9
|
"socket" => {
|
10
10
|
"endpoint" => "/socket/websocket",
|
11
11
|
"params" => {
|
@@ -24,7 +24,7 @@ json.ws({
|
|
24
24
|
})
|
25
25
|
|
26
26
|
list_ws = { topic: 'rooms', events: ['comments_updated'] }
|
27
|
-
page.list
|
27
|
+
page.list phoenixSocket: list_ws, firstSection: ->(section) do
|
28
28
|
section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
|
29
29
|
header.h3 text: 'Chat with John Doe'
|
30
30
|
end
|
@@ -71,25 +71,6 @@ page.list ws: list_ws, firstSection: ->(section) do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
page.footer padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(footer) do
|
74
|
-
# json.ws({
|
75
|
-
# "socket" => {
|
76
|
-
# "endpoint" => "/socket/websocket",
|
77
|
-
# "params" => {
|
78
|
-
# vsn: '2.0.0',
|
79
|
-
# token: 'TOKEN'
|
80
|
-
# }
|
81
|
-
# },
|
82
|
-
# # "topic" => "room:30",
|
83
|
-
# # "event" => "comments_updated",
|
84
|
-
# "topic" => "links",
|
85
|
-
# "events" => ["new_link_added"],
|
86
|
-
# "header" => {
|
87
|
-
# "user_id" => 2,
|
88
|
-
# "prev_item_id" => nil,
|
89
|
-
# "last_item_id" => nil
|
90
|
-
# }
|
91
|
-
# })
|
92
|
-
|
93
74
|
footer.panels_form width: 'matchParent', url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, paramNameForFormData: 'formData', onSubmit: ->(action) do
|
94
75
|
json.action "ws/push"
|
95
76
|
json.topic "rooms"
|
@@ -3,7 +3,7 @@ json.title 'Forms'
|
|
3
3
|
page = json_ui_page json
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
json.
|
6
|
+
json.phoenixSocket({
|
7
7
|
"socket" => {
|
8
8
|
"endpoint" => "/socket/websocket",
|
9
9
|
"params" => {
|
@@ -43,7 +43,7 @@ end, childViews: ->(form) do
|
|
43
43
|
|
44
44
|
# TODO: Change this to radio for selecting alert vs reload response
|
45
45
|
form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
|
46
|
-
|
46
|
+
|
47
47
|
form.fields_hidden name: 'baseUrl', width: 'matchParent', value: json_ui_garage_url(path: 'notifications/web_socket')
|
48
48
|
|
49
49
|
form.panels_split width: 'matchParent', content: ->(split) do
|
@@ -56,5 +56,5 @@ end, childViews: ->(form) do
|
|
56
56
|
right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
end
|
data/lib/glib-web.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Glib
|
2
|
+
module MailerTester
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
project_root = Rails.root
|
7
|
+
paths = Dir.glob(project_root + 'test/mailers/previews/*')
|
8
|
+
paths.each do |file|
|
9
|
+
require file
|
10
|
+
end
|
11
|
+
|
12
|
+
ActionMailer::Preview.subclasses.each do |preview_class|
|
13
|
+
preview = preview_class.new
|
14
|
+
|
15
|
+
preview_class.instance_methods(false).each do |mailer_method|
|
16
|
+
test "mailer for #{preview_class}##{mailer_method}" do
|
17
|
+
preview.send(mailer_method).deliver_now
|
18
|
+
|
19
|
+
logfile = File.join(log_dir, "#{preview_class.name.underscore}##{mailer_method}.txt")
|
20
|
+
|
21
|
+
# Use rstrip to avoid trailing space issues
|
22
|
+
expected = File.exist?(logfile) ? File.read(logfile).rstrip : ''
|
23
|
+
last_delivery = ActionMailer::Base.deliveries.last
|
24
|
+
result = last_delivery.html_part.body.raw_source.rstrip
|
25
|
+
|
26
|
+
logger = File.open(logfile, 'w')
|
27
|
+
logger.puts result
|
28
|
+
logger.close
|
29
|
+
|
30
|
+
assert_equal expected, result, "Result mismatch! #{logfile.sub(/\.txt$/, '')}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/glib/test_helpers.rb
CHANGED
File without changes
|
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.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- app/views/json_ui/garage/forms/generic_post.json.jbuilder
|
132
132
|
- app/views/json_ui/garage/forms/get_request.json.jbuilder
|
133
133
|
- app/views/json_ui/garage/forms/index.json.jbuilder
|
134
|
+
- app/views/json_ui/garage/forms/new_rich_text.json.jbuilder
|
134
135
|
- app/views/json_ui/garage/forms/pickers.json.jbuilder
|
135
136
|
- app/views/json_ui/garage/forms/rich_text.json.jbuilder
|
136
137
|
- app/views/json_ui/garage/forms/selects.json.jbuilder
|
@@ -224,6 +225,7 @@ files:
|
|
224
225
|
- lib/glib/json_crawler/coverage.rb
|
225
226
|
- lib/glib/json_crawler/http.rb
|
226
227
|
- lib/glib/json_crawler/router.rb
|
228
|
+
- lib/glib/mailer_tester.rb
|
227
229
|
- lib/glib/test_helpers.rb
|
228
230
|
- lib/glib/value.rb
|
229
231
|
- lib/glib/version.rb
|