glib-web 0.2.7 → 0.2.8

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
  SHA1:
3
- metadata.gz: d1d23736ab1385ea517451aa33bebd883ef4b435
4
- data.tar.gz: 2e0924b9b4aeaca57659e55d5c9f9a4ee5bf08f6
3
+ metadata.gz: 71ebbfa315c624f4e03a9f817173ae0ef3828b2f
4
+ data.tar.gz: c9c83fd55418f5dc5e54734a8c10b13fc6e10fab
5
5
  SHA512:
6
- metadata.gz: 648ab483946b51659c3f2c3039ada0427655ef1a722ed75cf51b48e643bb40d1927b04f7398bd063abc44abe47f49198b2d1c883863afe0df4fbd747893c8591
7
- data.tar.gz: 340c83ff4c79a0146d55323e81a195d10235d5d2c8f393321e7a7c2826079cf3bb37bd85a759fb8f0e37aa89a2b3058dae9128e969e717c14f9d738676fbbb18
6
+ metadata.gz: 86f2ad586d632b40c5308585692461134229d84629adb9b8ffd2ddc9b2694c57d7c199226417190bb835a9464d2a2d68f6142efd01fdf3659e45925a6fe95554
7
+ data.tar.gz: 156523cc553b9b31b504e0c13cf1ea0862e0b7bbe183a6b91de6b592716c5b0cdead9cb86bd536a9eca67f38656b2a177d18a5aa9b7eb912e119ceba4831eeac
@@ -3,7 +3,6 @@ module Glib
3
3
 
4
4
  def json_ui_garage
5
5
  @path_prefix = 'json_ui/garage'
6
- @sample_image_url = 'https://cdn-images-1.medium.com/max/1200/1*Qc0XxYm-qAZL-7tjjlNfrg.png'
7
6
 
8
7
  # We can't use prepend_view_path because it affects the app, not the gem
9
8
  path = "#{@path_prefix}/#{params[:path] || 'home/index'}"
@@ -148,10 +148,26 @@ module Glib
148
148
  end
149
149
 
150
150
  def self.icon propName
151
- define_method(propName) do |value|
152
- json.set!(propName) do
153
- json.materialName value
154
- end
151
+ define_method(propName) do |value|
152
+ if value.is_a?(Hash)
153
+ json.set!(propName) do
154
+ json.set value[:set] || 'material'
155
+ json.name value[:name]
156
+
157
+ if (badge = value[:badge]).is_a?(Hash)
158
+ json.badge badge
159
+ else
160
+ json.badge do
161
+ json.text badge
162
+ end
163
+ end
164
+
165
+ end
166
+ else
167
+ json.set!(propName) do
168
+ json.name value
169
+ end
170
+ end
155
171
  end
156
172
  end
157
173
 
@@ -12,6 +12,14 @@ module Glib
12
12
  def json_padding_body_this
13
13
  { top: 6, right: 10, bottom: 6, left: 10 }
14
14
  end
15
+
16
+ def json_image_standard_url
17
+ 'https://cdn-images-1.medium.com/max/1200/1*Qc0XxYm-qAZL-7tjjlNfrg.png'
18
+ end
19
+
20
+ def json_image_avatar_url
21
+ 'https://www.wpjournalist.nl/wp-content/uploads/2019/03/avatar-jongen-voorbeeld-1.jpg'
22
+ end
15
23
  end
16
24
  end
17
25
  end
@@ -22,7 +22,7 @@ module Glib
22
22
 
23
23
  class H1 < View
24
24
  string :text
25
- action :onClick
25
+ # action :onClick
26
26
  end
27
27
 
28
28
  class H2 < View
@@ -37,9 +37,6 @@ module Glib
37
37
  string :text
38
38
  end
39
39
 
40
- # class Br < View
41
- # end
42
-
43
40
  class Spacer < View
44
41
  end
45
42
 
@@ -28,7 +28,7 @@ class Glib::JsonUi::ViewBuilder
28
28
  end
29
29
 
