glib-web 0.1.2 → 0.2.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
  SHA1:
3
- metadata.gz: df566013ce3acc240e942fce9afae6dbb6b5c035
4
- data.tar.gz: 9ce0f54f02cf936abf1d49bfeff57800033fbaa6
3
+ metadata.gz: 1c9296a445e5e0d74a2b3c801fe2fc02d2534c97
4
+ data.tar.gz: e2670acc3fb614affb71939f1d33609f7cd53e17
5
5
  SHA512:
6
- metadata.gz: 51be02308f500ae5a18143cb5259e3ec0aeb453ff45f3445d7b0e78bba4aeced0a90f15acdba7fa2033656a41adf98126c8b785c14c3d06efd7133ebf9ce7b72
7
- data.tar.gz: 65fcd88b64d919f03994a0f81c70a269581d75fe68e2900f64656b8cdd3187dbaffe5a7b5b689ffa569d1f4b9e63f898041f4b782e01b1f5415eb2fd5bddf98a
6
+ metadata.gz: aeeb6f7c4b82cded13854c5ed44e80836257d29c98b06b223f00947fa77692a3191c50a07ffe0c56e1bedd7aa5656ec241398ec46a78aa8c6651c6bbb0baf051
7
+ data.tar.gz: 7d176519ccc425f4bf889e73e41ad068bf93c7366902a9f3230f2fbe5ed8655d6dabc53193220abf34f4553bff59f63b89192d434a115d95aa660e898f7e4642
@@ -50,6 +50,63 @@ module Glib
50
50
 
51
51
  private
52
52
 
53
+ def self.date propName
54
+ define_method(propName) do |value|
55
+ if (value = value&.to_s)
56
+ if !Rails.env.production?
57
+ # TODO: Use regex to validate date
58
+ end
59
+
60
+ json.set! propName, value
61
+ end
62
+ end
63
+ end
64
+
65
+ def self.date_time propName
66
+ define_method(propName) do |value|
67
+ if (value = value&.to_s)
68
+ if !Rails.env.production?
69
+ # TODO: Use regex to validate datetime
70
+ end
71
+
72
+ json.set! propName, value
73
+ end
74
+ end
75
+ end
76
+
77
+ def self.color propName
78
+ define_method(propName) do |value|
79
+ if (value = value&.to_s)
80
+ if !Rails.env.production?
81
+ if !value.match /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i
82
+ raise "Invalid color: #{value}"
83
+ end
84
+ end
85
+
86
+ json.set! propName, value
87
+ end
88
+ end
89
+ end
90
+
91
+ def self.length propName
92
+ define_method(propName) do |value|
93
+ if value
94
+ if !Rails.env.production?
95
+ case value
96
+ when 'matchParent'
97
+ when 'wrapContent'
98
+ else
99
+ if !value.is_a? Integer
100
+ raise "Invalid length: #{value}"
101
+ end
102
+ end
103
+ end
104
+
105
+ json.set! propName, value
106
+ end
107
+ end
108
+ end
109
+
53
110
  def self.string propName
54
111
  define_method(propName) do |value|
55
112
  json.set! propName, value&.to_s
@@ -106,6 +163,12 @@ module Glib
106
163
  end
107
164
  end
108
165
 
166
+ def self.singleton_array singletonName, arrayName
167
+ define_method(singletonName) do |value|
168
+ json.set! arrayName, [value]
169
+ end
170
+ end
171
+
109
172
  def created
110
173
  # To be overridden
111
174
  end
@@ -50,6 +50,10 @@ module Glib
50
50
  end
51
51
 
52
52
  module Windows
53
+ class Close < Action
54
+ action :onClose
55
+ end
56
+
53
57
  class CloseAll < Action
54
58
  action :onClose
55
59
  end
@@ -61,6 +65,10 @@ module Glib
61
65
  class OpenWeb < Action
62
66
  string :url
63
67
  end
