glib-web 0.5.13 → 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 +5 -5
- data/app/controllers/concerns/glib/json/traversal.rb +2 -1
- 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 +10 -0
- data/app/helpers/glib/json_ui/list_builders.rb +18 -4
- data/app/helpers/glib/json_ui/menu_builder.rb +11 -6
- data/app/helpers/glib/json_ui/page_helper.rb +10 -0
- data/app/helpers/glib/json_ui/response_helper.rb +0 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +2 -0
- data/app/helpers/glib/json_ui/view_builder/panels.rb +14 -1
- data/app/views/json_ui/garage/_nav_menu.json.jbuilder +0 -1
- data/app/views/json_ui/garage/actions/_http.json.jbuilder +9 -3
- data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -1
- data/app/views/json_ui/garage/actions/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/basic.json.jbuilder +2 -14
- data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +31 -16
- 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/{_infinite_scroll_section.json.jbuilder → _autoload_section.json.jbuilder} +4 -2
- data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +32 -0
- data/app/views/json_ui/garage/lists/{infinite_scroll.json.jbuilder → autoload_as_needed.json.jbuilder} +9 -12
- data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +112 -0
- data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +25 -1
- data/app/views/json_ui/garage/lists/fab.json.jbuilder +6 -8
- data/app/views/json_ui/garage/lists/index.json.jbuilder +9 -3
- data/app/views/json_ui/garage/notifications/android_post.json.jbuilder +48 -0
- data/app/views/json_ui/garage/notifications/index.json.jbuilder +14 -0
- data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +4 -16
- data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +6 -2
- data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +15 -10
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +13 -2
- 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 +18 -6
- data/app/views/json_ui/garage/views/icons.json.jbuilder +1439 -11
- data/app/views/json_ui/garage/views/index.json.jbuilder +6 -3
- data/app/views/layouts/json_ui/renderer.html.erb +7 -4
- data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +1 -1
- data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +1 -1
- data/lib/generators/templates/dynamic_text.rb +1 -1
- data/lib/glib-web.rb +5 -5
- data/lib/glib/engine.rb +1 -1
- data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +4 -4
- data/lib/glib/json_crawler/http.rb +1 -1
- data/lib/glib/test_helpers.rb +3 -3
- data/lib/glib/value.rb +1 -1
- data/lib/glib/version.rb +2 -2
- data/lib/tasks/db.rake +11 -11
- metadata +7 -5
- data/app/views/app/views/json_ui/vue/renderer.html.erb +0 -35
@@ -0,0 +1,112 @@
|
|
1
|
+
json.title 'Lists'
|
2
|
+
|
3
|
+
liked = params[:liked] == 'true'
|
4
|
+
|
5
|
+
page = json_ui_page json
|
6
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
7
|
+
|
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
|
28
|
+
section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
|
29
|
+
header.h3 text: 'Chat with John Doe'
|
30
|
+
end
|
31
|
+
|
32
|
+
section.rows builder: ->(template) do
|
33
|
+
# template.thumbnail title: "windows/reload (timestamp: #{DateTime.current.to_i}) -- #{liked}", onClick: ->(action) do
|
34
|
+
# action.windows_reload
|
35
|
+
# end, onLongPress: ->(action) do
|
36
|
+
# action.sheets_select message: "Context Menu (#{DateTime.current.to_i})", buttons: ->(menu) do
|
37
|
+
# if liked
|
38
|
+
# menu.button text: 'Cancel 👍', onClick: ->(subaction) do
|
39
|
+
# subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: false)
|
40
|
+
# end
|
41
|
+
# else
|
42
|
+
# menu.button text: 'Give 👍', onClick: ->(subaction) do
|
43
|
+
# subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: true)
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
|
49
|
+
template.commentOutgoing subtitle: 'Hey!', subsubtitle: l(10.minutes.ago, format: :short), imageUrl: glib_json_image_standard_url, chips: ->(menu) do
|
50
|
+
menu.button text: '😊 2', styleClass: 'info'
|
51
|
+
end
|
52
|
+
|
53
|
+
template.commentOutgoing subtitle: 'How are you?', subsubtitle: l(DateTime.current, format: :short)
|
54
|
+
|
55
|
+
template.commentIncoming title: 'John Doe', subtitle: 'Very well', subsubtitle: l(7.minutes.ago, format: :short), imageUrl: glib_json_image_standard_url, chips: ->(menu) do
|
56
|
+
menu.button text: "👍 #{liked ? 2 : 1}"
|
57
|
+
end, onLongPress: ->(action) do
|
58
|
+
action.sheets_select message: 'Context Menu', buttons: ->(menu) do
|
59
|
+
if liked
|
60
|
+
menu.button text: 'Cancel 👍', onClick: ->(subaction) do
|
61
|
+
subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat_ui', liked: false)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
menu.button text: 'Give 👍', onClick: ->(subaction) do
|
65
|
+
subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat_ui', liked: true)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
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
|
+
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
|
+
json.action "ws/push"
|
95
|
+
json.topic "rooms"
|
96
|
+
json.event "create_comment"
|
97
|
+
json.payload({
|
98
|
+
"room_id": "30",
|
99
|
+
"user_id": "2"
|
100
|
+
})
|
101
|
+
|
102
|
+
end, childViews: ->(form) do
|
103
|
+
form.fields_text name: 'user[message]', width: 'matchParent', label: 'Message'
|
104
|
+
|
105
|
+
form.panels_split width: 'matchParent', content: ->(split) do
|
106
|
+
split.right childViews: ->(right) do
|
107
|
+
right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -2,7 +2,7 @@ json.title 'Lists'
|
|
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.list firstSection: ->(section) do
|
7
7
|
section.rows builder: ->(template) do
|
8
8
|
template.thumbnail title: 'Click menu (web) or swipe left (Android/iOS)', editButtons: ->(menu) do
|
@@ -13,6 +13,30 @@ json_ui_page json do |page|
|
|
13
13
|
action.dialogs_alert message: 'Perform action'
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
template.thumbnail title: 'Long press to get an alert', onLongPress: ->(action) do
|
18
|
+
action.dialogs_alert message: 'This is an alert'
|
19
|
+
end
|
20
|
+
|
21
|
+
template.thumbnail title: 'Long press to see menu', onLongPress: ->(action) do
|
22
|
+
action.sheets_select message: 'Context Menu', buttons: ->(menu) do
|
23
|
+
menu.button icon: 'edit', text: 'Edit', onClick: ->(subaction) do
|
24
|
+
subaction.dialogs_alert message: 'Perform action'
|
25
|
+
end
|
26
|
+
menu.button icon: 'delete', text: 'Delete', onClick: ->(subaction) do
|
27
|
+
subaction.dialogs_alert message: 'Perform action'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# template.thumbnail title: 'Long press to see menu', contextButtons: ->(menu) do
|
33
|
+
# menu.button text: 'Edit', onClick: ->(action) do
|
34
|
+
# action.dialogs_alert message: 'Perform action'
|
35
|
+
# end
|
36
|
+
# menu.button text: 'Delete', onClick: ->(action) do
|
37
|
+
# action.dialogs_alert message: 'Perform action'
|
38
|
+
# end
|
39
|
+
# end
|
16
40
|
end
|
17
41
|
|
18
42
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
json.title 'Lists'
|
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
|
-
body.fab icon: 'add', onClick: ->(action) { action.dialogs_alert message: 'Perform action' }
|
6
|
+
page.body childViews: ->(body) do
|
7
|
+
body.fab icon: 'add', onClick: ->(action) { action.dialogs_alert message: 'Perform action' }
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
body.panels_list width: 'matchParent', firstSection: ->(section) do
|
10
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: 0
|
13
11
|
end
|
14
12
|
end
|
@@ -11,12 +11,18 @@ json_ui_page json do |page|
|
|
11
11
|
template.thumbnail title: 'Edit Actions', onClick: ->(action) do
|
12
12
|
action.windows_open url: json_ui_garage_url(path: 'lists/edit_actions')
|
13
13
|
end
|
14
|
-
template.thumbnail title: 'Infinite Scroll', onClick: ->(action) do
|
15
|
-
action.windows_open url: json_ui_garage_url(path: 'lists/infinite_scroll')
|
16
|
-
end
|
17
14
|
template.thumbnail title: 'FAB (Floating Action Button)', onClick: ->(action) do
|
18
15
|
action.windows_open url: json_ui_garage_url(path: 'lists/fab')
|
19
16
|
end
|
17
|
+
template.thumbnail title: 'Chat UI', onClick: ->(action) do
|
18
|
+
action.windows_open url: json_ui_garage_url(path: 'lists/chat_ui')
|
19
|
+
end
|
20
|
+
template.thumbnail title: 'Autoload as Needed', onClick: ->(action) do
|
21
|
+
action.windows_open url: json_ui_garage_url(path: 'lists/autoload_as_needed')
|
22
|
+
end
|
23
|
+
template.thumbnail title: 'Autoload All', onClick: ->(action) do
|
24
|
+
action.windows_open url: json_ui_garage_url(path: 'lists/autoload_all')
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
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
|
+
}
|
30
|
+
}
|
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
|
39
|
+
else
|
40
|
+
message = 'FCM gem needed'
|
41
|
+
end
|
42
|
+
else
|
43
|
+
message = 'Env var needed: GCM_SERVER_KEY'
|
44
|
+
end
|
45
|
+
|
46
|
+
json_ui_response json do |action|
|
47
|
+
action.snackbars_alert message: message
|
48
|
+
end
|
@@ -11,6 +11,20 @@ page.list firstSection: ->(section) do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
template.thumbnail title: 'Send Android Notification', onClick: ->(action) do
|
15
|
+
action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
|
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'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
14
28
|
template.thumbnail title: 'WebSocket Real-time Update', onClick: ->(action) do
|
15
29
|
action.windows_open url: json_ui_garage_url(path: 'notifications/web_socket')
|
16
30
|
end
|
@@ -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
|
@@ -2,10 +2,14 @@ batch_count = 30
|
|
2
2
|
items = (1..batch_count)
|
3
3
|
section = page.table_section_builder
|
4
4
|
section.rows objects: items, builder: ->(row, item, index) do
|
5
|
-
row.default cellViews: ->(cell) do
|
5
|
+
row.default colStyles: [{ width: 36 }, {}, {}, {}, { width: 36 }], cellViews: ->(cell) do
|
6
|
+
cell.label text: ''
|
7
|
+
|
6
8
|
column_indexes.each do |i|
|
7
|
-
cell.label text: "Data #{page_index * batch_count + item}"
|
9
|
+
cell.label text: "Data #{page_index * batch_count + item}-#{i}"
|
8
10
|
end
|
11
|
+
|
12
|
+
cell.label text: ''
|
9
13
|
end, onClick: ->(action) do
|
10
14
|
action.windows_open url: json_ui_garage_url(path: 'home/blank')
|
11
15
|
end
|
@@ -10,6 +10,8 @@ column_indexes = (1..3)
|
|
10
10
|
# - for SEO: one URL for a standalone page and one URL for pagination only
|
11
11
|
# - for generic approach, e.g. excluding nav_menu when there is no change
|
12
12
|
if params[:section_only].present?
|
13
|
+
sleep 1
|
14
|
+
|
13
15
|
json.nextPage next_page if page_index < 3
|
14
16
|
json_ui_page json do |page|
|
15
17
|
json.sections do
|
@@ -21,18 +23,21 @@ if params[:section_only].present?
|
|
21
23
|
else
|
22
24
|
json.title 'Tables'
|
23
25
|
|
24
|
-
json_ui_page json
|
25
|
-
|
26
|
-
|
27
|
-
page.table nextPage: next_page, firstSection: ->(section) do
|
28
|
-
section.header cellViews: ->(header) do
|
29
|
-
column_indexes.each do |i|
|
30
|
-
header.label text: "Heading#{i}"
|
31
|
-
end
|
32
|
-
end
|
26
|
+
page = json_ui_page json
|
27
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
33
28
|
|
34
|
-
|
29
|
+
page.table nextPage: next_page, firstSection: ->(section) do
|
30
|
+
section.header cellViews: ->(header) do
|
31
|
+
column_indexes.each do |i|
|
32
|
+
header.label text: "Heading#{i}"
|
33
|
+
end
|
35
34
|
end
|
35
|
+
|
36
|
+
render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
|
37
|
+
end, onScrollToBottom: ->(action) do
|
38
|
+
action.snackbars_alert message: 'Scrolled to Bottom'
|
39
|
+
end, onScrollToTop: ->(action) do
|
40
|
+
action.snackbars_alert message: 'Scrolled to Top'
|
36
41
|
end
|
37
42
|
|
38
43
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
|
2
|
+
col_index = params[:col].to_i
|
2
3
|
page_index = params[:page].to_i
|
3
4
|
next_page = {
|
4
|
-
url: json_ui_garage_url(path: 'tables/autoload_as_needed', page: page_index + 1, section_only: 'v1'),
|
5
|
+
url: json_ui_garage_url(path: 'tables/autoload_as_needed', page: page_index + 1, col: col_index, section_only: 'v1'),
|
5
6
|
autoload: 'asNeeded'
|
6
7
|
}
|
7
8
|
|
8
9
|
page = json_ui_page json
|
9
|
-
|
10
|
+
column_begin = (col_index * 3) + 1
|
11
|
+
column_end = column_begin + 2
|
12
|
+
column_indexes = (column_begin..column_end)
|
10
13
|
|
11
14
|
if params[:section_only].present?
|
12
15
|
sleep 1
|
@@ -24,9 +27,17 @@ else
|
|
24
27
|
|
25
28
|
page.table nextPage: next_page, firstSection: ->(section) do
|
26
29
|
section.header cellViews: ->(header) do
|
30
|
+
header.button icon: "chevron_left", styleClass: 'icon', onClick: ->(action) do
|
31
|
+
action.windows_reload url: json_ui_garage_url(path: 'tables/autoload_as_needed', page: 0, col: col_index - 1)
|
32
|
+
end
|
33
|
+
|
27
34
|
column_indexes.each do |i|
|
28
35
|
header.label text: "Heading#{i}"
|
29
36
|
end
|
37
|
+
|
38
|
+
header.button icon: "chevron_right", styleClass: 'icon', onClick: ->(action) do
|
39
|
+
action.windows_reload url: json_ui_garage_url(path: 'tables/autoload_as_needed', page: 0, col: col_index + 1)
|
40
|
+
end
|
30
41
|
end
|
31
42
|
|
32
43
|
render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
|
@@ -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
|
+
]
|