glib-web 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +1 -0
  3. data/app/helpers/glib/json_ui/action_builder/popovers.rb +3 -1
  4. data/app/helpers/glib/json_ui/builder/mouse_events.rb +29 -0
  5. data/app/helpers/glib/json_ui/list_builders.rb +3 -1
  6. data/app/helpers/glib/json_ui/menu_builder.rb +3 -30
  7. data/app/helpers/glib/json_ui/view_builder/banners.rb +2 -0
  8. data/app/helpers/glib/json_ui/view_builder/charts.rb +21 -21
  9. data/app/helpers/glib/json_ui/view_builder.rb +3 -4
  10. data/app/views/json_ui/garage/actions/_list.json.jbuilder +23 -0
  11. data/app/views/json_ui/garage/actions/_reload.json.jbuilder +5 -0
  12. data/app/views/json_ui/garage/actions/index.json.jbuilder +3 -23
  13. data/app/views/json_ui/garage/actions/partial_update.json.jbuilder +5 -0
  14. data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +40 -27
  15. data/app/views/json_ui/garage/lists/_autoload_section.json.jbuilder +1 -1
  16. data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +19 -12
  17. data/app/views/json_ui/garage/lists/reordering.json.jbuilder +1 -1
  18. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +15 -10
  19. data/app/views/json_ui/garage/panels/index.json.jbuilder +3 -3
  20. data/app/views/json_ui/garage/views/banners.json.jbuilder +42 -22
  21. data/app/views/json_ui/garage/views/charts.json.jbuilder +25 -15
  22. data/app/views/json_ui/garage/views/controls.json.jbuilder +36 -27
  23. data/app/views/json_ui/garage/views/index.json.jbuilder +2 -1
  24. data/app/views/json_ui/garage/views/shareButton.json.jbuilder +10 -0
  25. data/app/views/json_ui/garage/views/steppers.json.jbuilder +40 -0
  26. metadata +5 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72eecba2c1fe97bbb3ef6f0be03e4d0f79a23a4dcca8c7f16bf3d1be9083a5b7
4
- data.tar.gz: 526316d03db695e57c5a2a7e81110cb52f14d73ab5524ca7866c73a6e9230ffc
3
+ metadata.gz: f9f3512d884ca3fac7a8f0fa5022d65f256416b884bc457db8d9e93e050a622e
4
+ data.tar.gz: 07cc381dff74eb7bc55749fb715f5a416f4d14eb53d73b380c44a0e9c7e3949e
5
5
  SHA512:
6
- metadata.gz: fc68d49b58d90e62fa5c4f2cd82bbf2bde03123a63ecc3f3fe09875d8a886db320f0151c53c31cfc417d2cc88993f66b10350f2d9f00f8c70dda54bdccef1075
7
- data.tar.gz: e4faf34c6746d568277406474f5c75ce05f52c0ce262102879adf13ac595e8f03102a169047d9a9993f952d6d3978de6f22677b9068796d14cb1b3fba3b6d878
6
+ metadata.gz: c500d6e5efeb141d1c2765c17847b99acb6030366c381f136712ca954dfa6cc059b3e1c6fa2c1d3865d5d6e1d86bcd57c1ab4bfc8e0edc4f2e5361d2370febfa
7
+ data.tar.gz: d66702989b6708278973b8446006acef18fc746de0b1a019fed36e4a3d9306ebe09abb21daa072ec2525c7440be60c4a58060ef056170300bc9642883b9af188
@@ -47,6 +47,7 @@ class Glib::JsonUi::ActionBuilder
47
47
  string :fullscreen
48
48
  length :width
49
49
  length :height
50
+ bool :closeOnBlur
50
51
  end
51
52
 
52
53
  class Reload < Action
@@ -3,8 +3,10 @@ class Glib::JsonUi::ActionBuilder
3
3
  class Open < Action
4
4
  string :key
5
5
  views :childViews
6
- string :location
6
+ string :placement
7
7
  int :offset
8
+ int :width
9
+ singleton_array :styleClass, :styleClasses
8
10
  end
9
11
 
10
12
  class Close < Action
