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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 626a7318bab15d6f40a56eab8a88f93168ecbf5c5848a06ac36074faffd8e4f7
4
- data.tar.gz: 3dfdf7e1026acde4790640d3df5594a56cb591459ee2c12ba3623080ffd78c6e
3
+ metadata.gz: 1893d7f9752d6b6fa88f44c3cf3992aafff393b4b10638ca989b82859c47c716
4
+ data.tar.gz: 7c19f36849c4ff6d58f1e53657c7f639b1a6d69fb1d4810c1a3a4d71ad652f8b
5
5
  SHA512:
6
- metadata.gz: 4c89bbef5dca79b924d5e9d8442828b1721cab5f6e51bd035d117c177557924fd20acbeb4475728cfecc39b89457763380f66489f4cbc38249be4d199dcf276e
7
- data.tar.gz: 47d96447564dcecc2e2649aeb8872268564c0ab13c13a26483a00f1bbad5877863fefa280ae651e710846e964089b1cdb1bcbb890afb8ab4d4fcec6762bb17b6
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
@@ -0,0 +1,14 @@
1
+ class Glib::JsonUi::ActionBuilder
2
+ module Popovers
3
+ class Open < Action
4
+ string :key
5
+ views :childViews
6
+ string :location
7
+ int :offset
8
+ end
9
+
10
+ class Close < Action
11
+ string :key
12
+ end
13
+ end
14
+ end
@@ -8,6 +8,7 @@ class Glib::JsonUi::ActionBuilder
8
8
 
9
9
  string :verticalPosition
10
10
  string :horizontalPosition
11
+ string :location
11
12
  singleton_array :styleClass, :styleClasses
12
13
  end
13
14
 
@@ -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', verticalPosition: 'top', styleClass: 'success'
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 buttons: ->(menu) do
10
- badges = [
11
- {
12
- text: nil,
13
- backgroundColor: nil
14
- },
15
- {
16
- text: 8,
17
- backgroundColor: '#272551'
18
- },
19
- {
20
- text: '⭐⭐⭐',
21
- backgroundColor: '#008000'
22
- }
23
- ]
24
- {
25
- 'FIRST' => 'home',
26
- 'SECOND' => 'schedule',
27
- 'THIRD' => 'analytics'
28
- }.each_with_index do |(text, icon), index|
29
- menu.button \
30
- icon: icon,
31
- text: text,
32
- badge: badges[index],
33
- disabled: params[:tab].to_i == index,
34
- onClick: ->(action) do
35
- action.windows_reload \
36
- url: json_ui_garage_url(
37
- path: 'pages/tab_bar',
38
- tab: index,
39
- tab_2: params[:tab_2],
40
- tab_3: params[:tab_3]
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
- end
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 styleClass: 'full-width-divider', buttons: ->(menu) do
59
- 5.times do |index|
60
- menu.button \
61
- text: "Tab #{index}",
62
- disabled: params[:tab_2].to_i == index,
63
- onClick: ->(action) do
64
- action.windows_reload \
65
- url: json_ui_garage_url(
66
- path: 'pages/tab_bar',
67
- tab: params[:tab],
68
- tab_2: index,
69
- tab_3: params[:tab_3]
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 styleClass: 'no-grow', buttons: ->(menu) do
83
- 5.times do |index|
84
- menu.button \
85
- text: "Tab #{index}",
86
- disabled: params[:tab_3].to_i == index,
87
- onClick: ->(action) do
88
- action.windows_reload \
89
- url: json_ui_garage_url(
90
- path: 'pages/tab_bar',
91
- tab: params[:tab],
92
- tab_2: params[:tab_2],
93
- tab_3: index
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:->(action) do
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
- action.windows_open url: json_ui_garage_url(path: 'panels/timeline')
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
- action.windows_open url: json_ui_garage_url(path: 'panels/hover')
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', childButtons: ->(menu) do
31
- menu.button text: 'Dropdown item 1'
32
- menu.button text: 'Dropdown item 2'
33
- menu.button text: 'Dropdown item 3'
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 text: 'Button with tooltip and dropdown', tooltip: { text: 'Tooltip text' }, childButtons: ->(menu) do
38
- menu.button text: 'Dropdown item 1'
39
- menu.button text: 'Dropdown item 2'
40
- menu.button text: 'Dropdown item 3'
41
- end
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
- styleClass: 'icon',
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
- <%= javascript_pack_tag 'vue_renderer', defer: true %>
11
+ <%= vite_javascript_tag 'vue_renderer', defer: true %>
12
12
  <%#= javascript_include_tag 'vue_renderer_extras', defer: true %>
13
13
 
14
- <%= stylesheet_pack_tag 'vue_renderer' %>
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
- <%# 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
-
21
- <%= yield :head %>
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: 2.6.2
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.6
317
+ rubygems_version: 3.1.4
317
318
  signing_key:
318
319
  specification_version: 4
319
320
  summary: ''