glib-web 2.3.0 → 2.4.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: 0c537eef969f4edd210d5d6e860159a3517ca21b73a6f07319dac16018ce540f
4
- data.tar.gz: e7bdd1d06693de1579161644e398764b36ef52d3fb2c58fb079cb69773e04507
3
+ metadata.gz: 416ab4888b4ca5e16220519fb9f1dc56999d91be403a2f14c464386f4b586604
4
+ data.tar.gz: b6e8f65a85f9542b9a3a8e865d52a36860d7acb95cdc930918e379b290ba0e66
5
5
  SHA512:
6
- metadata.gz: bbf1641068355fb28a11156817b9e531bd72b569d2108de505702c36b864c38671ead9c061999c1bedf988f25b259f8f2d739e3a795ed63bb848dd0f2921d6a3
7
- data.tar.gz: 8294874f0b0718322f718f8b53cb33707ec0b95e828158ca1cbfe818582852d8f58111b0abefe21dabb9778820bb18d4746048f635849a99dcc587145423f17f
6
+ metadata.gz: d2705c8939f81dcd503c8d7c77c5f70d157df9645123b4ca1f56fefe351bbafdeee4485cfaa31838a2e001f18cd05ae8776c44a7569b8c1c892838f17eace3ed
7
+ data.tar.gz: 1dcb659e7c9587137eef9aebfa1743e62edf6c427855a653fd6b12d71c827d5a32fb2e6131011cd80914f505bd6d140c07f61aaa9c4b60d301cb7f729772a1f5
@@ -18,6 +18,15 @@ module Glib
18
18
  margin-right: auto;
19
19
  margin-left: auto;
20
20
  }
21
+
22
+ .rounded-corner {
23
+ border-radius: 16px;
24
+ }
25
+
26
+ /* Make sure the hover highlight effect also has rounded corners */
27
+ .rounded-corner:hover:after {
28
+ border-radius: 16px;
29
+ }
21
30
  </style>
22
31
  eos
23
32
 
@@ -45,6 +45,7 @@ module Glib
45
45
  icon :icon
46
46
  action :onClick
47
47
  bool :disabled
48
+ hash :tooltip
48
49
  singleton_array :styleClass, :styleClasses
49
50
 
50
51
  def childButtons(block)
@@ -5,6 +5,10 @@ class Glib::JsonUi::ViewBuilder
5
5
  string :paramNameForFormData
6
6
  bool :local
7
7
 
8
+ # TODO: Enable this when we know it won't break existing apps.
9
+ # Even for pure client-side apps, this is required because form.validate() requires a URL to construct form data.
10
+ # required :url
11
+
8
12
  def is_array_association?(prop)
9
13
  # # Not all model is ActiveRecord
10
14
  # if @model.class.respond_to?(:reflect_on_association)
@@ -192,6 +192,12 @@ module Glib
192
192
  action :onClick
193
193
  color :color
194
194
  bool :disabled
195
+
196
+ def childButtons(block)
197
+ json.childButtons do
198
+ block.call page.menu_builder
199
+ end
200
+ end
195
201
  end
196
202
 
197
203
  class Fab < View
@@ -279,7 +285,7 @@ module Glib
279
285
 
280
286
  class ProgressCircle < View
281
287
  int :rotate # from 0 to 360
282
- int :size
288
+ int :size
283
289
  int :value # from 0 to 100
284
290
  color :color
285
291
  string :text
@@ -22,6 +22,11 @@ module Glib
22
22
  soft_destroy_record
23
23
  end
24
24
 
25
+ # More explicit naming which is sometimes useful for readability.
26
+ def soft_destroy
27
+ soft_destroy_record
28
+ end
29
+
25
30
  # Revive a soft-deleted record and associated records if soft-deleted,
26
31
  # otherwise return self
27
32
  def revive
@@ -17,12 +17,22 @@ page.list firstSection: ->(section) do
17
17
  subaction.dialogs_alert message: 'Tick/untick'
18
18
  end
19
19
  end, rightButtons: ->(menu) do
20
- menu.button styleClass: 'icon', icon: 'share', onClick: ->(subaction) do
21
- subaction.dialogs_alert message: 'Share'
22
- end
23
- menu.button styleClass: 'icon', icon: 'open_in_new', onClick: ->(subaction) do
24
- subaction.dialogs_alert message: 'Open'
25
- end
20
+ menu.button \
21
+ styleClass: 'icon',
22
+ 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
29
+ menu.button \
30
+ styleClass: 'icon',
31
+ icon: 'open_in_new',
32
+ tooltip: { text: 'Open in new window' },
33
+ onClick: ->(subaction) do
34
+ subaction.dialogs_alert message: 'Open'
35
+ end
26
36
  end, editButtons: ->(menu) do
27
37
  menu.button text: "Edit (ID: #{page_index})", onClick: ->(action) do
28
38
  action.dialogs_alert message: 'Perform Edit action'
@@ -123,6 +123,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
123
123
  scroll.spacer height: 8