68
+
69
+ class Reload < Action
70
+ string :url
71
+ end
64
72
  end
65
73
 
66
74
  # Consider deprecating this. See Data
@@ -27,6 +27,9 @@ module Glib
27
27
  end
28
28
  end
29
29
 
30
+ # class Sections < AbstractBuilder
31
+ # end
32
+
30
33
  class Section < AbstractBuilder
31
34
  def initialize json, page, template
32
35
  super json, page
@@ -32,9 +32,15 @@ class Glib::JsonUi::ViewBuilder
32
32
  bool :readOnly
33
33
  end
34
34
 
35
+ class Number < Text
36
+ end
37
+
35
38
  class Email < Text
36
39
  end
37
40
 
41
+ class Url < Text
42
+ end
43
+
38
44
  class Password < Text
39
45
  end
40
46
 
@@ -49,6 +55,10 @@ class Glib::JsonUi::ViewBuilder
49
55
  bool :readOnly
50
56
  end
51
57
 
58
+ class RichText < Text
59
+ array :images
60
+ end
61
+
52
62
  class Country < AbstractField
53
63
  hash :region
54
64
  end
@@ -63,17 +73,69 @@ class Glib::JsonUi::ViewBuilder
63
73
  views :childViews
64
74
  end
65
75
 
76
+ # TODO: Support array props
66
77
  class Radio < View
67
78
  string :label
68
79
  string :value
69
80
  end
70
81
 
82
+ # TODO: Use the array props above to implement `value` property
71
83
  class File < Text
72
- string :accepts
73
- string :s3_direct_upload_url
74
- string :file_size_limit_alert_text
75
- string :value
76
- int :file_size_limit
84
+ # string :value
85
+
86
+ # def value(value)
87
+ # # @value = value if value != Glib::Value::DEFAULT
88
+ # end
89
+
90
+ # def prop(prop)
91
+ # super
92
+
93
+ # @value ||= form.field_value(prop)
94
+
95
+ # # if (form = page.current_form)
96
+ # # @name ||= form.field_name(prop)
97
+ # # @value ||= form.field_value(prop)
98
+ # # end
99
+ # end
100
+
101
+ hash :accepts
102
+ string :directUploadUrl
103
+ # int :file_size_limit
104
+ # string :file_size_limit_alert_text
105
+
106
+
107
+ def blob(active_storage_blob)
108
+ value(active_storage_blob.signed_id)
109
+ fileUrl(active_storage_blob.key)
110
+
111
+ # Avoid returning active_storage_blob.filename for privacy reason
112
+ fileTitle(active_storage_blob.created_at)
113
+ end
114
+
115
+ # Rename
116
+ def fileTitle(file_title)
117
+ json.fileTitle file_title
118
+ end
119
+
120
+ def fileUrl(file_url)
121
+ json.fileUrl file_url
122
+ end
123
+ end
124
+
125
+ class Date < AbstractField
126
+ date :min
127
+ date :max
128
+ end
129
+
130
+ # This doesn't use camel case to be consistent with the html input equivalent
131
+ class Datetime < AbstractField
132
+ date_time :min
133
+ date_time :max
134
+ end
135
+
136
+ class LatLong < AbstractField
137
+ hash :latitudeField
138
+ hash :longitudeField
77
139
  end
78
140
 
79
141
  end
@@ -82,6 +82,16 @@ class Glib::JsonUi::ViewBuilder
82
82
  block.call page.list_section_builder
83
83
  end
84
84
  end
85
+
86
+ def sections(blocks)
87
+ json.sections do
88
+ blocks.each do |block|
89
+ json.child! do
90
+ block.call page.list_section_builder
91
+ end
92
+ end
93
+ end
94
+ end
85
95
  end
86
96
 
87
97
  class Table < View
@@ -10,9 +10,9 @@ module Glib
10
10
  end
11
11
 
12
12
  class View < JsonUiElement