30
30
  class Text < AbstractField
31
- int :maxlength
31
+ int :maxLength
32
32
  bool :readOnly
33
33
  end
34
34
 
@@ -88,7 +88,12 @@ class Glib::JsonUi::ViewBuilder
88
88
 
89
89
  class RadioGroup < View
90
90
  string :name
91
+ string :value
91
92
  views :childViews
93
+
94
+ string :iconOfBeforeSelected
95
+ string :iconOfSelected
96
+ string :iconOfAfterSelected
92
97
  end
93
98
 
94
99
  class Radio < View
@@ -124,6 +124,7 @@ class Glib::JsonUi::ViewBuilder
124
124
  class Vertical < View
125
125
  views :childViews
126
126
  string :distribution
127
+ string :align
127
128
  end
128
129
 
129
130
  class Horizontal < View
@@ -3,7 +3,7 @@ if local_assigns[:top_nav] || json_ui_app_is_web?
3
3
 
4
4
  page.leftDrawer content: ->(drawer) do
5
5
  drawer.header childViews: ->(header) do
6
- header.h1 text: 'App', onClick: ->(action) do
6
+ header.button text: 'App', onClick: ->(action) do
7
7
  action.windows_open url: root_url
8
8
  end
9
9
  end
@@ -14,6 +14,10 @@ if local_assigns[:top_nav] || json_ui_app_is_web?
14
14
  action.windows_open url: json_ui_garage_url(path: 'pages/index')
15
15
  end
16
16
 
17
+ menu.button text: 'Panels', onClick: ->(action) do
18
+ action.windows_open url: json_ui_garage_url(path: 'panels/index')
19
+ end
20
+
17
21
  menu.button text: 'Lists', onClick: ->(action) do
18
22
  action.windows_open url: json_ui_garage_url(path: 'lists/index')
19
23
  end
@@ -22,10 +26,6 @@ if local_assigns[:top_nav] || json_ui_app_is_web?
22
26
  action.windows_open url: json_ui_garage_url(path: 'forms/index')
23
27
  end
24
28
 
25
- menu.button text: 'Panels', onClick: ->(action) do
26
- action.windows_open url: json_ui_garage_url(path: 'panels/index')
27
- end
28
-
29
29
  menu.button text: 'Views', onClick: ->(action) do
30
30
  action.windows_open url: json_ui_garage_url(path: 'views/index')
31
31
  end
@@ -37,11 +37,11 @@ if local_assigns[:top_nav] || json_ui_app_is_web?
37
37
  menu.divider
38
38
  menu.label text: 'Misc Menu'
39
39
 
40
- menu.button text: 'Categories', onClick: ->(action) do
40
+ menu.button icon: 'list', text: 'Categories', onClick: ->(action) do
41
41
  action.windows_open url: json_ui_garage_url
42
42
  end
43
43
 