@@ -0,0 +1,29 @@
1
+ module Glib
2
+ module JsonUi
3
+ module Builder::MouseEvents
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ action :onMouseEnter
8
+ action :onMouseLeave
9
+ end
10
+
11
+ def tooltip(options)
12
+ key = "tooltip_#{SecureRandom.uuid}"
13
+ onMouseEnter ->(action) do
14
+ action.popovers_open(
15
+ key: key,
16
+ placement: options[:placement] || 'top',
17
+ childViews: ->(view) {
18
+ view.p styleClass: 'tooltip', text: options[:text]
19
+ }
20
+ )
21
+ end
22
+
23
+ onMouseLeave ->(action) do
24
+ action.popovers_close key: key
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -53,8 +53,10 @@ module Glib
53
53
  end
54
54
 
55
55
  class Thumbnail < Standard
56
- menu :leftOuterButtons
56
+ # menu :leftOuterButtons
57
57
  int :imageSize
58
+
59
+ panels_builder :content, :header, :footer, :right
58
60
  end
59
61
 
60
62
  class CommentOutgoing < Standard
@@ -6,36 +6,9 @@ module Glib
6
6
  end
7
7
 
8
8
  class MenuItem < JsonUiElement
9
- hash :analytics
10
-
11
- # def initialize(json, page)
12
- # super(json, page)
13
-
14
- # # Can be improved by making it configurable site-wide.
15
- # @analyticsEnabled = true
16
- # end
9
+ include Builder::MouseEvents
17
10
 
18
- # def analytics(value)
19
- # if value.is_a?(Hash)
20
- # @analyticsEnabled = true
21
- # @analyticsId = value
22
- # else
23
- # @analyticsEnabled = value == true
24
- # end
25
- # end
26
-
27
- # # Override
28
- # def created
29
- # json.analytics do
30
- # if @analyticsEnabled
31
- # if @analyticsId
32
- # json.placement @analyticsId
33
- # end
34
- # else
35
- # json.disabled true
36
- # end
37
- # end
38
- # end
11
+ hash :analytics
39
12
  end
40
13
 
41
14
  class Button < MenuItem
@@ -45,7 +18,7 @@ module Glib
45
18
  icon :icon
46
19
  action :onClick
47
20
  bool :disabled
48
- hash :tooltip
21
+ # hash :tooltip
49
22
  singleton_array :styleClass, :styleClasses
50
23
 
51
24
  def childButtons(block)
@@ -3,6 +3,7 @@ class Glib::JsonUi::ViewBuilder
3
3
 
4
4
  class Alert < View
5
5
  icon :icon
6
+ string :title
6
7
  string :message
7
8
  # string :message_format
8
9
  singleton_array :styleClass, :styleClasses
@@ -11,6 +12,7 @@ class Glib::JsonUi::ViewBuilder
11
12
  class Select < View
12
13
  string :id
13
14
  icon :icon
15
+ string :title
14
16
  string :message
15
17
  singleton_array :styleClass, :styleClasses
16
18
  color :color
@@ -12,11 +12,7 @@ class Glib::JsonUi::ViewBuilder
12
12
  end
13
13
  end
14
14
 
15
- class Line < View
16
- include ReleaseDateIndicator
17
-
18
- hash :nextPage
19
-
15
+ module Series
20
16
  def dataSeries(blocks)
21
17
  json.dataSeries do
22
18
  blocks.each do |block|
@@ -27,13 +23,6 @@ class Glib::JsonUi::ViewBuilder
27
23
  end
28
24
  end
29
25
 
30
- end
31
-
32
- class Column < View
33
- include ReleaseDateIndicator
34
-
35
- bool :stacked
36
-
37
26
  def dataGroups(blocks)
38
27
  json.dataGroups do
39
28
  blocks.each do |block|
@@ -45,16 +34,27 @@ class Glib::JsonUi::ViewBuilder
45
34
  end
46
35
  end
47
36
 
37
+ class Line < View
38
+ include Series
39
+
40
+ # idea for the future
41
+ # hash :nextPage
42
+ end
43
+
44
+ class Column < View
45
+ include Series
46
+
47
+ bool :stacked
48
+ end
49
+
48
50
  class Pie < View
49
- def dataSeries(blocks)
50
- json.dataSeries do
51
- blocks.each do |block|
52
- json.child! do
53
- block.call
54
- end
55
- end
56
- end
57
- end
51
+ include Series
52
+
58
53
  end
54
+
55
+ class Area < View
56
+ include Series
57
+ end
58
+
59
59
  end