13
- string :width
14
- string :height
15
- string :backgroundColor
13
+ length :width
14
+ length :height
15
+ color :backgroundColor
16
16
  hash :padding
17
17
  end
18
18
 
@@ -42,6 +42,7 @@ module Glib
42
42
  string :text
43
43
  action :onClick
44
44
  array :styleClasses
45
+ singleton_array :styleClass, :styleClasses
45
46
  end
46
47
 
47
48
  class Fab < View
@@ -66,8 +67,12 @@ module Glib
66
67
  string :dataUrl
67
68
  end
68
69
 
70
+ class Calendar < View
71
+ string :dataUrl
72
+ end
73
+
69
74
  class TabBar < View
70
- string :color
75
+ color :color
71
76
 
72
77
  def tabButtons(block)
73
78
  json.tabButtons do
@@ -3,12 +3,17 @@
3
3
  page.leftDrawer content: ->(drawer) do
4
4
  drawer.header childViews: ->(header) do
5
5
  header.h1 text: 'App', onClick: ->(action) do
6
- action.windows_open url: json_ui_garage_url
6
+ # action.windows_open url: json_ui_garage_url
7
+ action.windows_open url: root_url
7
8
  end
8
9
  end
9
10
 
10
11
  drawer.rows builder: ->(menu) do
11
12
 
13
+ menu.button text: 'Menu', onClick: ->(action) do
14
+ action.windows_open url: json_ui_garage_url
15
+ end
16
+
12
17
  menu.button text: 'Pages', onClick: ->(action) do
13
18
  action.windows_open url: json_ui_garage_url(path: 'pages/index')
14
19
  end
@@ -3,41 +3,53 @@ json.title 'Actions'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.list firstSection: ->(section) do
7
- section.rows builder: ->(template) do
8
- template.thumbnail title: 'dialogs/alert', onClick: ->(action) do
9
- action.dialogs_alert message: 'This is an alert'
6
+ page.list sections: [->(section) do
7
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
8
+ header.h3 text: 'Dialogs'
10
9
  end
11
10
 
12
- # template.thumbnail title: 'dialogs/confirm (TODO)', onClick: ->(action) do
13
- # action.dialogs_confirm message: 'Confirm?', onConfirm: ->(action) do
14
- # action.dialogs_alert message: 'Good'
15
- # end, onCancel: ->(action) do
16
- # action.dialogs_alert message: 'Bad'
17
- # end
18
- # end
19
-
20
- template.thumbnail title: 'dialogs/option', onClick: ->(action) do
21
- action.dialogs_options message: 'Select one', buttons: ->(menu) do
22
- menu.button text: 'Option1', onClick: ->(action) do
23
- action.dialogs_alert message: 'Option 1'
24
- end
25
- menu.button text: 'Option2', onClick: ->(action) do
26
- action.dialogs_alert message: 'Option 2'
11
+ section.rows builder: ->(template) do
12
+ template.thumbnail title: 'dialogs/alert', onClick: ->(action) do
13
+ action.dialogs_alert message: 'This is an alert'
14
+ end
15
+
16
+ template.thumbnail title: 'dialogs/option', onClick: ->(action) do
17
+ action.dialogs_options message: 'Select one', buttons: ->(menu) do
18
+ menu.button text: 'Option1', onClick: ->(action) do
19
+ action.dialogs_alert message: 'Option 1'
20
+ end
21
+ menu.button text: 'Option2', onClick: ->(action) do
22
+ action.dialogs_alert message: 'Option 2'
23
+ end
24
+ menu.button text: 'Cancel'
27
25
  end
28
- menu.button text: 'Cancel'
29
26
  end
30
- end
31
27
 
32
- template.thumbnail title: 'dialogs/open', onClick: ->(action) do
33
- action.dialogs_open url: json_ui_garage_url(path: 'forms/basic')
34
- end
28
+ template.thumbnail title: 'dialogs/open', onClick: ->(action) do
29
+ action.dialogs_open url: json_ui_garage_url(path: 'forms/basic')
30
+ end
31
+
32
+ template.thumbnail title: 'dialogs/snackbar', onClick: ->(action) do
33
+ action.dialogs_snackbar message: 'This is a snackbar'
34
+ end
35
35
 
36
- template.thumbnail title: 'dialogs/snackbar', onClick: ->(action) do
37
- action.dialogs_snackbar message: 'This is a snackbar'
36
+ end
37
+ end, ->(section) do
38
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
39
+ header.h3 text: 'Windows'
38
40
  end
39
41
 
40
- end
42
+ section.rows builder: ->(template) do
43
+ template.thumbnail title: 'windows/reload', onClick: ->(action) do
44
+ action.windows_reload
45
+ end
41
46
 
42
- end
47
+ template.thumbnail title: 'windows/close', onClick: ->(action) do
48
+ action.windows_close onClose: ->(subaction) do
49
+ subaction.dialogs_alert message: 'Previous window closed'
50
+ end
51
+ end
52
+ end
53
+ end
54
+ ]
43
55
  end