44
- menu.button text: 'Diagnostics', onClick: ->(action) do
44
+ menu.button icon: { name: 'zoom_in', badge: '!' }, text: 'Diagnostics', onClick: ->(action) do
45
45
  action.dialogs_alert message: %{
46
46
  Bundle ID: #{json_ui_app_bundle_id || '<unknown>'}
47
47
  App Version: #{json_ui_app_build_version || '<unknown>'}
@@ -13,10 +13,30 @@ json_ui_page json do |page|
13
13
  form.fields_check value: 3, label: 'Web Development'
14
14
  form.fields_check value: 4, label: 'Mobile Development'
15
15
  end
16
- # form.fields_check name: 'user[skills][]', value: 1, label: 'Game Development'
17
- # form.fields_check name: 'user[skills][]', value: 2, label: 'Web Development'
18
- # form.fields_check name: 'user[skills][]', value: 3, label: 'Mobile Development'
16
+
17
+ form.spacer height: 20
18
+ form.h2 text: 'Rating'
19
+ form.spacer height: 6
20
+ form.fields_radioGroup name: 'user[rating1][]', iconOfSelected: 'star', iconOfBeforeSelected: 'star', iconOfAfterSelected: 'star_border', childViews: ->(panel) do
21
+ panel.panels_horizontal childViews: ->(panel) do
22
+ panel.fields_radio value: 1
23
+ panel.fields_radio value: 2
24
+ panel.fields_radio value: 3
25
+ panel.fields_radio value: 4
26
+ panel.fields_radio value: 5
27
+ end
28
+ end
29
+ form.fields_radioGroup name: 'user[rating2][]', iconOfSelected: 'star', iconOfBeforeSelected: 'star', iconOfAfterSelected: 'star_border', value: 1, childViews: ->(panel) do
30
+ panel.panels_horizontal childViews: ->(panel) do
31
+ panel.fields_radio value: 1
32
+ panel.fields_radio value: 2
33
+ panel.fields_radio value: 3
34
+ panel.fields_radio value: 4
35
+ panel.fields_radio value: 5
36
+ end
37
+ end
19
38
 
39
+ form.spacer height: 20
20
40
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
21
41
  end
22
42
 
@@ -7,7 +7,7 @@ json_ui_page json do |page|
7
7
  form.h2 text: 'Radio Group'
8
8
  form.spacer height: 6
9
9
  form.h4 text: 'Gender'
10
- form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
10
+ form.fields_radioGroup name: 'user[gender]', value: 'F', childViews: ->(group) do
11
11
  group.fields_radio value: 'M', label: 'Male'
12
12
  group.fields_radio value: 'F', label: 'Female'
13
13
  end
@@ -38,6 +38,12 @@ json_ui_page json do |page|
38
38
  form.fields_date name: 'user[date]', width: 'matchParent', label: 'Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
39
39
  form.fields_datetime name: 'user[date_time]', width: 'matchParent', label: 'Date Time', min: '2018-06-09T00:00', max: '2018-06-17T00:00', value: '2018-06-15T19:30'
40
40
 
41
+ form.spacer height: 20
42
+ form.h2 text: 'Country'
43
+ form.spacer height: 6
44
+ region_field = { name: 'user[city]', label: 'City' }
45
+ form.fields_country name: 'user[country]', width: 'matchParent', label: 'Country', region: region_field
46
+
41
47
  form.spacer height: 20
42
48
  form.h2 text: 'Map'
43
49
  form.spacer height: 6
@@ -3,13 +3,13 @@ json.title 'Forms'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
7
- # TODO: Turn on html5 validation
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: json_padding_body, childViews: ->(form) do
8
7
  form.fields_email name: 'user[email]', width: 'matchParent', label: 'Email'
9
- form.fields_email name: 'user[url]', width: 'matchParent', label: 'URL'
8
+ form.fields_url name: 'user[url]', width: 'matchParent', label: 'URL'
9
+ form.fields_number name: 'user[number]', width: 'matchParent', label: 'Number'
10
+ form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
11
+ form.fields_textarea name: 'user[textarea]', width: 'matchParent', label: 'Textarea with maxLength', maxLength: 50
10
12
 
11
- form.panels_split width: 'matchParent', rightViews: ->(split) do
12
- split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
13
- end
13
+ form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
14
14
  end
15
15
  end
@@ -5,10 +5,6 @@ json_ui_page json do |page|
5
5
 
6
6
  page.list firstSection: ->(section) do
7
7
  section.rows builder: ->(template) do
8
- template.thumbnail title: 'Nav Buttons', onClick: ->(action) do
9
- action.windows_open url: json_ui_garage_url(path: 'pages/nav_buttons')
10
- end
11
-
12
8
  template.thumbnail title: 'Hamburger Layout', onClick: ->(action) do
13
9
  action.windows_open url: json_ui_garage_url(path: 'pages/layout')
14
10
  end
@@ -20,6 +16,10 @@ json_ui_page json do |page|
20
16
  template.thumbnail title: 'Tab Bar', onClick: ->(action) do
21
17
  action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar')
22
18
  end
19
+
20
+ template.thumbnail title: 'Nav Buttons', onClick: ->(action) do
21
+ action.windows_open url: json_ui_garage_url(path: 'pages/nav_buttons')
22
+ end
23
23
  end
24
24
 
25
25
  end
@@ -7,12 +7,15 @@ json_ui_page json do |page|
7
7
  menu.button icon: 'search', onClick: ->(action) do
8
8
  action.dialogs_alert message: 'Perform some action'
9
9
  end
10
- menu.button icon: 'map', onClick: ->(action) do
10
+ menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do
11
+ action.dialogs_alert message: 'Perform some action'
12
+ end
13
+ menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do
11
14
  action.dialogs_alert message: 'Perform some action'
12
15
  end
13
16
  end
14
17
 
15
- page.scroll padding: {top: 20, left: 20, right: 20, bottom: 20}, childViews: ->(scroll) do
18
+ page.scroll padding: json_padding_body, childViews: ->(scroll) do
16
19
  scroll.label text: 'See the right menu buttons on the nav bar'
17
20
  end
18
21
  end
@@ -4,7 +4,13 @@ json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  page.scroll padding: json_padding_body, childViews: ->(scroll) do
7
- scroll.panels_custom template: 'thumbnail', data: { imageUrl: @sample_image_url, title: 'Title', subtitle: 'Subtitle' }
7
+ scroll.h2 text: 'Thumbnail Template'
8
+ scroll.spacer height: 6
9
+ scroll.panels_custom template: 'thumbnail', width: 'matchParent', backgroundColor: '#fafafa',
10
+ data: { imageUrl: json_image_standard_url, title: 'Title', subtitle: 'Use the same template from list templates' }
11
+
12
+ scroll.spacer height: 20
13
+ scroll.h2 text: 'Non-existent Template'
8
14
  scroll.spacer height: 6
9
15
  scroll.panels_custom template: 'nonExistentTemplate'
10
16
  end
@@ -3,65 +3,88 @@ json.title 'Panels'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
5
5
 
6
-
7
6
  page.list sections: [
8
7
  ->(section) do
8
+ section.header padding: json_padding_list, childViews: ->(header) do
9
+ header.h2 text: 'Layout for child components'
10
+ end
11
+
9
12
  section.rows builder: ->(template) do
10
- template.thumbnail title: 'Card', onClick: ->(action) do
11
- action.windows_open url: json_ui_garage_url(path: 'panels/card')
12
- end
13
13
  template.thumbnail title: 'Vertical', onClick: ->(action) do
14
14
  action.windows_open url: json_ui_garage_url(path: 'panels/vertical')
15
15
  end
16
16
  template.thumbnail title: 'Horizontal', onClick: ->(action) do
17
17
  action.windows_open url: json_ui_garage_url(path: 'panels/horizontal')
18
18
  end
19
- template.thumbnail title: 'Split', onClick: ->(action) do
20
- action.windows_open url: json_ui_garage_url(path: 'panels/split')
21
- end
22
19
  template.thumbnail title: 'Carousel', onClick: ->(action) do
23
20
  action.windows_open url: json_ui_garage_url(path: 'panels/carousel')
24
21
  end
25
- template.thumbnail title: 'Custom', onClick: ->(action) do
26
- action.windows_open url: json_ui_garage_url(path: 'panels/custom')
22
+
23
+ end
24
+ end, ->(section) do
25
+ section.header padding: json_padding_list, childViews: ->(header) do
26
+ header.h2 text: 'Layout with sub-panels'
27
+ header.spacer height: 6
28
+ header.label text: 'Each sub-panel is a vertical panel'
29
+ end
30
+
31
+ section.rows builder: ->(template) do
32
+ template.thumbnail title: 'Split', subtitle: 'Sub-panels: left, center, right', onClick: ->(action) do
33
+ action.windows_open url: json_ui_garage_url(path: 'panels/split')
34
+ end
35
+ template.thumbnail title: 'Page', subtitle: 'Sub-panels: header, content, footer', onClick: ->(action) do
36
+ action.windows_open url: json_ui_garage_url(path: 'pages/index')
37
+ end
38
+ template.thumbnail title: 'List', subtitle: 'Sub-panels: header, footer', onClick: ->(action) do
39
+ action.windows_open url: json_ui_garage_url(path: 'lists/index')
27
40
  end
28
41
 
29
42
  end
30
43
  end, ->(section) do
31
44
  section.header padding: json_padding_list, childViews: ->(header) do
32
- header.h2 text: 'Web Only'
45
+ header.h2 text: 'Layout with uniform rows'
33
46
  end
34
47
 
35
48
  section.rows builder: ->(template) do
36
- template.thumbnail title: 'Table', onClick: ->(action) do
49
+ template.thumbnail title: 'List', subtitle: 'Rows without columns', onClick: ->(action) do
50
+ action.windows_open url: json_ui_garage_url(path: 'lists/index')
51
+ end
52
+ template.thumbnail title: 'Table (Web only)', subtitle: 'Rows with columns', onClick: ->(action) do
37
53
  action.windows_open url: json_ui_garage_url(path: 'panels/table')
38
54
  end
39
55
 
40
56
  end
41
- end
42
- ]
57
+ end, ->(section) do
58
+ section.header padding: json_padding_list, childViews: ->(header) do
59
+ header.h2 text: 'Non-layout'
60
+ header.spacer height: 6
61
+ header.label text: 'Adds functionality to a vertical layout'
62
+ end
43
63
 
44
- # page.list firstSection: ->(section) do
45
- # section.rows builder: ->(template) do
46
- # template.thumbnail title: 'Card', onClick: ->(action) do
47
- # action.windows_open url: json_ui_garage_url(path: 'panels/card')
48
- # end
49
- # template.thumbnail title: 'Vertical', onClick: ->(action) do
50
- # action.windows_open url: json_ui_garage_url(path: 'panels/vertical')
51
- # end
52
- # template.thumbnail title: 'Horizontal', onClick: ->(action) do
53
- # action.windows_open url: json_ui_garage_url(path: 'panels/horizontal')
54
- # end
55
- # template.thumbnail title: 'Split', onClick: ->(action) do
56
- # action.windows_open url: json_ui_garage_url(path: 'panels/split')
57
- # end
58
- # template.thumbnail title: 'Carousel', onClick: ->(action) do
59
- # action.windows_open url: json_ui_garage_url(path: 'panels/carousel')
60
- # end
61
- # template.thumbnail title: 'Custom', onClick: ->(action) do
62
- # action.windows_open url: json_ui_garage_url(path: 'panels/custom')
63
- # end
64
- # end
64
+ section.rows builder: ->(template) do
65
+ template.thumbnail title: 'Scroll', subtitle: 'Adds scrolling', onClick: ->(action) do
66
+ action.windows_open url: json_ui_garage_url(path: 'pages/index')
67
+ end
68
+ template.thumbnail title: 'Form', subtitle: 'Adds form functionality', onClick: ->(action) do
69
+ action.windows_open url: json_ui_garage_url(path: 'forms/index')
70
+ end
71
+ template.thumbnail title: 'Card', subtitle: 'Adds card-like bevel', onClick: ->(action) do
72
+ action.windows_open url: json_ui_garage_url(path: 'panels/card')
73
+ end
74
+
75
+ end
76
+ end, ->(section) do
77
+ section.header padding: json_padding_list, childViews: ->(header) do
78
+ header.h2 text: 'Child-less Layout'
79
+ end
80
+
81
+ section.rows builder: ->(template) do
82
+ template.thumbnail title: 'Custom', onClick: ->(action) do
83
+ action.windows_open url: json_ui_garage_url(path: 'panels/custom')
84
+ end
85
+
86
+ end
87
+ end,
88
+ ]
65
89
 