60
60
  end
@@ -32,6 +32,8 @@ module Glib
32
32
  end
33
33
 
34
34
  class View < JsonUiElement
35
+ include Builder::MouseEvents
36
+
35
37
  string :id
36
38
  length :width
37
39
  length :height
@@ -41,12 +43,9 @@ module Glib
41
43
  hash :showIf
42
44
  hash :valueIf
43
45
  hash :analytics
44
- hash :tooltip
46
+ # hash :tooltip
45
47
  array :extensions
46
48
 
47
- action :onMouseEnter
48
- action :onMouseLeave
49
-
50
49
 
51
50
  # def initialize(json, page)
52
51
  # super(json, page)
@@ -0,0 +1,23 @@
1
+ panel.panels_list id: 'action_list', sections: [
2
+ ->(section) do
3
+ render "#{@path_prefix}/actions/reload", section: section
4
+ end, ->(section) do
5
+ render "#{@path_prefix}/actions/panels", section: section
6
+ end, ->(section) do
7
+ render "#{@path_prefix}/actions/dialogs", section: section
8
+ end, ->(section) do
9
+ render "#{@path_prefix}/actions/snackbars", section: section
10
+ end, ->(section) do
11
+ render "#{@path_prefix}/actions/sheets", section: section
12
+ end, ->(section) do
13
+ render "#{@path_prefix}/actions/windows", section: section
14
+ end, ->(section) do
15
+ render "#{@path_prefix}/actions/timeouts", section: section
16
+ end, ->(section) do
17
+ render "#{@path_prefix}/actions/http", section: section
18
+ end, ->(section) do
19
+ render "#{@path_prefix}/actions/commands", section: section
20
+ end, ->(section) do
21
+ render "#{@path_prefix}/actions/tours", section: section
22
+ end
23
+ ]
@@ -11,7 +11,12 @@ section.rows builder: ->(template) do
11
11
 
12
12
  reload_counter = params[:reload_counter].to_i
13
13
  reload_counter = 0 if reload_counter > 5
14
+
14
15
  template.thumbnail title: "windows/reload with URL (counter: #{reload_counter})", onClick: ->(action) do
15
16
  action.windows_reload url: json_ui_garage_url(path: 'actions/index', reload_counter: reload_counter + 1)
16
17
  end
18
+
19
+ template.thumbnail title: "components/update (counter: #{reload_counter})", onClick: ->(action) do
20
+ action.http_get url: json_ui_garage_url(path: 'actions/partial_update', reload_counter: reload_counter + 1)
21
+ end
17
22
  end
@@ -3,26 +3,6 @@ json.title 'Actions'
3
3
  page = json_ui_page json
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
5
5
 
6
- page.list sections: [
7
- ->(section) do
8
- render "#{@path_prefix}/actions/reload", section: section
9
- end, ->(section) do
10
- render "#{@path_prefix}/actions/panels", section: section
11
- end, ->(section) do
12
- render "#{@path_prefix}/actions/dialogs", section: section
13
- end, ->(section) do
14
- render "#{@path_prefix}/actions/snackbars", section: section
15
- end, ->(section) do
16
- render "#{@path_prefix}/actions/sheets", section: section
17
- end, ->(section) do
18
- render "#{@path_prefix}/actions/windows", section: section
19
- end, ->(section) do
20
- render "#{@path_prefix}/actions/timeouts", section: section
21
- end, ->(section) do
22
- render "#{@path_prefix}/actions/http", section: section
23
- end, ->(section) do
24
- render "#{@path_prefix}/actions/commands", section: section
25
- end, ->(section) do
26
- render "#{@path_prefix}/actions/tours", section: section
27
- end
28
- ]
6
+ page.scroll childViews: ->(scroll) do
7
+ render "#{@path_prefix}/actions/list", panel: scroll
8
+ end
@@ -0,0 +1,5 @@
1
+ json_ui_response_with_view json do |action|
2
+ action.components_update targetId: 'action_list', views: ->(update) do
3
+ render "#{@path_prefix}/actions/list", panel: update
4
+ end
5
+ end
@@ -4,32 +4,45 @@ page = json_ui_page json
4
4
 
5
5
  render "#{@path_prefix}/nav_menu", json: json, page: page
6
6
 