@@ -5,7 +5,6 @@ json_ui_page json do |page|
5
5
 
6
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
7
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
8
- form.fields_email name: 'user[email]', width: 'matchParent', label: 'Email'
9
8
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
10
9
 
11
10
  form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
@@ -1,10 +1,11 @@
1
- name, email, password, gender, employer = params.require(:user).values_at(:name, :email, :password, :gender, :employer)
1
+
2
+ name, _ = params.require(:user).values_at(:name)
2
3
  json.onResponse do
3
- if name.present? && email.present? && password.present?
4
+ if name.present?
4
5
  json.action 'dialogs/alert-v1'
5
- json.message "Submitted information: #{name}, #{email}, #{password}, #{gender}, #{employer}"
6
+ json.message "Submitted information: #{params.require(:user).values.join(", ")}"
6
7
  else
7
8
  json.action 'dialogs/alert-v1'
8
- json.message 'Please enter all required information'
9
+ json.message 'Please enter name'
9
10
  end
10
11
  end
@@ -10,11 +10,18 @@ json_ui_page json do |page|
10
10
  render "#{@path_prefix}/nav_menu", json: json, page: page
11
11
 
12
12
  page.form options.merge(childViews: ->(form) do
13
- form.fields_file name: 'user[photo]', width: 'matchParent', label: 'Photo', accepts: "image/*", s3_direct_upload_url: rails_direct_uploads_path, file_size_limit: 5000, file_size_limit_alert_text: 'Too big!', value: 'VALUE_OF_THE_PREVIOUS_IMAGE_WHICH_IS_USEFUL_WHEN_UPDATING_EXISTING_MODEL'
13
+ rules1 = { fileType: "image/*", maxFileSize: 5000 }
14
+ rules2 = { fileType: "image/*", maxFileSize: 1, fileTypeErrorText: 'Invalid!', maxFileSizeErrorText: 'Too big!' }
15
+ form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Photo', accepts: rules1, directUploadUrl: rails_direct_uploads_path,
16
+ value: 'eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4',
17
+ fileUrl: 'https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100',
18
+ fileTitle: '1 month ago'
19
+ form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Photo', accepts: rules2, directUploadUrl: rails_direct_uploads_path
14
20
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
15
21
  end)
16
22
  end
17
23
 
24
+
18
25
  # json_body_with_form json, nil, nil, options do
19
26
  # json.child! do
20
27
  # json.view 'fields/file-v1'
@@ -17,6 +17,15 @@ json_ui_page json do |page|
17
17
  template.thumbnail title: 'File Upload', onClick: ->(action) do
18
18
  action.windows_open url: json_ui_garage_url(path: 'forms/file_upload')
19
19
  end
