glib-web 0.5.39 → 0.5.40

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: 4b9205fa6e7332e2ce66c925e7af1638eb7dc92fb3c6cdc8c7183ba1c47821de
4
- data.tar.gz: a2ed11cc66f88e51beb86cec96d27f8535db9f653fc1ce162b79020589ff613d
3
+ metadata.gz: 8b928a561f073b490adf1ea7cd8f5bfbf0da713c3cb580bc70384ea6c21579af
4
+ data.tar.gz: fe3fc8437847278266fd2d50cb0fb0501305a582e76f8d4696979d3375559d48
5
5
  SHA512:
6
- metadata.gz: c0d61a7b2330c8a55363a77b9c776ebb1edbd8245b2ad5446503ba2ab071a07397c0e2546fcb6c222ce3c332b06ace8166f468fa0bbab2aaa65f8e1cd14131f1
7
- data.tar.gz: 85c93b6a5d6fdaa7ebf04de94b9927514243f7f4c94d039c613ae32bad684a158e8c6bf6ba8a59c0d2210df41bb50cba7f6ce2384920a8093d2feb2d7f2362b7
6
+ metadata.gz: 39a4149930f9ce32a68a91fae80a6589d9829f6efffc3d62578750258cd54163e5cc05115ad476276cd0a4992f190c25626d578813d827aac2936b4054ee127e
7
+ data.tar.gz: d890dec1c65fb22290234d16d88597fe39d54700009ce6d55f96cb69823167f01dc4fabc709828712a52e5e2a9165c01dbc7df29761f1dbfb095566a03679c66
@@ -263,6 +263,14 @@ module Glib
263
263
  end
264
264
  end
265
265
 
266
+ def self.menu(propName)
267
+ define_method(propName) do |value|
268
+ json.set! propName do
269
+ value.call(page.menu_builder)
270
+ end
271
+ end
272
+ end
273
+
266
274
  def self.singleton_array(singletonName, arrayName)
267
275
  array arrayName
268
276
 
@@ -7,23 +7,22 @@ module Glib
7
7
  end
8
8
 
9
9
  class AbstractTemplate < JsonUiElement
10
- # def contextButtons(block)
11
- # json.contextButtons do
10
+ menu :leftButtons
11
+ menu :rightButtons
12
+ menu :editButtons
13
+ menu :chips
14
+
15
+ # def editButtons(block)
16
+ # json.editButtons do
12
17
  # block.call page.menu_builder
13
18
  # end
14
19
  # end
15
20
 
16
- def editButtons(block)
17
- json.editButtons do
18
- block.call page.menu_builder
19
- end
20
- end
21
-
22
- def chips(block)
23
- json.chips do
24
- block.call page.menu_builder
25
- end
26
- end
21
+ # def chips(block)
22
+ # json.chips do
23
+ # block.call page.menu_builder
24
+ # end
25
+ # end
27
26
  end
28
27
 
29
28
  class Standard < AbstractTemplate
@@ -30,6 +30,7 @@ module Glib
30
30
  hash :padding
31
31
  singleton_array :styleClass, :styleClasses
32
32
  hash :showIf
33
+ hash :valueIf
33
34
  hash :analytics
34
35
 
35
36
  # def initialize(json, page)
@@ -157,6 +158,7 @@ module Glib
157
158
  float :longitude
158
159
  int :zoom
159
160
  string :dataUrl
161
+ bool :cluster
160
162
  end
161
163
 
162
164
  class Chip < View
@@ -43,6 +43,7 @@ class Glib::JsonUi::ViewBuilder
43
43
  # @name ||= form.field_name(prop)
44
44
  # @value ||= form.field_value(prop)
45
45
  # end
46
+
46
47
  end
47
48
 
48
49
  # Override
@@ -53,6 +54,9 @@ class Glib::JsonUi::ViewBuilder
53
54
  @label ||= form.field_label(@prop, @label_args || {})
54
55
  @hint ||= form.hint_label(@prop, @hint_args || {})
55
56
  @placeholder ||= form.placeholder_label(@prop, @placeholder_args || {})
57
+
58
+ @validation ||= form.field_validation(@prop)
59
+
56
60
  end
57
61
  json.name @name
58
62
  json.value @value if @value
@@ -63,6 +67,8 @@ class Glib::JsonUi::ViewBuilder
63
67
  # - Placeholder gets hidden when there is input which may be confusing
64
68
  # - Placeholder competes with label for space
65
69
  json.placeholder @placeholder if @placeholder
70
+
71
+ json.validation @validation if @validation
66
72
  end
67
73
 
68
74
  end
@@ -41,6 +41,16 @@ class Glib::JsonUi::ViewBuilder
41
41
  I18n.t("dt_models.#{@model_name}.#{prop}.placeholder", args.merge(default: nil))