7
- page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
8
- form.fields_text name: 'user[name]', width: 'matchParent', label: 'Search', placeholder: 'Enter a keyword', styleClasses: ['outlined', 'rounded']
9
-
10
- form.spacer height: 14
11
- form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password', placeholder: 'Type your password', styleClass: 'outlined'
12
-
13
- form.spacer height: 14
14
- form.fields_textarea name: 'user[bio]', width: 'matchParent', label: 'Bio', placeholder: 'Enter your bio', styleClasses: ['outlined']
15
-
16
- # form.spacer height: 14
17
- # form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
18
-
19
- # form.spacer height: 14
20
- # form.fields_stripeToken name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
21
-
22
- form.spacer height: 14
23
- form.fields_creditCard name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
24
-
25
- form.spacer height: 14
26
- form.fields_creditCard name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
27
-
28
- form.spacer height: 14
29
- form.panels_split width: 'matchParent', content: ->(split) do
30
- split.right childViews: ->(right) do
31
- right.fields_submit text: 'Submit'
7
+ page.form \
8
+ url: json_ui_garage_url(path: 'forms/basic_post'),
9
+ method: 'post',
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(form) do
12
+ form.fields_text \
13
+ name: 'user[name]',
14
+ width: 'matchParent',
15
+ label: 'Search',
16
+ placeholder: 'Enter a keyword',
17
+ styleClasses: ['outlined', 'rounded']
18
+
19
+ form.spacer height: 14
20
+ form.fields_password \
21
+ name: 'user[password]',
22
+ width: 'matchParent',
23
+ label: 'Password',
24
+ placeholder: 'Type your password',
25
+ styleClasses: ['outlined', 'compact']
26
+
27
+ form.spacer height: 14
28
+ form.fields_textarea name: 'user[bio]', width: 'matchParent', label: 'Bio', placeholder: 'Enter your bio', styleClasses: ['outlined']
29
+
30
+ # form.spacer height: 14
31
+ # form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
32
+
33
+ # form.spacer height: 14
34
+ # form.fields_stripeToken name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
35
+
36
+ form.spacer height: 14
37
+ form.fields_creditCard name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
38
+
39
+ form.spacer height: 14
40
+ form.fields_creditCard name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
41
+
42
+ form.spacer height: 14
43
+ form.panels_split width: 'matchParent', content: ->(split) do
44
+ split.right childViews: ->(right) do
45
+ right.fields_submit text: 'Submit'
46
+ end
32
47
  end
33
48
  end
34
-
35
- end
@@ -11,7 +11,7 @@ section.rows builder: ->(row) do
11
11
  array.each do |i|
12
12
  index = page_index * batch_count + i
13
13
  if local_assigns[:reorder]
14
- row.thumbnail title: "Item #{index}"
14
+ row.thumbnail title: "Item #{index}", id: "item_#{index}"
15
15
  else
16
16
  row.thumbnail title: "Item #{index}", subtitle: "Sub Item #{index}", subsubtitle: "Sub Sub Item #{index}"
17
17
  end
@@ -2,7 +2,7 @@ json.title 'Lists'
2
2
 
3
3
  page_index = params[:page].to_i
4
4
  if page_index > 2
5
- page_index = 2
5
+ page_index = 0
6
6
  end
7
7
  page = json_ui_page json
8
8
  render "#{@path_prefix}/nav_menu", json: json, page: page
@@ -13,26 +13,33 @@ page.list firstSection: ->(section) do
13
13
  title: 'Click menu (web) or swipe left (Android/iOS)',
14
14
  subtitle: "Page index: #{page_index}",
15
15
  leftButtons: ->(menu) do
16
- menu.button styleClass: 'icon', icon: 'check_box', onClick: ->(subaction) do
17
- subaction.dialogs_alert message: 'Tick/untick'
18
- end
16
+ menu.button \
17
+ styleClasses: ['icon', 'text', 'x-small'],
18
+ icon: 'check_box',
19
+ onClick: ->(subaction) do
20
+ subaction.dialogs_alert message: 'Tick/untick'
21
+ end
19
22
  end, rightButtons: ->(menu) do
20
23
  menu.button \
21
- styleClass: 'icon',
24
+ styleClasses: ['icon', 'text', 'x-small'],
22
25
  icon: 'share',
