glib-web 2.6.2 → 3.0.0
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/libs.rb +18 -0
- data/app/helpers/glib/json_ui/action_builder/popovers.rb +14 -0
- data/app/helpers/glib/json_ui/action_builder/snackbars.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder.rb +4 -0
- data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +1 -1
- data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +71 -63
- data/app/views/json_ui/garage/panels/_hover_views_content.json.jbuilder +4 -4
- data/app/views/json_ui/garage/panels/index.json.jbuilder +6 -6
- data/app/views/json_ui/garage/views/controls.json.jbuilder +45 -10
- data/app/views/layouts/json_ui/renderer.html.erb +10 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1893d7f9752d6b6fa88f44c3cf3992aafff393b4b10638ca989b82859c47c716
|
4
|
+
data.tar.gz: 7c19f36849c4ff6d58f1e53657c7f639b1a6d69fb1d4810c1a3a4d71ad652f8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a1be444dc544ac2957134c50cc8035ebd1a114b2eb724fbb3f2bc9d8cb845beca2f370670a6c74f46dcdd9892e4ac1b033c73ba20704a8ee2bd243733c4b94
|
7
|
+
data.tar.gz: 0f31ccbe16452d786d71c0c314753c03cd7d92476b0a392b9231d3b07110a01db1c2788a1937ddf073489656a00f2fb73c92b81e6e3f6b108c97e9c4281c08d1
|
@@ -36,6 +36,24 @@ module Glib::Json::Libs
|
|
36
36
|
json_ui_app_device_os == 'web'
|
37
37
|
end
|
38
38
|
|
39
|
+
def json_ui_etag
|
40
|
+
template = "#{controller_name}/#{action_name}"
|
41
|
+
|
42
|
+
# 1) It's necessary to pass in the template explicitly because of the switching between JSON
|
43
|
+
# and HTML rendering.
|
44
|
+
#
|
45
|
+
# 2) When a model is not provided, two pages the use the same template (e.g. `projects#show`)
|
46
|
+
# will produce the exact same ETAG, even though their content might be different. Presumably
|
47
|
+
# this is because the ETAG is calculated based on the static template as opposed to the
|
48
|
+
# generated output.
|
49
|
+
#
|
50
|
+
# However, this is not a problem because the browser will still treat these pages as
|
51
|
+
# separate because they have different URLs (e.g. `projects/1` vs `projects/2`), meaning
|
52
|
+
# that it will not accidentally use the cache from a different URL even though the ETAG
|
53
|
+
# is exactly the same.
|
54
|
+
fresh_when nil, template: template
|
55
|
+
end
|
56
|
+
|
39
57
|
def json_ui_render(template, args = {})
|
40
58
|
JSON.parse(render_to_string(template, locals: args))
|
41
59
|
end
|
@@ -44,6 +44,9 @@ module Glib
|
|
44
44
|
hash :tooltip
|
45
45
|
array :extensions
|
46
46
|
|
47
|
+
action :onMouseEnter
|
48
|
+
action :onMouseLeave
|
49
|
+
|
47
50
|
|
48
51
|
# def initialize(json, page)
|
49
52
|
# super(json, page)
|
@@ -243,6 +246,7 @@ module Glib
|
|
243
246
|
|
244
247
|
class TabBar < View
|
245
248
|
int :height
|
249
|
+
int :activeIndex
|
246
250
|
color :color
|
247
251
|
|
248
252
|
def buttons(block)
|
@@ -27,7 +27,7 @@ section.rows builder: ->(template) do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
template.thumbnail title: 'snackbars with styling', onClick: ->(action) do
|
30
|
-
action.snackbars_alert message: 'This is a styled snackbar',
|
30
|
+
action.snackbars_alert message: 'This is a styled snackbar', location: 'top', styleClass: 'success'
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
@@ -6,42 +6,44 @@ json_ui_page json do |page|
|
|
6
6
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
7
|
scroll.panels_column lg: { cols: 8 }, childViews: ->(column) do
|
8
8
|
column.h2 text: 'Tab Bar with Badge'
|
9
|
-
column.tabBar
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
9
|
+
column.tabBar \
|
10
|
+
activeIndex: params[:tab].to_i,
|
11
|
+
buttons: ->(menu) do
|
12
|
+
badges = [
|
13
|
+
{
|
14
|
+
text: nil,
|
15
|
+
backgroundColor: nil
|
16
|
+
},
|
17
|
+
{
|
18
|
+
text: 8,
|
19
|
+
backgroundColor: '#272551'
|
20
|
+
},
|
21
|
+
{
|
22
|
+
text: '⭐⭐⭐',
|
23
|
+
backgroundColor: '#008000'
|
24
|
+
}
|
25
|
+
]
|
26
|
+
{
|
27
|
+
'FIRST' => 'home',
|
28
|
+
'SECOND' => 'schedule',
|
29
|
+
'THIRD' => 'analytics'
|
30
|
+
}.each_with_index do |(text, icon), index|
|
31
|
+
menu.button \
|
32
|
+
icon: icon,
|
33
|
+
text: text,
|
34
|
+
badge: badges[index],
|
35
|
+
disabled: params[:tab].to_i == index,
|
36
|
+
onClick: ->(action) do
|
37
|
+
action.windows_reload \
|
38
|
+
url: json_ui_garage_url(
|
39
|
+
path: 'pages/tab_bar',
|
40
|
+
tab: index,
|
41
|
+
tab_2: params[:tab_2],
|
42
|
+
tab_3: params[:tab_3]
|
43
|
+
)
|
44
|
+
end
|
42
45
|
end
|
43
|
-
|
44
|
-
end
|
46
|
+
end
|
45
47
|
column.spacer height: 10
|
46
48
|
|
47
49
|
column.label text: "Tab index #{params[:tab].to_i} selected"
|
@@ -55,22 +57,25 @@ json_ui_page json do |page|
|
|
55
57
|
|
56
58
|
scroll.panels_column lg: { cols: 8 }, childViews: ->(column) do
|
57
59
|
column.h2 text: "Tab Bar with 'full-width-divider'"
|
58
|
-
column.tabBar
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
60
|
+
column.tabBar \
|
61
|
+
activeIndex: params[:tab_2].to_i,
|
62
|
+
styleClass: 'full-width-divider',
|
63
|
+
buttons: ->(menu) do
|
64
|
+
5.times do |index|
|
65
|
+
menu.button \
|
66
|
+
text: "Tab #{index}",
|
67
|
+
disabled: params[:tab_2].to_i == index,
|
68
|
+
onClick: ->(action) do
|
69
|
+
action.windows_reload \
|
70
|
+
url: json_ui_garage_url(
|
71
|
+
path: 'pages/tab_bar',
|
72
|
+
tab: params[:tab],
|
73
|
+
tab_2: index,
|
74
|
+
tab_3: params[:tab_3]
|
75
|
+
)
|
76
|
+
end
|
71
77
|
end
|
72
78
|
end
|
73
|
-
end
|
74
79
|
column.spacer height: 10
|
75
80
|
|
76
81
|
column.label text: "Tab-2 index #{params[:tab_2].to_i} selected"
|
@@ -79,22 +84,25 @@ json_ui_page json do |page|
|
|
79
84
|
|
80
85
|
scroll.panels_column lg: { cols: 8 }, childViews: ->(column) do
|
81
86
|
column.h2 text: "Tab Bar 'with no-grow'"
|
82
|
-
column.tabBar
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
87
|
+
column.tabBar \
|
88
|
+
activeIndex: params[:tab_3].to_i,
|
89
|
+
styleClass: 'no-grow',
|
90
|
+
buttons: ->(menu) do
|
91
|
+
5.times do |index|
|
92
|
+
menu.button \
|
93
|
+
text: "Tab #{index}",
|
94
|
+
disabled: params[:tab_3].to_i == index,
|
95
|
+
onClick: ->(action) do
|
96
|
+
action.windows_reload \
|
97
|
+
url: json_ui_garage_url(
|
98
|
+
path: 'pages/tab_bar',
|
99
|
+
tab: params[:tab],
|
100
|
+
tab_2: params[:tab_2],
|
101
|
+
tab_3: index
|
102
|
+
)
|
103
|
+
end
|
95
104
|
end
|
96
105
|
end
|
97
|
-
end
|
98
106
|
column.spacer height: 10
|
99
107
|
|
100
108
|
column.label text: "Tab-3 index #{params[:tab_3].to_i} selected"
|
@@ -2,7 +2,7 @@ text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
|
|
2
2
|
value = ''
|
3
3
|
i.times { value += text }
|
4
4
|
|
5
|
-
hover.panels_responsive padding: {top: 24, right: 24, bottom: 24, left: 24 }, childViews: ->(responsive) do
|
5
|
+
hover.panels_responsive padding: { top: 24, right: 24, bottom: 24, left: 24 }, childViews: ->(responsive) do
|
6
6
|
responsive.avatar url: glib_json_image_avatar_url
|
7
7
|
|
8
8
|
responsive.spacer height: 8
|
@@ -10,9 +10,9 @@ hover.panels_responsive padding: {top: 24, right: 24, bottom: 24, left: 24 }, ch
|
|
10
10
|
responsive.spacer height: 8
|
11
11
|
|
12
12
|
responsive.h2 text: 'Hover View'
|
13
|
-
responsive.p text:value
|
13
|
+
responsive.p text: value
|
14
14
|
responsive.spacer height: 24
|
15
|
-
responsive.button text: 'Button', onClick
|
15
|
+
responsive.button text: 'Button', onClick: ->(action) do
|
16
16
|
action.dialogs_alert message: 'Clicked'
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -30,9 +30,9 @@ json_ui_page json do |page|
|
|
30
30
|
template.thumbnail title: 'Unordered List', subtitle: 'Bullet points similar to HTML\'s <ul> tag', onClick: ->(action) do
|
31
31
|
action.windows_open url: json_ui_garage_url(path: 'panels/ul')
|
32
32
|
end
|
33
|
-
template.thumbnail title: 'Timeline', subtitle: 'Timeline component with responsive panel as the childviews', onClick: ->(action) do
|
34
|
-
|
35
|
-
end
|
33
|
+
# template.thumbnail title: 'Timeline', subtitle: 'Timeline component with responsive panel as the childviews', onClick: ->(action) do
|
34
|
+
# action.windows_open url: json_ui_garage_url(path: 'panels/timeline')
|
35
|
+
# end
|
36
36
|
end
|
37
37
|
end, ->(section) do
|
38
38
|
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
@@ -87,9 +87,9 @@ json_ui_page json do |page|
|
|
87
87
|
template.thumbnail title: 'Column', subtitle: 'Adds control over layout inside a responsive panel', onClick: ->(action) do
|
88
88
|
action.windows_open url: json_ui_garage_url(path: 'panels/responsive')
|
89
89
|
end
|
90
|
-
template.thumbnail title: 'Hover', subtitle: 'Popover triggered by hover', onClick: ->(action) do
|
91
|
-
|
92
|
-
end
|
90
|
+
# template.thumbnail title: 'Hover', subtitle: 'Popover triggered by hover', onClick: ->(action) do
|
91
|
+
# action.windows_open url: json_ui_garage_url(path: 'panels/hover')
|
92
|
+
# end
|
93
93
|
end
|
94
94
|
end, ->(section) do
|
95
95
|
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
@@ -27,23 +27,58 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
scroll.spacer height: 10
|
30
|
-
scroll.button text: 'Button with dropdown',
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
scroll.button text: 'Button with dropdown', onClick: ->(action) do
|
31
|
+
action.popovers_open \
|
32
|
+
key: 'menu',
|
33
|
+
location: 'bottom',
|
34
|
+
childViews: ->(view) do
|
35
|
+
view.panels_responsive styleClass: 'popover-menu', width: 200, childViews: ->(res) do
|
36
|
+
res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
37
|
+
saction.popovers_close key: 'menu'
|
38
|
+
end
|
39
|
+
res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
40
|
+
saction.popovers_close key: 'menu'
|
41
|
+
end
|
42
|
+
res.label text: 'Item 3', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
43
|
+
saction.popovers_close key: 'menu'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
34
47
|
end
|
35
48
|
|
36
49
|
scroll.spacer height: 10
|
37
|
-
scroll.button
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
50
|
+
scroll.button \
|
51
|
+
text: 'Button with tooltip and dropdown',
|
52
|
+
onMouseEnter: ->(action) {
|
53
|
+
action.popovers_open \
|
54
|
+
key: 'tooltip',
|
55
|
+
location: 'top',
|
56
|
+
childViews: ->(view) { view.p styleClass: 'tooltip', text: 'Tooltip 1' }
|
57
|
+
},
|
58
|
+
onMouseLeave: ->(action) { action.popovers_close key: 'tooltip' },
|
59
|
+
onClick: ->(action) do
|
60
|
+
action.popovers_open \
|
61
|
+
key: 'menu',
|
62
|
+
location: 'right',
|
63
|
+
childViews: ->(view) do
|
64
|
+
view.panels_responsive styleClass: 'popover-menu', width: 200, childViews: ->(res) do
|
65
|
+
res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
66
|
+
saction.popovers_close key: 'menu'
|
67
|
+
end
|
68
|
+
res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
69
|
+
saction.popovers_close key: 'menu'
|
70
|
+
end
|
71
|
+
res.label text: 'Item 3', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
72
|
+
saction.popovers_close key: 'menu'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
42
77
|
|
43
78
|
scroll.spacer height: 20
|
44
79
|
scroll.button \
|
45
80
|
icon: 'info',
|
46
|
-
|
81
|
+
styleClasses: ['icon', 'plain'],
|
47
82
|
tooltip: { text: 'Disabled Icon button with tooltip text and custom tooltip position', position: 'right' },
|
48
83
|
disabled: true
|
49
84
|
scroll.spacer height: 20
|
@@ -8,34 +8,27 @@
|
|
8
8
|
<title>App</title>
|
9
9
|
<%= csrf_meta_tags %>
|
10
10
|
|
11
|
-
<%=
|
11
|
+
<%= vite_javascript_tag 'vue_renderer', defer: true %>
|
12
12
|
<%#= javascript_include_tag 'vue_renderer_extras', defer: true %>
|
13
13
|
|
14
|
-
<%=
|
15
|
-
|
14
|
+
<%= vite_stylesheet_tag 'vue_renderer' %>
|
15
|
+
<%# TODO: Remove this, for dev only %>
|
16
|
+
<%# <script src="https://cdn.tailwindcss.com"></script> %>
|
16
17
|
<link href="//fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet" />
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<%=
|
22
|
-
|
23
|
-
<% if @__glib_head_code %>
|
24
|
-
<%= @__glib_head_code.html_safe %>
|
25
|
-
<% end %>
|
18
|
+
<%# Without this, checkboxes and radio buttons will not display. %>
|
19
|
+
<%# <link href="//cdn.materialdesignicons.com/2.1.99/css/materialdesignicons.min.css" rel="stylesheet" /> %>
|
20
|
+
<%= yield :head %>
|
21
|
+
<% if @__glib_head_code %>
|
22
|
+
<%= @__glib_head_code.html_safe %>
|
23
|
+
<% end %>
|
26
24
|
</head>
|
27
|
-
|
28
25
|
<body>
|
29
26
|
<%= yield :header %>
|
30
|
-
|
31
27
|
<noscript>Please enable JavaScript to view this web site.</noscript>
|
32
28
|
<div id="app"></div>
|
33
|
-
|
34
29
|
<script>
|
35
30
|
var __page = <%= raw @__json_ui_orig_page%>;
|
36
31
|
</script>
|
37
|
-
|
38
32
|
<%= yield :footer %>
|
39
33
|
</body>
|
40
|
-
|
41
34
|
</html>
|
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:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- app/helpers/glib/json_ui/action_builder/http.rb
|
99
99
|
- app/helpers/glib/json_ui/action_builder/iap.rb
|
100
100
|
- app/helpers/glib/json_ui/action_builder/panels.rb
|
101
|
+
- app/helpers/glib/json_ui/action_builder/popovers.rb
|
101
102
|
- app/helpers/glib/json_ui/action_builder/sheets.rb
|
102
103
|
- app/helpers/glib/json_ui/action_builder/snackbars.rb
|
103
104
|
- app/helpers/glib/json_ui/action_builder/tours.rb
|
@@ -313,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
314
|
- !ruby/object:Gem::Version
|
314
315
|
version: '0'
|
315
316
|
requirements: []
|
316
|
-
rubygems_version: 3.1.
|
317
|
+
rubygems_version: 3.1.4
|
317
318
|
signing_key:
|
318
319
|
specification_version: 4
|
319
320
|
summary: ''
|