42
42
  end
43
43
 
44
+ def field_validation(prop)
45
+ validations = {}
46
+ @model.class.validators_on(prop).each do |validator|
47
+ if validator.kind == :presence
48
+ validations[:required] = { message: 'Required' }
49
+ end
50
+ end
51
+ validations
52
+ end
53
+
44
54
  def url(url)
45
55
  @url = url
46
56
  end
@@ -0,0 +1,36 @@
1
+ json.title 'Forms'
2
+
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
+ form.spacer height: 20
8
+ form.h2 text: 'Date'
9
+ form.spacer height: 6
10
+ form.fields_date name: 'user[date_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
11
+ form.fields_date name: 'user[date_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01', valueIf: {
12
+ "+": [
13
+ {
14
+ "var": 'user[date_start]'
15
+ },
16
+ 24 * 3600
17
+ ]
18
+ }
19
+
20
+ form.spacer height: 20
21
+ form.h2 text: 'Date/Time'
22
+ form.spacer height: 6
23
+ form.fields_datetime name: 'user[datetime_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01T01:00'
24
+ form.fields_datetime name: 'user[datetime_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01', valueIf: {
25
+ "+": [
26
+ {
27
+ "var": 'user[datetime_start]'
28
+ },
29
+ 3600
30
+ ]
31
+ }
32
+
33
+ form.spacer height: 20
34
+ form.fields_submit text: 'Submit'
35
+ form.spacer height: 40
36
+ end
@@ -36,6 +36,9 @@ json_ui_page json do |page|
36
36
  template.thumbnail title: 'Show/Hide', onClick: ->(action) do
37
37
  action.windows_open url: json_ui_garage_url(path: 'forms/show_hide')
38
38
  end
39
+ template.thumbnail title: 'Conditional Value', onClick: ->(action) do
40
+ action.windows_open url: json_ui_garage_url(path: 'forms/conditional_value')
41
+ end
39
42
 
40
43
  end
41
44
  end, ->(section) do
@@ -5,7 +5,18 @@ 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: 'Click menu (web) or swipe left (Android/iOS)', editButtons: ->(menu) do
8
+ template.thumbnail title: 'Click menu (web) or swipe left (Android/iOS)', leftButtons: ->(menu) do
9
+ menu.button styleClass: 'icon', icon: 'check_box', onClick: ->(subaction) do
10
+ subaction.dialogs_alert message: 'Tick/untick'
11
+ end
12
+ end, rightButtons: ->(menu) do
13
+ menu.button styleClass: 'icon', icon: 'share', onClick: ->(subaction) do
14
+ subaction.dialogs_alert message: 'Share'
15
+ end
16
+ menu.button styleClass: 'icon', icon: 'open_in_new', onClick: ->(subaction) do
17
+ subaction.dialogs_alert message: 'Open'
18
+ end
19
+ end, editButtons: ->(menu) do
9
20
  menu.button text: 'Edit', onClick: ->(action) do
10
21
  action.dialogs_alert message: 'Perform action'
11
22
  end
@@ -8,7 +8,7 @@ json_ui_page json do |page|
8
8
  template.thumbnail icon: 'list', title: 'Templating', onClick: ->(action) do
9
9
  action.windows_open url: json_ui_garage_url(path: 'lists/templating')
10
10
  end
11
- template.thumbnail title: 'Edit Actions', onClick: ->(action) do
11
+ template.thumbnail title: 'Action Buttons', onClick: ->(action) do
12
12
  action.windows_open url: json_ui_garage_url(path: 'lists/edit_actions')
13
13
  end
14
14
  template.thumbnail title: 'FAB (Floating Action Button)', onClick: ->(action) do
@@ -22,6 +22,9 @@ json_ui_page json do |page|
22
22
  template.thumbnail title: 'Banners', onClick: ->(action) do
23
23
  action.windows_open url: json_ui_garage_url(path: 'views/banners')
24
24
  end
25
+ template.thumbnail title: 'Maps', onClick: ->(action) do
26
+ action.windows_open url: json_ui_garage_url(path: 'views/maps')
27
+ end
25
28
  template.thumbnail title: 'Misc', onClick: ->(action) do
26
29
  action.windows_open url: json_ui_garage_url(path: 'views/misc')
27
30
  end
