glib-web 0.5.18 → 0.5.19
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/controllers/concerns/glib/json/ui.rb +5 -8
- data/app/controllers/glib/home_controller.rb +0 -0
- data/app/helpers/glib/json_ui/action_builder.rb +4 -1
- data/app/helpers/glib/json_ui/menu_builder.rb +11 -6
- data/app/helpers/glib/json_ui/page_helper.rb +4 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -1
- data/app/views/json_ui/garage/forms/basic.json.jbuilder +2 -14
- data/app/views/json_ui/garage/forms/pickers.json.jbuilder +0 -0
- data/app/views/json_ui/garage/home/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +23 -7
- data/app/views/json_ui/garage/notifications/android_post.json.jbuilder +38 -46
- data/app/views/json_ui/garage/notifications/index.json.jbuilder +9 -6
- data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +4 -16
- data/app/views/json_ui/garage/tables/index.json.jbuilder +19 -20
- data/app/views/json_ui/garage/tables/layout.json.jbuilder +26 -28
- data/app/views/json_ui/garage/views/banners.json.jbuilder +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97f06c521e0f5efa16bf64c4ba849e86a0c5747899e32880dc596d443b2def46
|
4
|
+
data.tar.gz: 24ffcd3e25128ba56c8e12f34f5b51a7f1669119c3e70d177e389390d3186462
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 383c668d259de6923c5ea2f5792644a52ff2d25d240f950f5b5bc553be180b425a86d93c5a95783c84c54cda02aef15c3d97239ccc80d72ab1fb3bdfdd8c51ed
|
7
|
+
data.tar.gz: c8ccd39d3062284afda5443766c9d42955bdbf120d127bb51b289da78d3c7cde49bc0bcba1b8dfb10b6473082f67c59b192818d991884e01d74b076394530d77
|
@@ -66,12 +66,9 @@ module Glib::Json::Ui
|
|
66
66
|
end
|
67
67
|
|
68
68
|
private
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
# response.body = render_to_string(template: renderer_path, layout: false, content_type: 'text/html', locals: { page: hash, options: options })
|
76
|
-
end
|
69
|
+
def __json_ui_vue(hash, options)
|
70
|
+
renderer_path = options[:renderer_path]
|
71
|
+
@__json_ui_orig_page = response.body
|
72
|
+
response.body = render_to_string(template: renderer_path, layout: 'json_ui/renderer', content_type: 'text/html', locals: { page: hash, options: options })
|
73
|
+
end
|
77
74
|
end
|
File without changes
|
@@ -15,8 +15,8 @@ module Glib
|
|
15
15
|
bool :disabled
|
16
16
|
singleton_array :styleClass, :styleClasses
|
17
17
|
|
18
|
-
def
|
19
|
-
json.
|
18
|
+
def childButtons(block)
|
19
|
+
json.childButtons do
|
20
20
|
block.call page.menu_builder
|
21
21
|
end
|
22
22
|
end
|
@@ -43,10 +43,15 @@ module Glib
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
class MenuLeftBottom < Button
|
47
|
-
|
48
|
-
|
49
|
-
end
|
46
|
+
# class MenuLeftBottom < Button
|
47
|
+
# icon :icon
|
48
|
+
# array :buttons
|
49
|
+
# end
|
50
|
+
|
51
|
+
# class Select < Button
|
52
|
+
# icon :icon
|
53
|
+
# array :buttons
|
54
|
+
# end
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
@@ -89,7 +89,6 @@ class Glib::JsonUi::ViewBuilder
|
|
89
89
|
@childViewsBlock.call(page.view_builder)
|
90
90
|
page.current_form = nil
|
91
91
|
end
|
92
|
-
|
93
92
|
end
|
94
93
|
|
95
94
|
def childViews(block)
|
@@ -98,6 +97,7 @@ class Glib::JsonUi::ViewBuilder
|
|
98
97
|
end
|
99
98
|
|
100
99
|
class List < View
|
100
|
+
hash :ws
|
101
101
|
hash :nextPage
|
102
102
|
action :onScrollToTop
|
103
103
|
action :onScrollToBottom
|
@@ -7,14 +7,6 @@ json_ui_page json do |page|
|
|
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
|
-
# form.panels_split width: 'matchParent', leftViews: ->(split) do
|
11
|
-
# if params[:mode] == 'dialog'
|
12
|
-
# split.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
13
|
-
# end
|
14
|
-
# end, rightViews: ->(split) do
|
15
|
-
# split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
16
|
-
# end
|
17
|
-
|
18
10
|
form.panels_split width: 'matchParent', content: ->(split) do
|
19
11
|
split.left childViews: ->(left) do
|
20
12
|
if params[:mode] == 'dialog'
|
@@ -22,13 +14,9 @@ json_ui_page json do |page|
|
|
22
14
|
end
|
23
15
|
end
|
24
16
|
split.right childViews: ->(right) do
|
25
|
-
right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
17
|
+
# right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
18
|
+
right.fields_submit text: 'Submit'
|
26
19
|
end
|
27
20
|
end
|
28
|
-
|
29
21
|
end
|
30
|
-
# , paramNameForFormData: 'formData', onSubmit: ->(action) do
|
31
|
-
# action.http_post url: json_ui_garage_url(path: 'forms/generic_post')
|
32
|
-
# end
|
33
|
-
|
34
22
|
end
|
File without changes
|
File without changes
|
@@ -5,7 +5,26 @@ 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
|
-
|
8
|
+
json.ws({
|
9
|
+
"socket" => {
|
10
|
+
"endpoint" => "/socket/websocket",
|
11
|
+
"params" => {
|
12
|
+
vsn: '2.0.0',
|
13
|
+
token: 'TOKEN'
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"topic" => "rooms",
|
17
|
+
"events" => [],
|
18
|
+
# "events" => ["new_link_added"],
|
19
|
+
# "header" => {
|
20
|
+
# "user_id" => 2,
|
21
|
+
# "prev_item_id" => nil,
|
22
|
+
# "last_item_id" => nil
|
23
|
+
# }
|
24
|
+
})
|
25
|
+
|
26
|
+
list_ws = { topic: 'rooms', events: ['comments_updated'] }
|
27
|
+
page.list ws: list_ws, firstSection: ->(section) do
|
9
28
|
section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
|
10
29
|
header.h3 text: 'Chat with John Doe'
|
11
30
|
end
|
@@ -73,18 +92,15 @@ page.footer padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: -
|
|
73
92
|
|
74
93
|
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
|
75
94
|
json.action "ws/push"
|
76
|
-
json.topic "
|
77
|
-
json.event "
|
95
|
+
json.topic "rooms"
|
96
|
+
json.event "create_comment"
|
78
97
|
json.payload({
|
79
|
-
"club_id": "2",
|
80
98
|
"room_id": "30",
|
81
99
|
"user_id": "2"
|
82
|
-
# title: "TITLE",
|
83
|
-
# url: "URL"
|
84
100
|
})
|
85
101
|
|
86
102
|
end, childViews: ->(form) do
|
87
|
-
form.fields_text name: 'message
|
103
|
+
form.fields_text name: 'user[message]', width: 'matchParent', label: 'Message'
|
88
104
|
|
89
105
|
form.panels_split width: 'matchParent', content: ->(split) do
|
90
106
|
split.right childViews: ->(right) do
|
@@ -1,54 +1,46 @@
|
|
1
|
-
if (server_key = ENV['GCM_SERVER_KEY'])
|
2
|
-
fcm = FCM.new(server_key)
|
3
1
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
notification: {
|
33
|
-
title: params[:title],
|
34
|
-
body: "Message from server"
|
35
|
-
},
|
36
|
-
data: {
|
37
|
-
channelId: 'default',
|
38
|
-
notificationId: 1,
|
39
|
-
onClick: payload
|
2
|
+
if (server_key = ENV['FCM_SERVER_KEY'])
|
3
|
+
if defined? FCM
|
4
|
+
# Introduce delay so that we have time to place the app to background
|
5
|
+
# before receiving push notification.
|
6
|
+
sleep 2
|
7
|
+
|
8
|
+
fcm = FCM.new(server_key)
|
9
|
+
registration_ids = [params[:token]] # An array of one or more client registration tokens
|
10
|
+
|
11
|
+
payload = json_ui_action_payload do |action|
|
12
|
+
action.dialogs_alert message: 'Opened'
|
13
|
+
end
|
14
|
+
|
15
|
+
# See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages for all available options.
|
16
|
+
options = {
|
17
|
+
notification: {
|
18
|
+
title: params[:title],
|
19
|
+
body: 'Message from server'
|
20
|
+
# title: 'Offer from Ajisen Ramen',
|
21
|
+
# body: 'Free side order of Gyoza'
|
22
|
+
},
|
23
|
+
data: {
|
24
|
+
channelId: 'default',
|
25
|
+
notificationId: 1,
|
26
|
+
openUrl: json_ui_garage_url(path: 'home/blank'),
|
27
|
+
onOpen: payload
|
28
|
+
# openUrl: 'http://10.0.2.2:3000/offers.json?_render=v1',
|
29
|
+
}
|
40
30
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
31
|
+
response = fcm.send(registration_ids, options)
|
32
|
+
|
33
|
+
body = JSON.parse(response[:body])
|
34
|
+
if (errors = body['results'].map { |i| i['error'] }.compact).any?
|
35
|
+
message = errors.join(', ')
|
36
|
+
else
|
37
|
+
message = 'Sent'
|
38
|
+
end
|
47
39
|
else
|
48
|
-
message = '
|
40
|
+
message = 'FCM gem needed'
|
49
41
|
end
|
50
42
|
else
|
51
|
-
message = '
|
43
|
+
message = 'Env var needed: GCM_SERVER_KEY'
|
52
44
|
end
|
53
45
|
|
54
46
|
json_ui_response json do |action|
|
@@ -13,12 +13,15 @@ page.list firstSection: ->(section) do
|
|
13
13
|
|
14
14
|
template.thumbnail title: 'Send Android Notification', onClick: ->(action) do
|
15
15
|
action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
|
16
|
-
subaction.devices_getPushToken paramNameForToken: 'formData[token]', onGet: ->(subsubaction) do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
16
|
+
# subaction.devices_getPushToken paramNameForToken: 'formData[token]', onGet: ->(subsubaction) do
|
17
|
+
# formData = {
|
18
|
+
# title: 'Title from formData'
|
19
|
+
# }
|
20
|
+
# subsubaction.http_post url: json_ui_garage_url(path: 'notifications/android_post'), formData: formData
|
21
|
+
# end
|
22
|
+
|
23
|
+
post_url = json_ui_garage_url(path: 'notifications/android_post', title: 'Title from formData')
|
24
|
+
subaction.devices_getPushToken postUrl: post_url, paramNameForToken: 'token'
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -4,30 +4,18 @@ page = json_ui_page json
|
|
4
4
|
|
5
5
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
6
6
|
|
7
|
-
page.navBar backgroundColor: '#a8c4e3', rightButtons: ->(menu) do
|
8
|
-
menu.button icon: 'search', onClick: ->(action) do
|
7
|
+
page.navBar backgroundColor: '#a8c4e3', color: '#ffffff', rightButtons: ->(menu) do
|
8
|
+
menu.button icon: 'search', onClick: ->(action) do
|
9
9
|
action.dialogs_alert message: 'Perform some action'
|
10
10
|
end
|
11
|
-
menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do
|
11
|
+
menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do
|
12
12
|
action.dialogs_alert message: 'Perform some action'
|
13
13
|
end
|
14
|
-
menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do
|
14
|
+
menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do
|
15
15
|
action.dialogs_alert message: 'Perform some action'
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
# page.rightNavButtons do |menu|
|
20
|
-
# menu.button icon: 'search', onClick: ->(action) do
|
21
|
-
# action.dialogs_alert message: 'Perform some action'
|
22
|
-
# end
|
23
|
-
# menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do
|
24
|
-
# action.dialogs_alert message: 'Perform some action'
|
25
|
-
# end
|
26
|
-
# menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do
|
27
|
-
# action.dialogs_alert message: 'Perform some action'
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
|
31
19
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
32
20
|
scroll.label text: 'See the right menu buttons on the nav bar'
|
33
21
|
end
|
@@ -1,26 +1,25 @@
|
|
1
1
|
json.title 'Tables'
|
2
2
|
|
3
|
-
json_ui_page json
|
4
|
-
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
6
|
+
page.list firstSection: ->(section) do
|
7
|
+
section.rows builder: ->(template) do
|
8
|
+
template.thumbnail title: 'Layout', onClick: ->(action) do
|
9
|
+
action.windows_open url: json_ui_garage_url(path: 'tables/layout')
|
10
|
+
end
|
11
|
+
template.thumbnail title: 'Horizontal Scroll', onClick: ->(action) do
|
12
|
+
action.windows_open url: json_ui_garage_url(path: 'tables/horizontal_scroll')
|
13
|
+
end
|
14
|
+
template.thumbnail title: 'Export/Import', onClick: ->(action) do
|
15
|
+
action.windows_open url: json_ui_garage_url(path: 'tables/export_import')
|
16
|
+
end
|
17
|
+
template.thumbnail title: 'Autoload as Needed', onClick: ->(action) do
|
18
|
+
action.windows_open url: json_ui_garage_url(path: 'tables/autoload_as_needed')
|
19
|
+
end
|
20
|
+
template.thumbnail title: 'Autoload All', onClick: ->(action) do
|
21
|
+
action.windows_open url: json_ui_garage_url(path: 'tables/autoload_all')
|
23
22
|
end
|
24
|
-
|
25
23
|
end
|
24
|
+
|
26
25
|
end
|
@@ -1,38 +1,36 @@
|
|
1
1
|
json.title 'Tables'
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
6
|
+
column_indexes = (1..5)
|
7
|
+
page.table sections: [
|
8
|
+
->(section) do
|
9
|
+
section.rows builder: ->(row) do
|
10
|
+
row.default colSpans: [3, 2], cellViews: ->(cell) do
|
11
|
+
cell.label text: 'Spans 3 columns'
|
12
|
+
cell.panels_horizontal width: 'matchParent', backgroundColor: '#dddddd', padding: { top: 10, right: 10, bottom: 10, left: 10 }, childViews: ->(horizontal) do
|
13
|
+
horizontal.label text: 'Spans 2 columns'
|
15
14
|
end
|
16
15
|
end
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
end
|
17
|
+
end,
|
18
|
+
->(section) do
|
19
|
+
section.header cellViews: ->(header) do
|
20
|
+
column_indexes.each do |i|
|
21
|
+
header.label text: "Heading#{i}"
|
23
22
|
end
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
end, onClick: ->(action) do
|
32
|
-
action.windows_open url: json_ui_garage_url(path: 'home/blank')
|
25
|
+
items = [1, 2, 3]
|
26
|
+
section.rows objects: items, builder: ->(row, item, index) do
|
27
|
+
row.default colStyles: [{ width: 200, backgroundColor: '#eeeeee' }], cellViews: ->(cell) do
|
28
|
+
column_indexes.each do |i|
|
29
|
+
cell.label text: "Data #{item}"
|
33
30
|
end
|
31
|
+
end, onClick: ->(action) do
|
32
|
+
action.windows_open url: json_ui_garage_url(path: 'home/blank')
|
34
33
|
end
|
35
34
|
end
|
36
|
-
|
37
|
-
|
38
|
-
end
|
35
|
+
end
|
36
|
+
]
|
@@ -19,15 +19,27 @@ json_ui_page json do |page|
|
|
19
19
|
scroll.h2 text: 'With select options'
|
20
20
|
scroll.spacer height: 6
|
21
21
|
scroll.banners_select width: 'matchParent', icon: 'info', message: 'This is a select banner', buttons: ->(menu) do
|
22
|
-
menu.button text: '
|
22
|
+
menu.button icon: 'add', text: 'Add', onClick: ->(action) do
|
23
23
|
action.windows_open url: json_ui_garage_url(path: 'home/blank')
|
24
24
|
end
|
25
|
-
menu.button text: '
|
25
|
+
menu.button icon: 'edit', text: 'Edit', onClick: ->(action) do
|
26
26
|
action.windows_open url: json_ui_garage_url(path: 'home/slow')
|
27
27
|
end
|
28
|
-
menu.button text: '
|
28
|
+
menu.button icon: 'delete', text: 'Delete', onClick: ->(action) do
|
29
29
|
action.dialogs_alert message: 'Alert'
|
30
30
|
end
|
31
|
+
|
32
|
+
menu.button icon: 'more_vert', childButtons: ->(submenu) do
|
33
|
+
submenu.button icon: 'add', text: 'Option1', onClick: ->(action) do
|
34
|
+
action.windows_open url: json_ui_garage_url(path: 'home/blank')
|
35
|
+
end
|
36
|
+
submenu.button icon: 'edit', text: 'Option2', onClick: ->(action) do
|
37
|
+
action.windows_open url: json_ui_garage_url(path: 'home/slow')
|
38
|
+
end
|
39
|
+
submenu.button icon: 'delete', text: 'Option3', onClick: ->(action) do
|
40
|
+
action.dialogs_alert message: 'Alert'
|
41
|
+
end
|
42
|
+
end
|
31
43
|
end
|
32
44
|
|
33
45
|
scroll.spacer height: 20
|