66
- # end
67
90
  end
@@ -3,7 +3,18 @@ json.title 'Panels'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.scroll padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(scroll) do
6
+ page.scroll padding: json_padding_body, childViews: ->(scroll) do
7
+
8
+ # TODO: Consider moving towards this
9
+ # scroll.panels_split width: 'matchParent', builder: ->(builder) do
10
+ # builder.left childViews: ->(left) do
11
+ # left.button text: '1'
12
+ # end
13
+ # builder.right childViews: ->(right) do
14
+ # right.button text: '2'
15
+ # end
16
+ # end
17
+
7
18
  scroll.h1 text: '2 columns'
8
19
  scroll.panels_split width: 'matchParent', leftViews: ->(panel) do
9
20
  panel.button text: '1'
@@ -4,7 +4,7 @@ json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  page.scroll padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(scroll) do
7
- scroll.h1 text: 'Vertical Panel'
7
+ scroll.h1 text: 'Vertical panel'
8
8
  scroll.panels_vertical backgroundColor: '#b3bac2', childViews: ->(panel) do
9
9
  panel.button text: 'Button1'
10
10
  panel.button text: 'Button2', width: 200
@@ -12,7 +12,7 @@ json_ui_page json do |page|
12
12
  end
13
13
 
14
14
  scroll.label text: "\n"