@@ -0,0 +1,38 @@
1
+
2
+ json.pins do
3
+ locations = [
4
+ { lat: -31.56391, lng: 147.154312 },
5
+ { lat: -33.718234, lng: 150.363181 },
6
+ { lat: -33.727111, lng: 150.371124 },
7
+ { lat: -33.848588, lng: 151.209834 },
8
+ { lat: -33.851702, lng: 151.216968 },
9
+ { lat: -34.671264, lng: 150.863657 },
10
+ { lat: -35.304724, lng: 148.662905 },
11
+ { lat: -36.817685, lng: 175.699196 },
12
+ { lat: -36.828611, lng: 175.790222 },
13
+ { lat: -37.75, lng: 145.116667 },
14
+ { lat: -37.759859, lng: 145.128708 },
15
+ { lat: -37.765015, lng: 145.133858 },
16
+ { lat: -37.770104, lng: 145.143299 },
17
+ { lat: -37.7737, lng: 145.145187 },
18
+ { lat: -37.774785, lng: 145.137978 },
19
+ { lat: -37.819616, lng: 144.968119 },
20
+ { lat: -38.330766, lng: 144.695692 },
21
+ { lat: -39.927193, lng: 175.053218 },
22
+ { lat: -41.330162, lng: 174.865694 },
23
+ { lat: -42.734358, lng: 147.439506 },
24
+ { lat: -42.734358, lng: 147.501315 },
25
+ { lat: -42.735258, lng: 147.438 },
26
+ { lat: -43.999792, lng: 170.463352 },
27
+ ];
28
+
29
+ locations.each do |location|
30
+ json.child! do
31
+ json.latitude location[:lat]
32
+ json.longitude location[:lng]
33
+ json.infoWindow do
34
+ json.title "TEST #{rand(1000)}"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,31 @@
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: glib_json_padding_body, childViews: ->(scroll) do
7
+ scroll.spacer height: 20
8
+ scroll.h2 text: 'Map with Markers'
9
+ scroll.spacer height: 6
10
+ scroll.map \
11
+ width: 'matchParent',
12
+ latitude: 13.4837,
13
+ longitude: 144.7917,
14
+ zoom: 11,
15
+ height: 250,
16
+ dataUrl: json_ui_garage_url(path: 'views/map_data')
17
+
18
+ scroll.spacer height: 20
19
+ scroll.h2 text: 'Map with Clustered Markers'
20
+ scroll.spacer height: 6
21
+ scroll.map \
22
+ width: 'matchParent',
23
+ latitude: -42.162376,
24
+ longitude: 172.671437,
25
+ zoom: 7,
26
+ height: 480,
27
+ cluster: true,
28
+ dataUrl: json_ui_garage_url(path: 'views/map_cluster_data')
29
+
30
+ end
31
+ end
@@ -20,10 +20,10 @@ json_ui_page json do |page|
20
20
  scroll.datetime value: 1.week.ago, format: 'YYYY-MM-DD'
21
21
  scroll.datetime value: DateTime.current, format: 'hh:mm:ss', tick: true
22
22
 
23
- scroll.spacer height: 20
24
- scroll.h2 text: 'Map'
25
- scroll.spacer height: 6
26
- scroll.map width: 'matchParent', latitude: 13.4837, longitude: 144.7917, zoom: 11, height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
23
+ # scroll.spacer height: 20
24
+ # scroll.h2 text: 'Map'
25
+ # scroll.spacer height: 6
26
+ # scroll.map width: 'matchParent', latitude: 13.4837, longitude: 144.7917, zoom: 11, height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
27
27
 
28
28
  scroll.spacer height: 20
29
29
  scroll.h2 text: 'Calendar'
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.39
4
+ version: 0.5.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -125,6 +125,7 @@ files:
125
125
  - app/views/json_ui/garage/forms/basic.json.jbuilder
126
126
  - app/views/json_ui/garage/forms/basic_post.json.jbuilder
127
127
  - app/views/json_ui/garage/forms/checkboxes.json.jbuilder
128
+ - app/views/json_ui/garage/forms/conditional_value.json.jbuilder
128
129
  - app/views/json_ui/garage/forms/dynamic_group.json.jbuilder
129
130
  - app/views/json_ui/garage/forms/dynamic_select.json.jbuilder
130
131
  - app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder
@@ -197,7 +198,9 @@ files:
197
198
  - app/views/json_ui/garage/views/images.json.jbuilder
198
199
  - app/views/json_ui/garage/views/index.json.jbuilder
199
200
  - app/views/json_ui/garage/views/links.json.jbuilder
201
+ - app/views/json_ui/garage/views/map_cluster_data.json.jbuilder
200
202
  - app/views/json_ui/garage/views/map_data.json.jbuilder
203
+ - app/views/json_ui/garage/views/maps.json.jbuilder
201
204
  - app/views/json_ui/garage/views/markdowns.json.jbuilder
202
205
  - app/views/json_ui/garage/views/misc.json.jbuilder
203
206
  - app/views/json_ui/garage/views/texts.json.jbuilder