124
124
  scroll.panels_responsive \
125
125
  backgroundColor: '#c3cad2',
126
+ styleClasses: ['rounded-corner'],
126
127
  padding: { left: 20, right: 20, top: 10, bottom: 10 },
127
128
  tooltip: { text: 'Tooltip text' },
128
129
  childViews: ->(responsive) do
@@ -7,7 +7,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  timeline_items = [
8
8
  { icon: 'place', color: '#4BB543' },
9
9
  { icon: 'check_circle', color: 'blue' },
10
- { icon: 'hourglass_empty', color: 'blue', label: 'Pending' },
10
+ { icon: 'hourglass_empty', color: 'blue', text: 'Pending' },
11
11
  { icon: 'radio_button_unchecked' },
12
12
  { icon: 'radio_button_unchecked' },
13
13
  ]
@@ -32,16 +32,15 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
32
32
  end
33
33
 
34
34
  timeline_items = [
35
- { icon: 'place', color: '#4BB543' },
36
- { icon: 'check_circle', color: 'blue' },
37
- { icon: 'check_circle', color: 'blue' },
38
- { icon: 'check_circle', color: 'blue' },
39
- { icon: 'flag', color: '#FFA500' },
35
+ { icon: 'place', color: '#4BB543', styleClasses: ['outlined'] },
36
+ { icon: 'check_circle', color: 'blue', styleClasses: ['outlined'] },
37
+ { icon: 'check_circle', color: 'blue', styleClasses: ['outlined'] },
38
+ { icon: 'check_circle', color: 'blue', styleClasses: ['outlined'] },
39
+ { icon: 'flag', color: '#FFA500', styleClasses: ['outlined'] },
40
40
  ]
41
41
 
42
42
  scroll.h2 text: 'Timeline with outlined dots'
43
43
  scroll.panels_timeline \
44
- styleClasses: ['outlined', 'icon-on-mdAndUp'],
45
44
  events: timeline_items,
46
45
  childViews: ->(timeline) do
47
46
  timeline.panels_vertical childViews: ->(vertical) do
@@ -74,4 +73,15 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
74
73
  timeline.label text: '1 minute ago'
75
74
  end
76
75
  end
76
+
77
+ timeline_items = [
78
+ { backgroundColor: 'blue', styleClasses: ['small'] },
79
+ { backgroundColor: 'blue', styleClasses: ['small'] },
80
+ { backgroundColor: 'blue', color: 'white', text: '3' },
81
+ { backgroundColor: 'white', icon: 'radio_button_unchecked', styleClasses: ['small'] },
82
+ { backgroundColor: 'white', icon: 'radio_button_unchecked', styleClasses: ['small'] },
83
+ ]
84
+
85
+ scroll.h2 text: 'Timeline without content'
86
+ scroll.panels_timeline events: timeline_items
77
87
  end
@@ -37,9 +37,29 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
37
37
  ul.button text: 'Level 1', styleClass: 'link', onClick: ->(action) do
38
38
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
39
39
  end
40
- ul.button text: 'Level 2', styleClass: 'link', onClick: ->(action) do
41
- action.windows_open url: json_ui_garage_url(path: 'home/blank')
40
+ # ul.button text: 'Level 2', styleClass: 'link', childButtons: ->(menu) do
41
+ # menu.button text: 'Dropdown item 1'
42
+ # menu.button text: 'Dropdown item 2'
43
+ # menu.button text: 'Dropdown item 3'
44
+ # end
45
+
46
+ ul.button icon: 'keyboard_arrow_down', text: 'Level 2', styleClass: 'link', childButtons: ->(menu) do
47
+ menu.button text: 'Dropdown item 1'
48
+ menu.button text: 'Dropdown item 2'
49
+ menu.button text: 'Dropdown item 3'
42
50
  end
51
+ # , onClick: ->(action) do
52
+ # action.windows_open url: json_ui_garage_url(path: 'home/blank')
53
+ # end
43
54
  ul.label text: 'Level 3'
44
55
  end
56
+
57
+ scroll.button icon: 'keyboard_arrow_down', text: 'Sign in', styleClasses: ['link'], onClick: ->(action) do
58
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
59
+ end
60
+ scroll.button icon: 'keyboard_arrow_down', text: 'Sign in', styleClass: 'link', childButtons: ->(menu) do
61
+ menu.button text: 'Dropdown item 1'
62
+ menu.button text: 'Dropdown item 2'
63
+ menu.button text: 'Dropdown item 3'
64
+ end
45
65
  end
@@ -25,8 +25,22 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
25
25
  onClick: ->(action) do
26
26
  action.dialogs_alert message: 'Perform action'
27
27
  end
28
- scroll.spacer height: 20
29
28
 
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'
34
+ end
35
+
36
+ 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
42
+
43
+ scroll.spacer height: 20
30
44
  scroll.button \
31
45
  icon: 'info',
32
46
  styleClass: 'icon',
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.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''