15
- scroll.h1 text: 'Vertical Panel with equal filling'
15
+ scroll.h1 text: 'Vertical panel with equal filling'
16
16
  scroll.panels_vertical backgroundColor: '#b3bac2', height: 300, distribution: 'fillEqually', childViews: ->(panel) do
17
17
  panel.button text: 'Button1'
18
18
  panel.button text: 'Button2'
@@ -20,12 +20,21 @@ json_ui_page json do |page|
20
20
  end
21
21
 
22
22
  scroll.label text: "\n"
23
- scroll.h1 text: 'Vertical Panel with equal spacing'
23
+ scroll.h1 text: 'Vertical panel with equal spacing'
24
24
  scroll.panels_vertical backgroundColor: '#b3bac2', height: 300, distribution: 'spaceEqually', childViews: ->(panel) do
25
25
  panel.button text: 'Button1'
26
26
  panel.button text: 'Button2'
27
27
  panel.button text: 'Button3'
28
28
  end
29
29
 
30
+ scroll.label text: "\n"
31
+ scroll.h1 text: 'Vertical panel with alignment'
32
+ scroll.panels_vertical width: 'matchParent', backgroundColor: '#b3bac2', align: 'center', childViews: ->(panel) do
33
+ panel.button text: 'Center'
34
+ end
35
+ scroll.panels_vertical width: 'matchParent', backgroundColor: '#b3bac2', align: 'right', childViews: ->(panel) do
36
+ panel.button text: 'Right'
37
+ end
38
+
30
39
  end
