glib-web 0.5.81 → 0.5.85

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: ef5e942f8b8000bbaab11752e242118c44f8f9b0f8750b12d768cb47ac434f2b
4
- data.tar.gz: 94b76605709e5d6922e6274431a7b9d7ecd04cac592bc26a0d40d524e826414e
3
+ metadata.gz: dbc3d54d9b3330ceaf201ca6a3b1fe2a2c773eec342568356e7fa92962c3e3c3
4
+ data.tar.gz: 31c246e1afd7ee0a31eae925b3ddf227a7299c05b2b7972f85972768025527c4
5
5
  SHA512:
6
- metadata.gz: 143ab58df104d450015782981f45b2e2ae9d1dd8f8a323563ae540278e809a3050b71aceaed9c35d2c211186d2701d066d282f7b6a07441a32b41cd7921dc96f
7
- data.tar.gz: b3042a76efac55a9bffac8050d5c233363deb4ca6dacdc2bc9bb46c635510a6f38402783ff8d585f796257386278e58443532bf7816e1edab8277a2af3e3f78e
6
+ metadata.gz: 065e4399ffd15e49e072b4c30c71b823d977397f6435ca112a8ad0e5aabf43c2c544e3806d9e93dd572cc7c9a3d2cafa79ec0f5f6d60fb02a075637e36635bf1
7
+ data.tar.gz: c55ace7298dd9294d003e5b55b778f8b384a6caf5a5cb69f6a0496e2ac59771e1f4a362777d4d4c48a3b0d9269920be2e8d6cd908a0b3244dce16a4f5ce4ba69
@@ -43,6 +43,8 @@ module Glib
43
43
  icon :icon
44
44
  action :onClick
45
45
  bool :disabled
46
+ color :badgeColor
47
+ string :badgeContent
46
48
  singleton_array :styleClass, :styleClasses
47
49
 
48
50
  def childButtons(block)
@@ -65,7 +65,7 @@ module Glib
65
65
 
66
66
  class Page
67
67
  attr_reader :json, :context, :view_builder, :action_builder, :menu_builder
68
- attr_reader :list_section_builder, :table_section_builder, :drawer_content_builder, :split_content_builder
68
+ attr_reader :list_section_builder, :table_section_builder, :drawer_content_builder
69
69
 
70
70
  # See Panels::Form
71
71
  attr_accessor :current_form
@@ -81,7 +81,7 @@ module Glib
81
81
  @list_section_builder = ListBuilders::Section.new(json, self, ListBuilders::Template.new(json, self))
82
82
  @drawer_content_builder = ListBuilders::Section.new(json, self, @menu_builder)
83
83
  @table_section_builder = TableBuilders::Section.new(json, self, TableBuilders::Template.new(json, self))
84
- @split_content_builder = SplitBuilders::Content.new(json, self, @view_builder)
84
+ # @split_content_builder = SplitBuilders::Content.new(json, self, @view_builder)
85
85
 
86
86
  # TODO: Deprecate
87
87
  # For generic `body` builder. For others, use content_builder()
@@ -107,7 +107,7 @@ module Glib
107
107
 
108
108
  def leftDrawer(options = {})
109
109
  json.leftDrawer do
110
- [:styleClasses].each do |name|
110
+ [:styleClasses, :backgroundColor].each do |name|
111
111
  if (value = options.delete(name))
112
112
  json.set! name, value
113
113
  end
@@ -165,9 +165,11 @@ class Glib::JsonUi::ViewBuilder
165
165
  end
166
166
 
167
167
  class Split < View
168
- def content(block)
169
- block.call page.split_content_builder
170
- end
168
+ # def content(block)
169
+ # block.call page.split_content_builder
170
+ # end
171
+
172
+ panels_builder :content, :left, :center, :right
171
173
  end
172
174
 
173
175
  class Responsive < View
@@ -75,7 +75,7 @@ module Glib
75
75
 
76
76
  ### View definitions
77
77
 
78
- class AbstractText < View
78
+ class AbstractText < View
79
79
  string :textAlign
80
80
  text :text
81
81
  color :color
@@ -204,6 +204,7 @@ module Glib
204
204
  end
205
205
 
206
206
  class TabBar < View
207
+ int :height
207
208
  color :color
208
209
 
209
210
  def buttons(block)
