glib-web 0.5.11 → 0.5.16
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/traversal.rb +2 -1
- data/app/helpers/glib/json_ui/action_builder.rb +3 -0
- data/app/helpers/glib/json_ui/list_builders.rb +18 -4
- data/app/helpers/glib/json_ui/view_builder/panels.rb +13 -0
- data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -1
- 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.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/tables/_autoload_section.json.jbuilder +1 -2
- data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +13 -10
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +3 -1
- 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 +5 -4
- data/app/views/app/views/json_ui/vue/renderer.html.erb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f06e6697837bddfa0e71b0263a7dcc23452aff19
|
4
|
+
data.tar.gz: 57677ef8d290617ca0a3bc935450b9c729113623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bcfd89c5fbc018bb165b5a9c631435117415320c1465ae49a13975e7da3dfccc58f4a182ec9bd90fae1a7f42fd3426842e1a16b3db1e8bdf6b5bd8052e42ffb
|
7
|
+
data.tar.gz: 89d40c161a93ce26a558029697553801d0e5cae50f0c0bc4f7ab7aec619f917e2487478ff741654f326a4d21e2452d61b2c73000bb054d2571aa12d09e98f451
|
@@ -76,8 +76,9 @@ module Glib::Json::Traversal
|
|
76
76
|
# Table/List
|
77
77
|
if (sections = view['sections']).is_a? Array
|
78
78
|
sections.each do |section|
|
79
|
-
|
79
|
+
traverse_vertical_content section['header'], block
|
80
80
|
traverse_multiple section['rows'], block
|
81
|
+
traverse_vertical_content section['footer'], block
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
@@ -7,7 +7,11 @@ module Glib
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class AbstractTemplate < JsonUiElement
|
10
|
-
#
|
10
|
+
# def contextButtons(block)
|
11
|
+
# json.contextButtons do
|
12
|
+
# block.call page.menu_builder
|
13
|
+
# end
|
14
|
+
# end
|
11
15
|
|
12
16
|
def editButtons(block)
|
13
17
|
json.editButtons do
|
@@ -22,12 +26,13 @@ module Glib
|
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
25
|
-
class
|
29
|
+
class Standard < AbstractTemplate
|
26
30
|
string :title
|
27
31
|
string :subtitle
|
28
32
|
string :subsubtitle
|
29
33
|
string :imageUrl
|
30
34
|
action :onClick
|
35
|
+
action :onLongPress
|
31
36
|
icon :icon
|
32
37
|
bool :avatar
|
33
38
|
|
@@ -36,10 +41,19 @@ module Glib
|
|
36
41
|
# views :accessoryViews
|
37
42
|
end
|
38
43
|
|
39
|
-
class Featured <
|
44
|
+
class Featured < Standard
|
40
45
|
end
|
41
46
|
|
42
|
-
class
|
47
|
+
class Thumbnail < Standard
|
48
|
+
end
|
49
|
+
|
50
|
+
class CommentOutgoing < Standard
|
51
|
+
end
|
52
|
+
|
53
|
+
class CommentIncoming < Standard
|
54
|
+
end
|
55
|
+
|
56
|
+
class Custom < Standard
|
43
57
|
string :template
|
44
58
|
|
45
59
|
# TODO: Experimental
|
@@ -164,6 +164,19 @@ class Glib::JsonUi::ViewBuilder
|
|
164
164
|
hash :md
|
165
165
|
hash :sm
|
166
166
|
hash :xs
|
167
|
+
|
168
|
+
hash :xlOnly
|
169
|
+
hash :lgOnly
|
170
|
+
hash :mdOnly
|
171
|
+
hash :smOnly
|
172
|
+
hash :xsOnly
|
173
|
+
|
174
|
+
hash :xlAndDown
|
175
|
+
hash :lgAndDown
|
176
|
+
hash :mdAndDown
|
177
|
+
hash :smAndDown
|
178
|
+
hash :xsAndDown
|
179
|
+
|
167
180
|
views :childViews
|
168
181
|
end
|
169
182
|
|
@@ -10,11 +10,13 @@
|
|
10
10
|
# end
|
11
11
|
# end
|
12
12
|
|
13
|
-
section = json_ui_section json
|
13
|
+
# section = json_ui_section json
|
14
|
+
|
15
|
+
section = page.list_section_builder
|
14
16
|
section.rows builder: ->(row) do
|
15
17
|
batch_count = 30
|
16
18
|
batch_count.times do |i|
|
17
|
-
index =
|
19
|
+
index = page_index * batch_count + i
|
18
20
|
row.thumbnail title: "Item #{index}"
|
19
21
|
end
|
20
22
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
page_index = params[:page].to_i
|
3
|
+
next_page = {
|
4
|
+
url: json_ui_garage_url(path: 'lists/autoload_all', page: page_index + 1, section_only: 'v1'),
|
5
|
+
autoload: 'all'
|
6
|
+
}
|
7
|
+
|
8
|
+
page = json_ui_page json
|
9
|
+
|
10
|
+
if params[:section_only].present?
|
11
|
+
sleep 1
|
12
|
+
|
13
|
+
json.nextPage next_page if page_index < 3
|
14
|
+
json.sections do
|
15
|
+
json.child! do
|
16
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
17
|
+
end
|
18
|
+
end
|
19
|
+
else
|
20
|
+
json.title 'Lists'
|
21
|
+
|
22
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
23
|
+
|
24
|
+
page.list nextPage: next_page, firstSection: ->(section) do
|
25
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
26
|
+
end, onScrollToBottom: ->(action) do
|
27
|
+
action.snackbars_alert message: 'Scrolled to Bottom'
|
28
|
+
end, onScrollToTop: ->(action) do
|
29
|
+
action.snackbars_alert message: 'Scrolled to Top'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -1,34 +1,31 @@
|
|
1
1
|
|
2
2
|
page_index = params[:page].to_i
|
3
3
|
next_page = {
|
4
|
-
url: json_ui_garage_url(path: 'lists/
|
5
|
-
|
6
|
-
autoLoad: true
|
4
|
+
url: json_ui_garage_url(path: 'lists/autoload_as_needed', page: page_index + 1, section_only: 'v1'),
|
5
|
+
autoload: 'asNeeded'
|
7
6
|
}
|
8
7
|
|
8
|
+
page = json_ui_page json
|
9
|
+
|
9
10
|
# TODO: Cater
|
10
11
|
# - for SEO: one URL for a standalone page and one URL for pagination only
|
11
12
|
# - for generic approach, e.g. excluding nav_menu when there is no change
|
12
13
|
if params[:section_only].present?
|
13
|
-
|
14
|
+
sleep 1
|
15
|
+
|
16
|
+
json.nextPage next_page if page_index < 3
|
14
17
|
json.sections do
|
15
18
|
json.child! do
|
16
|
-
render 'json_ui/garage/lists/
|
19
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
17
20
|
end
|
18
21
|
end
|
19
22
|
else
|
20
23
|
json.title 'Lists'
|
21
24
|
|
22
|
-
# options = { nextPage: nextPage }
|
23
|
-
# json_body_with_list json, nil, nil, options do
|
24
|
-
# render 'json_ui/garage/lists/infinite_scroll_section', json: json, page: page
|
25
|
-
# end
|
26
|
-
|
27
|
-
page = json_ui_page json
|
28
25
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
29
26
|
|
30
27
|
page.list nextPage: next_page, firstSection: ->(section) do
|
31
|
-
render 'json_ui/garage/lists/
|
28
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
32
29
|
end, onScrollToBottom: ->(action) do
|
33
30
|
action.snackbars_alert message: 'Scrolled to Bottom'
|
34
31
|
end, onScrollToTop: ->(action) do
|
@@ -0,0 +1,112 @@
|
|
1
|
+
json.title 'Lists'
|
2
|
+
|
3
|
+
liked = params[:liked] == 'true'
|
4
|
+
|
5
|
+
json_ui_page json do |page|
|
6
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
7
|
+
|
8
|
+
page.list firstSection: ->(section) do
|
9
|
+
section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
|
10
|
+
header.h3 text: 'Chat with John Doe'
|
11
|
+
end
|
12
|
+
|
13
|
+
section.rows builder: ->(template) do
|
14
|
+
# template.thumbnail title: "windows/reload (timestamp: #{DateTime.current.to_i}) -- #{liked}", onClick: ->(action) do
|
15
|
+
# action.windows_reload
|
16
|
+
# end, onLongPress: ->(action) do
|
17
|
+
# action.sheets_select message: "Context Menu (#{DateTime.current.to_i})", buttons: ->(menu) do
|
18
|
+
# if liked
|
19
|
+
# menu.button text: 'Cancel 👍', onClick: ->(subaction) do
|
20
|
+
# subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: false)
|
21
|
+
# end
|
22
|
+
# else
|
23
|
+
# menu.button text: 'Give 👍', onClick: ->(subaction) do
|
24
|
+
# subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: true)
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
template.commentOutgoing subtitle: 'Hey!', subsubtitle: l(10.minutes.ago, format: :short), imageUrl: glib_json_image_standard_url, chips: ->(menu) do
|
31
|
+
menu.button text: '😊 2', styleClass: 'info'
|
32
|
+
end
|
33
|
+
|
34
|
+
template.commentOutgoing subtitle: 'How are you?', subsubtitle: l(DateTime.current, format: :short)
|
35
|
+
|
36
|
+
template.commentIncoming title: 'John Doe', subtitle: 'Very well', subsubtitle: l(7.minutes.ago, format: :short), imageUrl: glib_json_image_standard_url, chips: ->(menu) do
|
37
|
+
menu.button text: "👍 #{liked ? 2 : 1}"
|
38
|
+
end, onLongPress: ->(action) do
|
39
|
+
action.sheets_select message: 'Context Menu', buttons: ->(menu) do
|
40
|
+
if liked
|
41
|
+
menu.button text: 'Cancel 👍', onClick: ->(subaction) do
|
42
|
+
subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: false)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
menu.button text: 'Give 👍', onClick: ->(subaction) do
|
46
|
+
subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: true)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
section.footer padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(footer) do
|
54
|
+
# footer.
|
55
|
+
|
56
|
+
# json.ws({
|
57
|
+
# "socket" => {
|
58
|
+
# "endpoint" => "/socket/websocket",
|
59
|
+
# "params" => {
|
60
|
+
# vsn: '2.0.0',
|
61
|
+
# token: 'TOKEN'
|
62
|
+
# }
|
63
|
+
# },
|
64
|
+
# # "topic" => "room:30",
|
65
|
+
# # "event" => "comments_updated",
|
66
|
+
# "topic" => "links",
|
67
|
+
# "events" => ["new_link_added"],
|
68
|
+
# "header" => {
|
69
|
+
# "user_id" => 2,
|
70
|
+
# "prev_item_id" => nil,
|
71
|
+
# "last_item_id" => nil
|
72
|
+
# }
|
73
|
+
# })
|
74
|
+
|
75
|
+
# page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, paramNameForFormData: 'formData', onSubmit: ->(action) do
|
76
|
+
# json.action "ws/push"
|
77
|
+
# json.topic "links"
|
78
|
+
# json.event "new_link"
|
79
|
+
# json.payload({
|
80
|
+
# "club_id": "2",
|
81
|
+
# "room_id": "30",
|
82
|
+
# "user_id": "2"
|
83
|
+
# # title: "TITLE",
|
84
|
+
# # url: "URL"
|
85
|
+
# })
|
86
|
+
|
87
|
+
# end, childViews: ->(form) do
|
88
|
+
# form.spacer height: 14
|
89
|
+
# form.label text: "Message: #{params[:message]}"
|
90
|
+
# form.spacer height: 14
|
91
|
+
|
92
|
+
# form.fields_text name: 'message[body]', width: 'matchParent', label: 'Message'
|
93
|
+
|
94
|
+
# # TODO: Change this to radio for selecting alert vs reload response
|
95
|
+
# form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
|
96
|
+
|
97
|
+
# form.fields_hidden name: 'baseUrl', width: 'matchParent', value: json_ui_garage_url(path: 'notifications/web_socket')
|
98
|
+
|
99
|
+
# form.panels_split width: 'matchParent', content: ->(split) do
|
100
|
+
# # split.left childViews: ->(left) do
|
101
|
+
# # if params[:mode] == 'dialog'
|
102
|
+
# # left.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
103
|
+
# # end
|
104
|
+
# # end
|
105
|
+
# split.right childViews: ->(right) do
|
106
|
+
# right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
107
|
+
# end
|
108
|
+
# end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
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 Prototype', onClick: ->(action) do
|
18
|
+
action.windows_open url: json_ui_garage_url(path: 'lists/chat')
|
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
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
batch_count = 30
|
3
2
|
items = (1..batch_count)
|
4
3
|
section = page.table_section_builder
|
@@ -10,4 +9,4 @@ section.rows objects: items, builder: ->(row, item, index) do
|
|
10
9
|
end, onClick: ->(action) do
|
11
10
|
action.windows_open url: json_ui_garage_url(path: 'home/blank')
|
12
11
|
end
|
13
|
-
end
|
12
|
+
end
|
@@ -21,18 +21,21 @@ if params[:section_only].present?
|
|
21
21
|
else
|
22
22
|
json.title 'Tables'
|
23
23
|
|
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
|
24
|
+
page = json_ui_page json
|
25
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
33
26
|
|
34
|
-
|
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
|
35
32
|
end
|
33
|
+
|
34
|
+
render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
|
35
|
+
end, onScrollToBottom: ->(action) do
|
36
|
+
action.snackbars_alert message: 'Scrolled to Bottom'
|
37
|
+
end, onScrollToTop: ->(action) do
|
38
|
+
action.snackbars_alert message: 'Scrolled to Top'
|
36
39
|
end
|
37
40
|
|
38
41
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
page_index = params[:page].to_i
|
3
3
|
next_page = {
|
4
|
-
url: json_ui_garage_url(path: 'tables/
|
4
|
+
url: json_ui_garage_url(path: 'tables/autoload_as_needed', page: page_index + 1, section_only: 'v1'),
|
5
5
|
autoload: 'asNeeded'
|
6
6
|
}
|
7
7
|
|
@@ -9,6 +9,8 @@ page = json_ui_page json
|
|
9
9
|
column_indexes = (1..3)
|
10
10
|
|
11
11
|
if params[:section_only].present?
|
12
|
+
sleep 1
|
13
|
+
|
12
14
|
json.nextPage next_page if page_index < 3
|
13
15
|
json.sections do
|
14
16
|
json.child! do
|
@@ -20,7 +20,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|
20
20
|
|
21
21
|
t.datetime :created_at, null: false
|
22
22
|
|
23
|
-
t.index [ :record_type, :record_id, :name, :blob_id ], name:
|
23
|
+
t.index [ :record_type, :record_id, :name, :blob_id ], name: 'index_active_storage_attachments_uniqueness', unique: true
|
24
24
|
t.foreign_key :active_storage_blobs, column: :blob_id
|
25
25
|
end
|
26
26
|
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
dt_redis_url = ENV.fetch('<%= options[:redis_env_key] %>', 'redis://localhost:6379')
|
2
|
-
$dt_redis = Redis.new(url: dt_redis_url)
|
2
|
+
$dt_redis = Redis.new(url: dt_redis_url)
|
data/lib/glib-web.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'glib/version'
|
2
|
+
require 'glib/engine' if defined?(::Rails)
|
3
|
+
require 'glib/value'
|
4
|
+
require 'glib/json_crawler'
|
5
5
|
|
6
6
|
require 'glib/dynamic_text'
|
7
7
|
require 'glib/crypt'
|
8
|
-
require 'glib/test_helpers'
|
8
|
+
require 'glib/test_helpers'
|
data/lib/glib/engine.rb
CHANGED
@@ -30,10 +30,10 @@ module Glib
|
|
30
30
|
fields << child
|
31
31
|
|
32
32
|
include_params = case name
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
when 'fields/check', 'fields/check-v1'
|
34
|
+
child['checkValue'] == child['value']
|
35
|
+
else
|
36
|
+
true
|
37
37
|
end
|
38
38
|
|
39
39
|
params[child['name']] = child['value'] if include_params
|
data/lib/glib/test_helpers.rb
CHANGED
@@ -25,9 +25,9 @@ module Glib
|
|
25
25
|
@__log_file ||= "#{self.method_name}.json"
|
26
26
|
end
|
27
27
|
|
28
|
-
def __log
|
29
|
-
File.open("#{File.join(__log_dir, __log_file)}",
|
30
|
-
f << JSON.pretty_generate(
|
28
|
+
def __log(json)
|
29
|
+
File.open("#{File.join(__log_dir, __log_file)}", 'w') do |f|
|
30
|
+
f << JSON.pretty_generate(JSON.parse(json))
|
31
31
|
end
|
32
32
|
json
|
33
33
|
end
|
data/lib/glib/value.rb
CHANGED
data/lib/glib/version.rb
CHANGED
data/lib/tasks/db.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
desc
|
1
|
+
desc 'Run migration scripts in db/migrate'
|
2
2
|
|
3
|
-
Rake::Task[
|
3
|
+
Rake::Task['db:structure:dump'].clear
|
4
4
|
|
5
5
|
namespace :db do
|
6
6
|
namespace :fixtures do
|
@@ -17,9 +17,9 @@ namespace :db do
|
|
17
17
|
# allow to specify output directory by FIXTURES_PATH
|
18
18
|
|
19
19
|
desc 'Dumps all models into fixtures.'
|
20
|
-
task :
|
20
|
+
task dump: :environment do
|
21
21
|
models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s|
|
22
|
-
Pathname.new(s).basename.to_s.gsub(/\.rb$/,'').camelize
|
22
|
+
Pathname.new(s).basename.to_s.gsub(/\.rb$/, '').camelize
|
23
23
|
end
|
24
24
|
|
25
25
|
begin
|
@@ -33,20 +33,20 @@ namespace :db do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# specify FIXTURES_PATH to test/fixtures if you do test:unit
|
36
|
-
dump_dir = ENV['FIXTURES_PATH'] ||
|
36
|
+
dump_dir = ENV['FIXTURES_PATH'] || 'test/fixtures/'
|
37
37
|
|
38
38
|
excludes = YAML.load_file(File.join(Rails.root, 'config', 'excluded_fixtures.yml'))
|
39
39
|
|
40
|
-
puts
|
41
|
-
puts
|
42
|
-
puts
|
40
|
+
puts 'Found models: ' + models.join(', ')
|
41
|
+
puts 'Excluding: ' + excludes.join(', ')
|
42
|
+
puts 'Dumping to: ' + dump_dir
|
43
43
|
|
44
44
|
models.each do |m|
|
45
45
|
unless excludes.include?(m)
|
46
46
|
model = m.constantize
|
47
47
|
next unless model.ancestors.include?(ActiveRecord::Base)
|
48
48
|
|
49
|
-
ids = model.column_names.select{ |k| k.ends_with?('_id') }.sort
|
49
|
+
ids = model.column_names.select { |k| k.ends_with?('_id') }.sort
|
50
50
|
|
51
51
|
entries = if model.column_names.include?('id')
|
52
52
|
model.unscoped.order(:id).all
|
@@ -63,7 +63,7 @@ namespace :db do
|
|
63
63
|
|
64
64
|
entries.each do |a|
|
65
65
|
attrs = Hash[a.attributes.sort]
|
66
|
-
attrs.delete_if{ |k,v| v.nil? }
|
66
|
+
attrs.delete_if { |k, v| v.nil? }
|
67
67
|
|
68
68
|
id = if attrs.include?('id')
|
69
69
|
[a.id]
|
@@ -92,4 +92,4 @@ namespace :db do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
|
-
end
|
95
|
+
end
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -107,7 +107,6 @@ files:
|
|
107
107
|
- app/validators/email_typo_validator.rb
|
108
108
|
- app/validators/email_validator.rb
|
109
109
|
- app/validators/url_validator.rb
|
110
|
-
- app/views/app/views/json_ui/vue/renderer.html.erb
|
111
110
|
- app/views/json_ui/garage/_nav_menu.json.jbuilder
|
112
111
|
- app/views/json_ui/garage/actions/_dialogs.json.jbuilder
|
113
112
|
- app/views/json_ui/garage/actions/_http.json.jbuilder
|
@@ -143,11 +142,13 @@ files:
|
|
143
142
|
- app/views/json_ui/garage/home/blank.json.jbuilder
|
144
143
|
- app/views/json_ui/garage/home/index.json.jbuilder
|
145
144
|
- app/views/json_ui/garage/home/slow.json.jbuilder
|
146
|
-
- app/views/json_ui/garage/lists/
|
145
|
+
- app/views/json_ui/garage/lists/_autoload_section.json.jbuilder
|
146
|
+
- app/views/json_ui/garage/lists/autoload_all.json.jbuilder
|
147
|
+
- app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder
|
148
|
+
- app/views/json_ui/garage/lists/chat.json.jbuilder
|
147
149
|
- app/views/json_ui/garage/lists/edit_actions.json.jbuilder
|
148
150
|
- app/views/json_ui/garage/lists/fab.json.jbuilder
|
149
151
|
- app/views/json_ui/garage/lists/index.json.jbuilder
|
150
|
-
- app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder
|
151
152
|
- app/views/json_ui/garage/lists/templating.json.jbuilder
|
152
153
|
- app/views/json_ui/garage/notifications/index.json.jbuilder
|
153
154
|
- app/views/json_ui/garage/notifications/web_socket.json.jbuilder
|
@@ -1,35 +0,0 @@
|
|
1
|
-
<!-- Deprecated. Use layouts instead
|
2
|
-
<!DOCTYPE html>
|
3
|
-
<html>
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<meta charset="utf-8" />
|
7
|
-
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport" />
|
8
|
-
|
9
|
-
<title>App</title>
|
10
|
-
<%= csrf_meta_tags %>
|
11
|
-
|
12
|
-
<%= javascript_pack_tag 'vue_renderer', defer: true %>
|
13
|
-
<%#= javascript_include_tag 'vue_renderer_extras', defer: true %>
|
14
|
-
|
15
|
-
<%= stylesheet_pack_tag 'vue_renderer' %>
|
16
|
-
<% if (custom_css_path = options[:custom_css_path]) %>
|
17
|
-
<%= stylesheet_link_tag custom_css_path, media: 'all' %>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet" />
|
21
|
-
</head>
|
22
|
-
|
23
|
-
<body>
|
24
|
-
<noscript>Please enable JavaScript to view this web site.</noscript>
|
25
|
-
<div id="app"></div>
|
26
|
-
|
27
|
-
<script>
|
28
|
-
var __page = <%= raw @__json_ui_orig_page%>;
|
29
|
-
</script>
|
30
|
-
|
31
|
-
<% locals[:footer_block]&.call %>
|
32
|
-
</body>
|
33
|
-
|
34
|
-
</html>
|
35
|
-
-->
|