31
40
  end
@@ -1,29 +1,34 @@
1
1
 
2
2
  json.events do
3
+
3
4
  json.child! do
4
- json.date '2018-12-30'
5
- json.text 'Birthday'
5
+ json.start '2018-12-14'
6
+ json.end '2018-12-17'
7
+ json.text 'Hackathon'
6
8
  json.onClick do
7
9
  json.action 'dialogs/alert-v1'
8
- json.message 'At home'
10
+ json.message 'At Town Hall'
9
11
  end
10
12
  end
11
13
 
12
14
  json.child! do
13
- json.date '2018-12-31'
14
- json.text 'Conference'
15
+ json.start '2018-12-30'
16
+ json.end '2018-12-30'
17
+ json.text 'Birthday'
15
18
  json.onClick do
16
19
  json.action 'dialogs/alert-v1'
17
- json.message 'In Perth'
20
+ json.message 'At home'
18
21
  end
19
22
  end
20
-
23
+
21
24
  json.child! do
22
- json.date '2019-01-01'
23
- json.text 'Hackathon'
25
+ json.start '2018-12-31'
26
+ json.end '2018-12-31'
27
+ json.text 'Conference'
24
28
  json.onClick do
25
29
  json.action 'dialogs/alert-v1'
26
- json.message 'At Town Hall'
30
+ json.message 'In Perth'
27
31
  end