@@ -215,6 +216,7 @@ module Glib
215
216
 
216
217
  class AppBar < View
217
218
  color :color
219
+ panels_builder :content, :logo
218
220
 
219
221
  # def leftButtons(block)
220
222
  # json.leftButtons do
@@ -235,6 +237,12 @@ module Glib
235
237
  bool :tick
236
238
  end
237
239
 
240
+ class ProgressBar < View
241
+ float :value
242
+ color :color
243
+ color :backgroundColor
244
+ bool :reversed
245
+ end
238
246
  end
239
247
  end
240
248
  end
@@ -12,9 +12,11 @@
12
12
 
13
13
  # section = json_ui_section json
14
14
 
15
+ sleep 1
16
+
15
17
  section = page.list_section_builder
16
18
  section.rows builder: ->(row) do
17
- batch_count = 30
19
+ batch_count = 1000
18
20
  batch_count.times do |i|
19
21
  index = page_index * batch_count + i
20
22
  if local_assigns[:reorder]
@@ -22,7 +24,7 @@ section.rows builder: ->(row) do
22
24
  action.dialogs_notification title: "Item #{index}"
23
25
  end, paramNameForFormData: 'message', paramNameForNewIndex: 'new_index'
24
26
  else
25
- row.thumbnail title: "Item #{index}"
27
+ row.thumbnail title: "Item #{index}", subtitle: "Sub Item #{index}", subsubtitle: "Sub Sub Item #{index}"
26
28
  end
27
29
  end
28
30
  end
@@ -3,28 +3,89 @@ json.title 'Pages'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.header childViews: ->(header) do
7
- header.tabBar width: 'matchParent', backgroundColor: '#ffca05', color: '#7f561b', buttons: ->(menu) do
8
-
9
- {
10
- 'FIRST' => 'home',
11
- 'SECOND' => 'schedule',
12
- 'THIRD' => 'analytics'
13
- }.each_with_index do |(text, icon), index|
14
- menu.button icon: icon, text: text, disabled: params[:tab].to_i == index, onClick: ->(action) do
15
- action.windows_reload url: json_ui_garage_url(path: 'pages/tab_bar', tab: index)
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
+ scroll.panels_column lg: { cols: 8 }, childViews: ->(column) do
8
+ column.h2 text: 'Tab Bar with Badge'
9
+ column.tabBar buttons: ->(menu) do
10
+ {
11
+ 'FIRST' => 'home',
12
+ 'SECOND' => 'schedule',
13
+ 'THIRD' => 'analytics'
14
+ }.each_with_index do |(text, icon), index|
15
+ menu.button \
16
+ icon: icon,
17
+ text: text,
18
+ badgeContent: [nil, 8, '⭐⭐⭐'][index],
19
+ badgeColor: [nil, '#272551', '#008000'][index],
20
+ disabled: params[:tab].to_i == index,
21
+ onClick: ->(action) do
22
+ action.windows_reload \
23
+ url: json_ui_garage_url(
24
+ path: 'pages/tab_bar',
25
+ tab: index,
26
+ tab_2: params[:tab_2],
27
+ tab_3: params[:tab_3]
28
+ )
29
+ end
16
30
  end
17
31
  end
32
+ column.spacer height: 10
33
+
34
+ column.label text: "Tab index #{params[:tab].to_i} selected"
35
+ column.spacer height: 10
36
+
37
+ 10.times do |i|
38
+ column.label text: "Line #{i + 1}"
39
+ end
40
+ column.spacer height: 40
18
41
  end
19
- end
20
42
 
21
- page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
22
- scroll.label text: "Tab index #{params[:tab].to_i} selected"
43
+ scroll.panels_column lg: { cols: 8 }, childViews: ->(column) do
44
+ column.h2 text: "Tab Bar with 'full-width-divider'"
45
+ column.tabBar styleClass: 'full-width-divider', buttons: ->(menu) do
46
+ 5.times do |index|
47
+ menu.button \
48
+ text: "Tab #{index}",
49
+ disabled: params[:tab_2].to_i == index,
50
+ onClick: ->(action) do
51
+ action.windows_reload \
52
+ url: json_ui_garage_url(
53
+ path: 'pages/tab_bar',
54
+ tab: params[:tab],
55
+ tab_2: index,
56
+ tab_3: params[:tab_3]
57
+ )
58
+ end
59
+ end
60
+ end
61
+ column.spacer height: 10
62
+
63
+ column.label text: "Tab-2 index #{params[:tab_2].to_i} selected"
64
+ column.spacer height: 40
65
+ end
23
66
 