23
- tooltip: { text: 'Share' },
24
- childButtons: ->(submenu) do
25
- submenu.button text: 'Dropdown item 1'
26
- submenu.button text: 'Dropdown item 2'
27
- submenu.button text: 'Dropdown item 3'
28
- end
26
+ tooltip: { text: 'Share', location: 'left' }
27
+
28
+ # TODO: Use popoever
29
+ # childButtons: ->(submenu) do
30
+ # submenu.button text: 'Dropdown item 1'
31
+ # submenu.button text: 'Dropdown item 2'
32
+ # submenu.button text: 'Dropdown item 3'
33
+ # end
34
+
29
35
  menu.button \
30
- styleClass: 'icon',
36
+ styleClasses: ['icon', 'text', 'x-small'],
31
37
  icon: 'open_in_new',
32
38
  tooltip: { text: 'Open in new window' },
33
39
  onClick: ->(subaction) do
34
40
  subaction.dialogs_alert message: 'Open'
35
41
  end
42
+
36
43
  end, editButtons: ->(menu) do
37
44
  menu.button text: "Edit (ID: #{page_index})", onClick: ->(action) do
38
45
  action.dialogs_alert message: 'Perform Edit action'
@@ -18,7 +18,7 @@ else
18
18
 
19
19
  render "#{@path_prefix}/nav_menu", json: json, page: page
20
20
 