20
+ template.thumbnail title: 'Pickers', onClick: ->(action) do
21
+ action.windows_open url: json_ui_garage_url(path: 'forms/pickers')
22
+ end
23
+ template.thumbnail title: 'Text Validation', onClick: ->(action) do
24
+ action.windows_open url: json_ui_garage_url(path: 'forms/text_validation')
25
+ end
26
+ template.thumbnail title: 'Others', onClick: ->(action) do
27
+ action.windows_open url: json_ui_garage_url(path: 'forms/others')
28
+ end
20
29
  end
21
30
 
22
31
  end
@@ -0,0 +1,40 @@
1
+ json.title 'Forms'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
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
+ form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
8
+
9
+ # images = [
10
+ # {
11
+ # value: "eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4",
12
+ # fileUrl: "https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100"
13
+ # }
14
+ # ]
15
+ # form.fields_richText name: 'user[bio]', width: 'matchParent', label: 'Content', images: images, value: '<p>Test {{image1}}</p>'
16
+
17
+ json.child! do
18
+ json.view 'fields/richText-v1'
19
+ json.width 'matchParent'
20
+ json.label 'Content'
21
+ json.name 'user[bio]'
22
+ json.value '<p>Test {{image1}}</p>'
23
+
24
+ json.images do
25
+ json.child! do
26
+ json.value "eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4"
27
+ # json.fileTitle "hita i hanom hg.jpg"
28
+ json.fileUrl "https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100"
29
+ end
30
+ end
31
+
32
+ json.imageUploader do
33
+ json.accepts(fileType: "image/*", maxFileSize: 5000)
34
+ json.directUploadUrl rails_direct_uploads_url
35
+ end
36
+ end
37
+
38
+ form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ json.title 'Forms'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
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: Implement vuejs component, e.g. https://vuetifyjs.com/en/components/date-pickers#date-pickers-in-dialog-and-menu
8
+ form.fields_date name: 'user[date]', width: 'matchParent', label: 'Date', min: '1990-01-01', max: '2030-01-01', value: '2010-01-01'
9
+
10
+ # TODO: Implement vuejs component, e.g. using a combination of:
11
+ # - https://vuetifyjs.com/en/components/date-pickers#date-pickers-in-dialog-and-menu
12
+ # - https://vuetifyjs.com/en/components/time-pickers
13
+ form.fields_datetime name: 'user[date_time]', width: 'matchParent', label: 'Date Time', min: '2018-06-07T00:00', max: '2018-06-14T00:00', value: '2018-06-12T19:30'
14
+
15
+ form.fields_latLong name: 'user[address]', width: 'matchParent', label: 'Type an address', value: 'Sydney Harbour Bridge',
16
+ latitudeField: { name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
17
+ longitudeField: { name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true }
18
+
19
+ # json.child! do
20
+ # json.view 'fields/latLong-v1'
21
+ # json.name 'user[address]'
22
+ # json.value 'Sydney Harbour Bridge'
23
+ # json.label 'Type an address'
24
+ # json.latitudeField do
25
+ # json.name 'user[latitude]'
26
+ # json.label 'Lat'
27
+ # json.value -33.8523063
28
+ # json.readOnly true
29
+ # end
30
+ # json.longitudeField do
31
+ # json.name 'user[longitude]'
32
+ # json.label 'Long'
33
+ # json.value 151.21078710000006
34
+ # json.readOnly true
35
+ # end
36
+ # end
37
+
38
+ form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
39
+ end
40
+ end
@@ -0,0 +1,15 @@
1
+ json.title 'Forms'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
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
8
+ form.fields_email name: 'user[email]', width: 'matchParent', label: 'Email'
9
+ form.fields_email name: 'user[url]', width: 'matchParent', label: 'URL'
10
+
11
+ form.panels_split width: 'matchParent', rightViews: ->(split) do
12
+ split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
13
+ end
14
+ end
15
+ end
@@ -1,4 +1,4 @@
1
- json.title 'Home'
1
+ json.title 'Menu'
2
2
 
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
@@ -4,8 +4,8 @@ json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  page.list firstSection: ->(section) do
7
- section.header(padding: { top: 12, left: 16, right: 16, bottom: 12 }) do |header|
8
- header.label text: 'Section Header'
7
+ section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
8
+ header.h3 text: 'Section Header'
9
9
  end
10
10
 
11
11
  section.rows builder: ->(template) do
@@ -8,47 +8,21 @@ json_ui_page json do |page|
8
8
 
9
9
  ['FIRST', 'SECOND', 'THIRD'].each_with_index do |text, index|
10
10
  menu.button text: text, disabled: params[:tab].to_i == index, onClick: ->(action) do
11
- action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar', tab: index)
11
+ # action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar', tab: index)
12
+ action.windows_reload url: json_ui_garage_url(path: 'pages/tab_bar', tab: index)
12
13
  end
13
14
  end
14
15
  end
15
-
16
- # json.child! do
17
- # json.view 'tabBar-v1'
18
- # json.width 'matchParent'
19
- # json.backgroundColor '#ffca05'
20
- # json.color '#7f561b'
21
- # json.tabButtons do
22
- # json.child! do
23
- # json.text 'FIRST'
24
- # json.selected params[:tab] == 0
25
- # json.onClick do
26
- # json.action 'windows/open-v1'
27
- # json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 0)
28
- # end
29
- # end
30
- # json.child! do
31
- # json.text 'SECOND'
32
- # json.selected params[:tab] == 1
33
- # json.onClick do
34
- # json.action 'windows/open-v1'
35
- # json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 1)
36
- # end
37
- # end
38
- # json.child! do
39
- # json.text 'THIRD'
40
- # json.selected params[:tab] == 2
41
- # json.onClick do
42
- # json.action 'windows/open-v1'
43
- # json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 2)
44
- # end
45
- # end
46
- # end
47
- # end
48
16
  end
49
17
 
50
18
  page.scroll padding: {top: 12, left: 20, right: 20, bottom: 12}, childViews: ->(scroll) do
51
- scroll.label text: "Tab index #{params[:tab]} selected"
19
+ scroll.label text: "Tab index #{params[:tab].to_i} selected"
20
+
21
+ scroll.br height: 10
22
+
23
+ 100.times do |i|
24
+ scroll.label text: "Line #{i + 1}"
25
+ end
52
26
  end
53
27
 
54
28
  end
@@ -6,6 +6,13 @@ json_ui_page json do |page|
6
6
  page.scroll padding: {top: 20, left: 20, right: 20, bottom: 20}, childViews: ->(scroll) do
7
7
  scroll.h1 text: 'Map'
8
8
  scroll.br height: 6
9
- scroll.map latitude: 13.4837, longitude: 144.7917, zoom: 11, width: 'matchParent', height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
9
+ scroll.map width: 'matchParent', latitude: 13.4837, longitude: 144.7917, zoom: 11, height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
10
+
11
+ # TODO: Implement in vuejs
12
+ scroll.br height: 20
13
+ scroll.h1 text: 'Calendar'
14
+ scroll.br height: 6
15
+ scroll.calendar width: 'matchParent', height: 500, dataUrl: json_ui_garage_url(path: 'views/calendar_data')
16
+
10
17
  end
11
18
  end
@@ -0,0 +1,29 @@
1
+
2
+ json.events do
3
+ json.child! do
4
+ json.date '2018-12-30'
5
+ json.text 'Birthday'
6
+ json.onClick do
7
+ json.action 'dialogs/alert-v1'
8
+ json.message 'At home'
9
+ end
10
+ end
11
+
12
+ json.child! do
13
+ json.date '2018-12-31'
14
+ json.text 'Conference'
15
+ json.onClick do
16
+ json.action 'dialogs/alert-v1'
17
+ json.message 'In Perth'
18
+ end
19
+ end
20
+
21
+ json.child! do
22
+ json.date '2019-01-01'
23
+ json.text 'Hackathon'
24
+ json.onClick do
25
+ json.action 'dialogs/alert-v1'
26
+ json.message 'At Town Hall'
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,46 @@
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: {top: 20, left: 20, right: 20, bottom: 20}, childViews: ->(scroll) do
7
+ scroll.h1 text: 'Line Chart'
8
+
9
+ json.child! do
10
+ json.view 'charts/line-v1'
11
+ json.dataSeries do
12
+ json.child! do
13
+ json.title 'Line 1'
14
+
15
+ points = {
16
+ 'Sat, 10 Nov 2018' => 1,
17
+ 'Sun, 11 Nov 2018' => 7,
18
+ 'Mon, 12 Nov 2018' => 2,
19
+ 'Tue, 13 Nov 2018' => 0,
20
+ 'Wed, 14 Nov 2018' => 1,
21
+ 'Thu, 15 Nov 2018' => 1,
22
+ 'Fri, 16 Nov 2018' => 5,
23
+ }
24
+ json.dataPoints points
25
+ end
26
+
27
+ json.child! do
28
+ json.title 'Line 2'
29
+
30
+ points = {
31
+ 'Sat, 10 Nov 2018' => 5,
32
+ 'Sun, 11 Nov 2018' => 3,
33
+ 'Mon, 12 Nov 2018' => 8,
34
+ 'Tue, 13 Nov 2018' => 5,
35
+ 'Wed, 14 Nov 2018' => 3,
36
+ 'Thu, 15 Nov 2018' => 5,
37
+ 'Fri, 16 Nov 2018' => 1,
38
+ }
39
+ json.dataPoints points
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -11,9 +11,12 @@ json_ui_page json do |page|
11
11
  template.thumbnail title: 'Images', onClick: ->(action) do
12
12
  action.windows_open url: json_ui_garage_url(path: 'views/images')
13
13
  end
14
- template.thumbnail title: 'Carousel', onClick: ->(action) do
14
+ template.thumbnail title: 'Carousels', onClick: ->(action) do
15
15
  action.windows_open url: json_ui_garage_url(path: 'views/carousels')
16
16
  end
17
+ template.thumbnail title: 'Charts', onClick: ->(action) do
18
+ action.windows_open url: json_ui_garage_url(path: 'views/charts')
19
+ end
17
20
  end
18
21
 
19
22
  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.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -54,8 +54,11 @@ files:
54
54
  - app/views/json_ui/garage/forms/floating_submit.json.jbuilder
55
55
  - app/views/json_ui/garage/forms/generic_post.json.jbuilder
56
56
  - app/views/json_ui/garage/forms/index.json.jbuilder
57
+ - app/views/json_ui/garage/forms/others.json.jbuilder
58
+ - app/views/json_ui/garage/forms/pickers.json.jbuilder
57
59
  - app/views/json_ui/garage/forms/submit_indicator.json.jbuilder
58
60
  - app/views/json_ui/garage/forms/submit_indicator_post.json.jbuilder
61
+ - app/views/json_ui/garage/forms/text_validation.json.jbuilder
59
62
  - app/views/json_ui/garage/home/index.json.jbuilder
60
63
  - app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder
61
64
  - app/views/json_ui/garage/lists/index.json.jbuilder
@@ -72,7 +75,9 @@ files:
72
75
  - app/views/json_ui/garage/panels/split.json.jbuilder
73
76
  - app/views/json_ui/garage/panels/vertical.json.jbuilder
74
77
  - app/views/json_ui/garage/views/basic.json.jbuilder
78
+ - app/views/json_ui/garage/views/calendar_data.json.jbuilder
75
79
  - app/views/json_ui/garage/views/carousels.json.jbuilder
80
+ - app/views/json_ui/garage/views/charts.json.jbuilder
76
81
  - app/views/json_ui/garage/views/images.json.jbuilder
77
82
  - app/views/json_ui/garage/views/index.json.jbuilder
78
83
  - app/views/json_ui/garage/views/map_data.json.jbuilder