24
- scroll.spacer height: 10
67
+ scroll.panels_column lg: { cols: 8 }, childViews: ->(column) do
68
+ column.h2 text: "Tab Bar 'with no-grow'"
69
+ column.tabBar styleClass: 'no-grow', buttons: ->(menu) do
70
+ 5.times do |index|
71
+ menu.button \
72
+ text: "Tab #{index}",
73
+ disabled: params[:tab_3].to_i == index,
74
+ onClick: ->(action) do
75
+ action.windows_reload \
76
+ url: json_ui_garage_url(
77
+ path: 'pages/tab_bar',
78
+ tab: params[:tab],
79
+ tab_2: params[:tab_2],
80
+ tab_3: index
81
+ )
82
+ end
83
+ end
84
+ end
85
+ column.spacer height: 10
25
86
 
26
- 100.times do |i|
27
- scroll.label text: "Line #{i + 1}"
87
+ column.label text: "Tab-3 index #{params[:tab_3].to_i} selected"
88
+ column.spacer height: 40
28
89
  end
29
90
  end
30
91
 
@@ -19,7 +19,7 @@ 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 icon: 'add', text: 'Add', onClick: ->(action) do
22
+ menu.button icon: 'add', text: 'Add', badgeContent: 80, onClick: ->(action) do
23
23
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
24
24
  end
25
25
  menu.button icon: 'edit', text: 'Edit', onClick: ->(action) do
@@ -30,7 +30,11 @@ json_ui_page json do |page|
30
30
  end
31
31
 
32
32
  menu.button icon: 'more_vert', childButtons: ->(submenu) do
33
- submenu.button icon: 'add', text: 'Option1', onClick: ->(action) do
33
+ submenu.button \
34
+ icon: 'add',
35
+ text: 'Option1',
36
+ badgeContent: 3,
37
+ onClick: ->(action) do
34
38
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
35
39
  end
36
40
  submenu.button icon: 'edit', text: 'Option2', onClick: ->(action) do
@@ -10,30 +10,35 @@ json_ui_page json do |page|
10
10
  end
11
11
 
12
12
  section.rows builder: ->(template) do
13
- template.thumbnail title: 'Texts', onClick: ->(action) do
14
- action.windows_open url: json_ui_garage_url(path: 'views/texts')
15
- end
16
- template.thumbnail title: 'Controls', onClick: ->(action) do
17
- action.windows_open url: json_ui_garage_url(path: 'views/controls')
18
- end
19
- template.thumbnail title: 'Images', onClick: ->(action) do
20
- action.windows_open url: json_ui_garage_url(path: 'views/images')
21
- end
22
- template.thumbnail title: 'Charts', onClick: ->(action) do
23
- action.windows_open url: json_ui_garage_url(path: 'views/charts')
24
- end
25
- template.thumbnail title: 'Banners', onClick: ->(action) do
26
- action.windows_open url: json_ui_garage_url(path: 'views/banners')
27
- end
28
- template.thumbnail title: 'Maps', onClick: ->(action) do
29
- action.windows_open url: json_ui_garage_url(path: 'views/maps')
30
- end
31
- template.thumbnail title: 'Misc', onClick: ->(action) do
32
- action.windows_open url: json_ui_garage_url(path: 'views/misc')
33
- end
34
- template.thumbnail title: 'Icons', onClick: ->(action) do
35
- action.windows_open url: json_ui_garage_url(path: 'views/icons')
13
+ ['texts', 'controls', 'images', 'charts', 'banners', 'maps', 'misc', 'icons', 'progress'].each do |component|
14
+ template.thumbnail title: component.humanize, onClick: ->(action) do
15
+ action.windows_open url: json_ui_garage_url(path: "views/#{component}")
16
+ end
36
17
  end