21
- page.list nextPage: next_page, sections: [
21
+ page.list id: 'orderable_list', nextPage: next_page, sections: [
22
22
  ->(section) do
23
23
  section.header padding: glib_json_padding_list, childViews: ->(header) do
24
24
  header.h3 text: 'Section One'
@@ -133,16 +133,21 @@ json_ui_page json do |page|
133
133
 
134
134
  scroll.spacer height: 20
135
135
  scroll.h1 text: 'Drag-and-drop support'
136
- scroll.panels_horizontal backgroundColor: '#b3bac2', width: 300, distribution: 'spaceEqually', childViews: ->(panel) do
137
- panel.button id: 'button1', text: '1'
138
- panel.button id: 'button2', text: '2'
139
- panel.button id: 'button3', text: '3'
140
- end, dragSupport: {
141
- onDrop: {
142
- action: 'dialogs/alert',
143
- },
144
- paramNameForFormData: 'message'
145
- }
136
+ scroll.panels_horizontal \
137
+ backgroundColor: '#b3bac2',
138
+ id: 'orderable_panel',
139
+ width: 300,
140
+ distribution: 'spaceEqually',
141
+ childViews: ->(panel) do
142
+ panel.button id: 'button1', text: '1'
143
+ panel.button id: 'button2', text: '2'
144
+ panel.button id: 'button3', text: '3'
145
+ end, dragSupport: {
146
+ onDrop: {
147
+ action: 'dialogs/alert',
148
+ },
149
+ paramNameForFormData: 'message'
150
+ }
146
151
 
147
152
  scroll.label text: "\n"
148
153
  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
@@ -8,43 +8,63 @@ json_ui_page json do |page|
8
8
  scroll.spacer height: 20
9
9
  scroll.h2 text: 'Basic'
10
10
  scroll.spacer height: 6
11
- scroll.banners_alert width: 'matchParent', icon: 'info', message: 'This is an alert banner'
11
+ scroll.banners_alert \
12
+ width: 'matchParent',
13
+ icon: 'info',
14
+ title: 'Title',
15
+ message: 'This is an alert banner'
12
16
 
13
17
  scroll.spacer height: 20
14
18
  scroll.h2 text: 'With color styling'
15
19
  scroll.spacer height: 6
16
- scroll.banners_alert width: 'matchParent', icon: 'info', message: 'This is an alert banner', styleClass: 'success'
20
+ scroll.banners_alert \
21
+ width: 'matchParent',
22
+ icon: 'info',
23
+ message: 'This is an alert banner',
24
+ styleClass: 'success'
25
+
26
+ # scroll.banners_alert \
27
+ # width: 'matchParent',
28
+ # icon: 'info',
29
+ # message: 'This is an alert banner',
30
+ # styleClass: 'warning'
17
31
 
18
32
  scroll.spacer height: 20
19
33
  scroll.h2 text: 'With select options'
20
34
  scroll.spacer height: 6
21
- scroll.banners_select width: 'matchParent', icon: 'info', message: 'This is a select banner', buttons: ->(menu) do
22
- menu.button icon: 'add', text: 'Add', badge: { text: 80 }, onClick: ->(action) do
23
- action.windows_open url: json_ui_garage_url(path: 'home/blank')
24
- end
25
- menu.button icon: 'edit', text: 'Edit', onClick: ->(action) do
26
- action.windows_open url: json_ui_garage_url(path: 'home/slow')
27
- end
28
- menu.button icon: 'delete', text: 'Delete', onClick: ->(action) do
29
- action.dialogs_alert message: 'Alert'
30
- end
31
-
32
- menu.button icon: 'more_vert', childButtons: ->(submenu) do
33
- submenu.button \
34
- icon: 'add',
35
- text: 'Option1',
36
- badge: { text: 3 },
37
- onClick: ->(action) do
35
+ scroll.banners_select \
36
+ styleClass: 'warning',
37
+ width: 'matchParent',
38
+ icon: 'info',
39
+ title: 'Title',
40
+ message: 'This is a select banner',
41
+ buttons: ->(menu) do
42
+ menu.button icon: 'add', text: 'Add', badge: { text: 80 }, onClick: ->(action) do
38
43
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
39
44
  end
40
- submenu.button icon: 'edit', text: 'Option2', onClick: ->(action) do
45
+ menu.button icon: 'edit', text: 'Edit', onClick: ->(action) do
41
46
  action.windows_open url: json_ui_garage_url(path: 'home/slow')
42
47
  end
43
- submenu.button icon: 'delete', text: 'Long Option3', onClick: ->(action) do
48
+ menu.button icon: 'delete', text: 'Delete', onClick: ->(action) do
44
49
  action.dialogs_alert message: 'Alert'
45
50
  end
51
+
52
+ menu.button icon: 'more_vert', childButtons: ->(submenu) do
53
+ submenu.button \
54
+ icon: 'add',
55
+ text: 'Option1',
56
+ badge: { text: 3 },
57
+ onClick: ->(action) do
58
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
59
+ end
60
+ submenu.button icon: 'edit', text: 'Option2', onClick: ->(action) do
61
+ action.windows_open url: json_ui_garage_url(path: 'home/slow')
62
+ end
63
+ submenu.button icon: 'delete', text: 'Long Option3', onClick: ->(action) do
64
+ action.dialogs_alert message: 'Alert'
65
+ end
66
+ end
46
67
  end
47
- end
48
68
 
49
69
  scroll.spacer height: 20
50
70
  scroll.h2 text: 'Alert banner with frameless styling (Experimental)'
@@ -12,18 +12,8 @@ else
12
12
  render "#{@path_prefix}/nav_menu", json: json, page: page
13
13
 
14
14
  page.scroll padding: { top: 20, left: 20, right: 20, bottom: 20 }, childViews: ->(scroll) do
15
- scroll.h1 text: 'Line chart'
16
- scroll.charts_line lineVertical: [
17
- -> do
18
- json.text 'A feature released'
19
- json.x Date.new(2018, 11, 15)
20
- end,
21
- -> do
22
- json.text 'A feature released'
23
- json.x Date.new(2018, 11, 13)
24
- end
25
- ],
26
- dataSeries: [
15
+ scroll.h2 text: 'Line chart'
16
+ scroll.charts_line dataSeries: [
27
17
  -> do
28
18
  json.title 'Line 1'
29
19
 
@@ -54,9 +44,9 @@ else
54
44
  end
55
45
  ]
56
46
 
57
- scroll.spacer height: 20
58
- scroll.h1 text: 'Line chart using remote data'
59
- render "#{@path_prefix}/views/chart_data", json: json, builder: scroll
47
+ # scroll.spacer height: 20
48
+ # scroll.h1 text: 'Line chart using remote data'
49
+ # render "#{@path_prefix}/views/chart_data", json: json, builder: scroll
60
50
 
61
51
  scroll.h2 text: 'Column chart (Clustered)'
62
52
  scroll.charts_column dataGroups: [
@@ -131,6 +121,26 @@ else
131
121
  json.value 25
132
122
  end
133
123
  ]
124
+
125
+ scroll.h2 text: 'Area chart'
126
+ scroll.charts_area dataSeries: [
127
+ -> do
128
+ json.title 'Jan'
129
+ json.value 25
130
+ end,
131
+ -> do
132
+ json.title 'Feb'
133
+ json.value 55
134
+ end,
135
+ -> do
136
+ json.title 'Mar'
137
+ json.value 60
138
+ end,
139
+ -> do
140
+ json.title 'June'
141
+ json.value 20
142
+ end
143
+ ]
134
144
  end
135
145
  end
136
146
 
@@ -12,9 +12,12 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
12
12
  end
13
13
 
14
14
  scroll.spacer height: 10
15
- scroll.button text: 'Button with built-in classes', styleClasses: ['rounded', 'outlined', 'tile', 'depressed'], onClick: ->(action) do
16
- action.dialogs_alert message: 'Perform action'
17
- end
15
+ scroll.button \
16
+ text: 'Button with built-in classes',
17
+ styleClasses: ['rounded', 'outlined', 'tile', 'depressed', 'small'],
18
+ onClick: ->(action) do
19
+ action.dialogs_alert message: 'Perform action'
20
+ end
18
21
 
19
22
  scroll.spacer height: 10
20
23
  scroll.button \
@@ -30,7 +33,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
30
33
  scroll.button text: 'Button with dropdown', onClick: ->(action) do
31
34
  action.popovers_open \
32
35
  key: 'menu',
33
- location: 'bottom',
36
+ placement: 'left',
34
37
  childViews: ->(view) do
35
38
  view.panels_responsive styleClass: 'popover-menu', width: 200, childViews: ->(res) do
36
39
  res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
@@ -49,28 +52,22 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
49
52
  scroll.spacer height: 10
50
53
  scroll.button \
51
54
  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' },
55
+ tooltip: { text: 'Tooltip 1' },
59
56
  onClick: ->(action) do
60
57
  action.popovers_open \
61
58
  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
59
+ placement: 'bottom-start',
60
+ styleClass: 'popover-menu',
61
+ width: 200,
62
+ childViews: ->(res) do
63
+ res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
64
+ saction.popovers_close key: 'menu'
65
+ end
66
+ res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
67
+ saction.popovers_close key: 'menu'
68
+ end
69
+ res.label text: 'Item 3 with very very very very very long name', styleClass: 'popover-menu-item', onClick: ->(saction) do
70
+ saction.popovers_close key: 'menu'
74
71
  end
75
72
  end
76
73
  end
@@ -81,7 +78,14 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
81
78
  styleClasses: ['icon', 'plain'],
82
79
  tooltip: { text: 'Disabled Icon button with tooltip text and custom tooltip position', position: 'right' },
83
80
  disabled: true
81
+
84
82
  scroll.spacer height: 20
83
+ scroll.button \
84
+ icon: 'info',
85
+ styleClasses: ['icon', 'text'],
86
+ onClick: ->(action) do
87
+ action.dialogs_alert message: 'Perform action'
88
+ end
85
89
 
86
90
 
87
91
 
@@ -93,11 +97,16 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
93
97
  text: 'Success',
94
98
  tooltip: { text: 'Tooltip text' }
95
99
  scroll.spacer height: 10
96
- scroll.chip text: 'With Action', onClick: ->(action) do
97
- action.dialogs_alert message: 'Perform action'
98
- end
100
+ scroll.chip \
101
+ text: 'With Action',
102
+ onClick: ->(action) do
103
+ action.dialogs_alert message: 'Perform action'
104
+ end
99
105
  scroll.spacer height: 10
100
- scroll.chip text: 'With Badge', badge: { text: '99' }
106
+ scroll.chip \
107
+ text: 'With Badge',
108
+ styleClasses: ['compact'],
109
+ badge: { text: '99' }
101
110
 
102
111
  scroll.spacer height: 20
103
112
  scroll.h2 text: 'Switch'
@@ -10,7 +10,8 @@ json_ui_page json do |page|
10
10
  end
11
11
 
12
12
  section.rows builder: ->(template) do
13
- ['texts', 'controls', 'images', 'multimedia', 'charts', 'banners', 'maps', 'misc', 'icons', 'progress', 'shareButton'].each do |component|
13
+ ['texts', 'controls', 'images', 'multimedia', 'charts', 'banners',
14
+ 'maps', 'misc', 'icons', 'progress', 'shareButton', 'steppers'].each do |component|
14
15
  template.thumbnail title: component.humanize, onClick: ->(action) do
15
16
  action.windows_open url: json_ui_garage_url(path: "views/#{component}")
16
17
  end
@@ -21,6 +21,16 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
21
21
 
22
22
  f.spacer width: 10
23
23
 
24
+ f.shareButton \
25
+ network: 'email',
26
+ url: '',
27
+ text: 'Email',
28
+ onClick: ->(action) do
29
+ action.windows_openWeb url: 'mailto://test@email.com'
30
+ end
31
+
32
+ f.spacer width: 10
33
+
24
34
  # For testing: https://developers.facebook.com/tools/debug/
25
35
  f.shareButton \
26
36
  network: 'facebook',
@@ -0,0 +1,40 @@
1
+ json.title 'Views'
2
+
3
+ page = json_ui_page json
4
+
5
+ render "#{@path_prefix}/nav_menu", json: json, page: page
6
+
7
+ page.scroll padding: { top: 20, left: 20, right: 20, bottom: 20 }, childViews: ->(scroll) do
8
+ scroll.h1 text: 'Steppers'
9
+
10
+ # scroll.spacer height: 20
11
+ # scroll.h1 text: 'Line chart using remote data'
12
+ # render "#{@path_prefix}/views/chart_data", json: json, builder: scroll
13
+
14
+ # data = {
15
+ # divider_icon: 'arrow_forward',
16
+ # steps: [*1..5].map do |index|
17
+ # {
18
+ # detail: "Item #{index}",
19
+ # url: root_url
20
+ # }
21
+ # end,
22
+ # show_numbers: true,
23
+ # small: true
24
+ # }
25
+
26
+ # # scroll.h2 text: 'Pie chart'
27
+ # scroll.stepper dataSeries: [
28
+ # -> do
29
+ # json.title 'Straberry'
30
+ # json.value 25
31
+
32
+ # # json.title 'Straberry'
33
+ # # json.value 25
34
+ # end,
35
+ # -> do
36
+ # json.title 'Banana'
37
+ # json.value 25
38
+ # end
39
+ # ]
40
+ 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: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -104,6 +104,7 @@ files:
104
104
  - app/helpers/glib/json_ui/action_builder/tours.rb
105
105
  - app/helpers/glib/json_ui/action_builder/windows.rb
106
106
  - app/helpers/glib/json_ui/analytics_helper.rb
107
+ - app/helpers/glib/json_ui/builder/mouse_events.rb
107
108
  - app/helpers/glib/json_ui/dynamic_field_builders.rb
108
109
  - app/helpers/glib/json_ui/generic_builders.rb
109
110
  - app/helpers/glib/json_ui/list_builders.rb
@@ -135,6 +136,7 @@ files:
135
136
  - app/views/json_ui/garage/actions/_dialogs.json.jbuilder
136
137
  - app/views/json_ui/garage/actions/_dialogs_show.json.jbuilder
137
138
  - app/views/json_ui/garage/actions/_http.json.jbuilder
139
+ - app/views/json_ui/garage/actions/_list.json.jbuilder
138
140
  - app/views/json_ui/garage/actions/_panels.json.jbuilder
139
141
  - app/views/json_ui/garage/actions/_reload.json.jbuilder
140
142
  - app/views/json_ui/garage/actions/_sheets.json.jbuilder
@@ -144,6 +146,7 @@ files:
144
146
  - app/views/json_ui/garage/actions/_windows.json.jbuilder
145
147
  - app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder
146
148
  - app/views/json_ui/garage/actions/index.json.jbuilder
149
+ - app/views/json_ui/garage/actions/partial_update.json.jbuilder
147
150
  - app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder
148
151
  - app/views/json_ui/garage/forms/_conditional_banner.json.jbuilder
149
152
  - app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder
@@ -263,6 +266,7 @@ files:
263
266
  - app/views/json_ui/garage/views/multimedia.json.jbuilder
264
267
  - app/views/json_ui/garage/views/progress.json.jbuilder
265
268
  - app/views/json_ui/garage/views/shareButton.json.jbuilder
269
+ - app/views/json_ui/garage/views/steppers.json.jbuilder
266
270
  - app/views/json_ui/garage/views/texts.json.jbuilder
267
271
  - app/views/layouts/json_ui/renderer.html.erb
268
272
  - config/routes.rb