28
32
  end
33
+
29
34
  end
@@ -8,6 +8,7 @@ json_ui_page json do |page|
8
8
 
9
9
  json.child! do
10
10
  json.view 'charts/line-v1'
11
+
11
12
  json.dataSeries do
12
13
  json.child! do
13
14
  json.title 'Line 1'
@@ -6,12 +6,12 @@ json_ui_page json do |page|
6
6
  page.scroll padding: json_padding_body, childViews: ->(scroll) do
7
7
  scroll.h2 text: 'Avatar'
8
8
  scroll.spacer height: 6
9
- scroll.avatar url: 'https://www.wpjournalist.nl/wp-content/uploads/2019/03/avatar-jongen-voorbeeld-1.jpg'
9
+ scroll.avatar url: json_image_avatar_url
10
10
 
11
11
  scroll.spacer height: 20
12
12
  scroll.h2 text: 'Image with URL'
13
13
  scroll.spacer height: 6
14
- scroll.image width: 100, url: @sample_image_url
14
+ scroll.image width: 100, url: json_image_standard_url
15
15
 
16
16
  scroll.spacer height: 20
17
17
  scroll.h2 text: 'Image with base64 data'
@@ -28,5 +28,6 @@ json_ui_page json do |page|
28
28
  else
29
29
  scroll.label text: 'Include "rqrcode" gem to enable this'
30
30
  end
31
+
31
32
  end
32
33
  end
@@ -17,6 +17,9 @@ json_ui_page json do |page|
17
17
  template.thumbnail title: 'Charts', onClick: ->(action) do
18
18
  action.windows_open url: json_ui_garage_url(path: 'views/charts')
19
19
  end
20
+ template.thumbnail title: 'Links', onClick: ->(action) do
21
+ action.windows_open url: json_ui_garage_url(path: 'views/links')
22
+ end
20
23
  end
21
24
 
22
25
  end
@@ -0,0 +1,39 @@
1
+ json.title 'Views'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.scroll padding: json_padding_body, childViews: ->(scroll) do
7
+
8
+ scroll.h2 text: 'Standard button'
9
+ scroll.spacer height: 6
10
+ scroll.button text: 'Button', onClick: ->(action) do
11
+ action.windows_openWeb url: 'https://www.google.com/'
12
+ end
13
+
14
+ scroll.spacer height: 20
15
+ scroll.h2 text: 'Button with link style'
16
+ scroll.spacer height: 6
17
+ scroll.button text: 'Link', styleClass: 'link', onClick: ->(action) do
18
+ action.windows_openWeb url: 'https://www.google.com/'
19
+ end
20
+
21
+ scroll.spacer height: 20
22
+ scroll.h2 text: 'Avatar with onClick'
23
+ # TODO: Make sure "open in new tab" works
24
+ scroll.spacer height: 10
25
+ scroll.avatar url: json_image_avatar_url, styleClass: 'link', onClick: ->(action) do
26
+ action.windows_openWeb url: 'https://www.google.com/'
27
+ end
28
+
29
+ scroll.spacer height: 20
30
+ scroll.h2 text: 'Image with onClick'
31
+ # TODO: Make sure "open in new tab" works
32
+ scroll.spacer height: 10
33
+ scroll.image width: 100, url: json_image_standard_url, styleClass: 'link', onClick: ->(action) do
34
+ action.windows_openWeb url: 'https://www.google.com/'
35
+ end
36
+
37
+
38
+ end
39
+ 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.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -91,6 +91,7 @@ files:
91
91
  - app/views/json_ui/garage/views/charts.json.jbuilder
92
92
  - app/views/json_ui/garage/views/images.json.jbuilder
93
93
  - app/views/json_ui/garage/views/index.json.jbuilder
94
+ - app/views/json_ui/garage/views/links.json.jbuilder
94
95
  - app/views/json_ui/garage/views/map_data.json.jbuilder
95
96
  - config/routes.rb
96
97
  - lib/glib-web.rb