18
+ # template.thumbnail title: 'Texts', onClick: ->(action) do
19
+ # action.windows_open url: json_ui_garage_url(path: 'views/texts')
20
+ # end
21
+ # template.thumbnail title: 'Controls', onClick: ->(action) do
22
+ # action.windows_open url: json_ui_garage_url(path: 'views/controls')
23
+ # end
24
+ # template.thumbnail title: 'Images', onClick: ->(action) do
25
+ # action.windows_open url: json_ui_garage_url(path: 'views/images')
26
+ # end
27
+ # template.thumbnail title: 'Charts', onClick: ->(action) do
28
+ # action.windows_open url: json_ui_garage_url(path: 'views/charts')
29
+ # end
30
+ # template.thumbnail title: 'Banners', onClick: ->(action) do
31
+ # action.windows_open url: json_ui_garage_url(path: 'views/banners')
32
+ # end
33
+ # template.thumbnail title: 'Maps', onClick: ->(action) do
34
+ # action.windows_open url: json_ui_garage_url(path: 'views/maps')
35
+ # end
36
+ # template.thumbnail title: 'Misc', onClick: ->(action) do
37
+ # action.windows_open url: json_ui_garage_url(path: 'views/misc')
38
+ # end
39
+ # template.thumbnail title: 'Icons', onClick: ->(action) do
40
+ # action.windows_open url: json_ui_garage_url(path: 'views/icons')
41
+ # end
37
42
  end
38
43
  end,
39
44
  ->(section) do
@@ -0,0 +1,31 @@
1
+ json.title 'Views'
2
+
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
+ scroll.h2 text: 'Progress Bar'
8
+ scroll.spacer height: 6
9
+ scroll.progressBar value: 0.1
10
+ scroll.spacer height: 20
11
+
12
+ scroll.h2 text: 'Thin Progress Bar'
13
+ scroll.spacer height: 6
14
+ scroll.progressBar value: 0.25, height: 5, styleClass: 'no-text'
15
+ scroll.spacer height: 20
16
+
17
+ scroll.h2 text: 'Striped Progress Bar'
18
+ scroll.spacer height: 6
19
+ scroll.progressBar value: 0.5, styleClass: 'striped'
20
+ scroll.spacer height: 20
21
+
22
+ scroll.h2 text: 'Progress Bar with custom colors'
23
+ scroll.spacer height: 6
24
+ scroll.progressBar value: 0.75, color: '#272551', backgroundColor: '#FFFF00', styleClass: 'light'
25
+ scroll.spacer height: 20
26
+
27
+ scroll.h2 text: 'Reversed Progress Bar'
28
+ scroll.spacer height: 6
29
+ scroll.progressBar value: 0.1, reversed: true
30
+ scroll.spacer height: 20
31
+ 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.81
4
+ version: 0.5.85
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -105,7 +105,6 @@ files:
105
105
  - app/helpers/glib/json_ui/menu_builder.rb
106
106
  - app/helpers/glib/json_ui/page_helper.rb
107
107
  - app/helpers/glib/json_ui/response_helper.rb
108
- - app/helpers/glib/json_ui/split_builders.rb
109
108
  - app/helpers/glib/json_ui/styling_helper.rb
110
109
  - app/helpers/glib/json_ui/table_builders.rb
111
110
  - app/helpers/glib/json_ui/view_builder.rb
@@ -230,6 +229,7 @@ files:
230
229
  - app/views/json_ui/garage/views/maps.json.jbuilder
231
230
  - app/views/json_ui/garage/views/markdowns.json.jbuilder
232
231
  - app/views/json_ui/garage/views/misc.json.jbuilder
232
+ - app/views/json_ui/garage/views/progress.json.jbuilder
233
233
  - app/views/json_ui/garage/views/texts.json.jbuilder
234
234
  - app/views/layouts/json_ui/renderer.html.erb
235
235
  - config/routes.rb
@@ -1,32 +0,0 @@
1
- module Glib
2
- module JsonUi
3
- module SplitBuilders
4
-
5
- class Content < AbstractBuilder
6
- def initialize(json, page, template)
7
- super json, page
8
- @template = template
9
- end
10
-
11
- def left(options = {})
12
- json.left do
13
- page.vertical_content(options)
14
- end
15
- end
16
-
17
- def center(options = {})
18
- json.center do
19
- page.vertical_content(options)
20
- end
21
- end
22
-
23
- def right(options = {})
24
- json.right do
25
- page.vertical_content(options)
26
- end
27
- end
28
- end
29
-
30
- end
31
- end
32
- end