glib-web 0.2.4 → 0.2.5

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: c83072e2914de9cfd87a8186b2cedab3845c0e93
4
- data.tar.gz: b6bdb92718c15e224f7036eaa8c7097938bb286f
3
+ metadata.gz: 07f4814b44f64585a3862468a56d2c645eee1b5a
4
+ data.tar.gz: 8f56b831228ffe905f9d46335f95b4e5199bcac3
5
5
  SHA512:
6
- metadata.gz: 9dec1a9494b9fa83d8b354609f0fb47b0996be052b3192cb8e286fc7ae6737110a586f8b2764b8b042f02635f0ab8135bfe19891bebc057165543ad5f7e4af51
7
- data.tar.gz: 0122da0480a928e4b3ad046223fefa581e2c27d1fef0cb36635d62917164b92330ec0e095dd13827a738f2ca88552d63b1ff77167ce2b3b7bfead67d350d67f2
6
+ metadata.gz: 3f9752a9758a0674b3d7d889c35f34633f1ee021b1a8b3e6300677b38f4144d24731febb05606902af1a90237638a68808c597683f3a9fe96442f36853ce39a1
7
+ data.tar.gz: c7e4bc6af22642572c2ba7c65dfcea6c57e0e229ce1031acfdbdd8f6eb109cb543ca0f38b80caaa03c23b71b8a70f76c6eb90da555edb4aa5f2e587380c339b9
@@ -47,9 +47,7 @@ class Glib::JsonUi::ViewBuilder
47
47
  class Hidden < Text
48
48
  end
49
49
 
50
- # class CheckGroup < View
51
- class CheckGroup < AbstractField
52
- # string :name
50
+ class CheckGroup < AbstractField
53
51
  views :childViews
54
52
  string :uncheckValue
55
53
  end
@@ -98,47 +96,11 @@ class Glib::JsonUi::ViewBuilder
98
96
  string :value
99
97
  end
100
98
 
101
- # TODO: Use the array props above to implement `value` property
102
99
  class File < Text
103
- # string :value
104
-
105
- # def value(value)
106
- # # @value = value if value != Glib::Value::DEFAULT
107
- # end
108
-
109
- # def prop(prop)
110
- # super
111
-
112
- # @value ||= form.field_value(prop)
113
-
114
- # # if (form = page.current_form)
115
- # # @name ||= form.field_name(prop)
116
- # # @value ||= form.field_value(prop)
117
- # # end
118
- # end
119
-
120
100
  hash :accepts
121
101
  string :directUploadUrl
122
- # int :file_size_limit
123
- # string :file_size_limit_alert_text
124
-
125
-
126
- def blob(active_storage_blob)
127
- value(active_storage_blob.signed_id)
128
- fileUrl(active_storage_blob.key)
129
-
130
- # Avoid returning active_storage_blob.filename for privacy reason
131
- fileTitle(active_storage_blob.created_at)
132
- end
133
-
134
- # Rename
135
- def fileTitle(file_title)
136
- json.fileTitle file_title
137
- end
138
-
139
- def fileUrl(file_url)
140
- json.fileUrl file_url
141
- end
102
+ string :fileUrl
103
+ string :fileTitle
142
104
  end
143
105
 
144
106
  class Date < AbstractField
@@ -0,0 +1,7 @@
1
+ info = "Submitted information:\n{\n"
2
+ params.require(:user).each do |k, v|
3
+ value = v.is_a?(String) ? '"' + v + '"' : v
4
+ info += " #{k} => #{value}\n"
5
+ end
6
+ info += "}"
7
+ action.dialogs_alert message: info
@@ -3,6 +3,6 @@ json_ui_response json do |action|
3
3
  if !name.present?
4
4
  action.dialogs_alert message: 'Please enter name'
5
5
  else
6
- action.dialogs_alert message: "Submitted information: #{params.require(:user).values.join(", ")}"
6
+ render "#{@path_prefix}/forms/alert_post_data", action: action
7
7
  end
8
8
  end
@@ -4,18 +4,6 @@ json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  page.scroll childViews: ->(scroll) do
7
- scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
8
- form.spacer height: 20
9
- form.h2 text: 'Radio Group'
10
- form.spacer height: 6
11
- form.h4 text: 'Gender'
12
- form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
13
- group.fields_radio value: 'M', label: 'Male'
14
- group.fields_radio value: 'F', label: 'Female'
15
- end
16
-
17
- form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
18
- end
19
7
 
20
8
  scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
21
9
  form.spacer height: 20
@@ -32,108 +20,5 @@ json_ui_page json do |page|
32
20
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
33
21
  end
34
22
 
35
- scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
36
- form.spacer height: 20
37
- form.h2 text: 'Single Check'
38
- form.fields_check name: 'user[employer]', value: 2, uncheckValue: 1, label: 'I am an employer'
39
-
40
- form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
41
- end
42
23
  end
43
-
44
-
45
- # form.spacer height: 20
46
- # form.h2 text: 'Radio/Check'
47
- # form.spacer height: 6
48
- # form.h4 text: 'Gender'
49
- # form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
50
- # group.fields_radio value: 'M', label: 'Male'
51
- # group.fields_radio value: 'F', label: 'Female'
52
- # end
53
-
54
- # page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
55
- # # form.h2 text: 'Select'
56
- # # form.spacer height: 6
57
- # # languages = {
58
- # # 'zh-HK' => 'Hong Kong',
59
- # # 'zh-TW' => 'Taiwan',
60
- # # 'zh-CN' => 'China',
61
- # # 'ja-JP' => 'Japan',
62
- # # 'ko-KR' => 'Korea',
63
- # # 'ru-RU' => 'Russian',
64
- # # 'en-PH' => 'Philippines'
65
- # # }
66
- # # form.fields_select name: 'user[primary_language]', width: 'matchParent', label: 'Primary Language', options: languages.map { |k, v| { value: k, text: v } }, value: 'ja-JP'
67
- # # form.fields_select name: 'user[preferred_languages][]', width: 'matchParent', label: 'Preferred Languages', options: languages.map { |k, v| { value: k, text: v } }, value: ['ja-JP', 'ko-KR'], multiple: true
68
-
69
- # # form.spacer height: 20
70
- # # form.h2 text: 'Date/Time'
71
- # # form.spacer height: 6
72
- # # form.fields_date name: 'user[date]', width: 'matchParent', label: 'Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
73
- # # 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'
74
-
75
- # # form.spacer height: 20
76
- # # form.h2 text: 'Radio/Check'
77
- # # form.spacer height: 6
78
- # # form.h4 text: 'Gender'
79
- # # form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
80
- # # group.fields_radio value: 'M', label: 'Male'
81
- # # group.fields_radio value: 'F', label: 'Female'
82
- # # end
83
- # form.fields_check name: 'user[skills][]', value: 1, label: 'Game Development'
84
- # form.fields_check name: 'user[skills][]', value: 2, label: 'Web Development'
85
- # form.fields_check name: 'user[skills][]', value: 3, label: 'Mobile Development'
86
-
87
- # # form.spacer height: 20
88
- # # form.h2 text: 'Map'
89
- # # form.spacer height: 6
90
- # # form.fields_latLong name: 'user[address]', width: 'matchParent', label: 'Type an address', value: 'Sydney Harbour Bridge',
91
- # # latitudeField: { name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
92
- # # longitudeField: { name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true }
93
-
94
- # form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
95
- # end
96
-
97
- # page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
98
- # # form.h2 text: 'Select'
99
- # # form.spacer height: 6
100
- # # languages = {
101
- # # 'zh-HK' => 'Hong Kong',
102
- # # 'zh-TW' => 'Taiwan',
103
- # # 'zh-CN' => 'China',
104
- # # 'ja-JP' => 'Japan',
105
- # # 'ko-KR' => 'Korea',
106
- # # 'ru-RU' => 'Russian',
107
- # # 'en-PH' => 'Philippines'
108
- # # }
109
- # # form.fields_select name: 'user[primary_language]', width: 'matchParent', label: 'Primary Language', options: languages.map { |k, v| { value: k, text: v } }, value: 'ja-JP'
110
- # # form.fields_select name: 'user[preferred_languages][]', width: 'matchParent', label: 'Preferred Languages', options: languages.map { |k, v| { value: k, text: v } }, value: ['ja-JP', 'ko-KR'], multiple: true
111
-
112
- # # form.spacer height: 20
113
- # # form.h2 text: 'Date/Time'
114
- # # form.spacer height: 6
115
- # # form.fields_date name: 'user[date]', width: 'matchParent', label: 'Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
116
- # # 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'
117
-
118
- # # form.spacer height: 20
119
- # # form.h2 text: 'Radio/Check'
120
- # # form.spacer height: 6
121
- # # form.h4 text: 'Gender'
122
- # # form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
123
- # # group.fields_radio value: 'M', label: 'Male'
124
- # # group.fields_radio value: 'F', label: 'Female'
125
- # # end
126
- # form.fields_check name: 'user[skills][]', value: 1, label: 'Game Development'
127
- # form.fields_check name: 'user[skills][]', value: 2, label: 'Web Development'
128
- # form.fields_check name: 'user[skills][]', value: 3, label: 'Mobile Development'
129
-
130
- # # form.spacer height: 20
131
- # # form.h2 text: 'Map'
132
- # # form.spacer height: 6
133
- # # form.fields_latLong name: 'user[address]', width: 'matchParent', label: 'Type an address', value: 'Sydney Harbour Bridge',
134
- # # latitudeField: { name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
135
- # # longitudeField: { name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true }
136
-
137
- # form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
138
- # end
139
24
  end
@@ -12,11 +12,11 @@ json_ui_page json do |page|
12
12
  page.form options.merge(childViews: ->(form) do
13
13
  rules1 = { fileType: "image/*", maxFileSize: 5000 }
14
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,
15
+ form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Photo', accepts: rules1, directUploadUrl: rails_direct_uploads_url,
16
16
  value: 'eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4',
17
17
  fileUrl: 'https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100',
18
18
  fileTitle: '1 month ago'
19
- form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Photo', accepts: rules2, directUploadUrl: rails_direct_uploads_path
19
+ form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Photo', accepts: rules2, directUploadUrl: rails_direct_uploads_url
20
20
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
21
21
  end)
22
22
  end
@@ -1,3 +1,3 @@
1
1
  json_ui_response json do |action|
2
- action.dialogs_alert message: "Submitted information: #{params.require(:user).values.join(", ")}"
2
+ render "#{@path_prefix}/forms/alert_post_data", action: action
3
3
  end
@@ -6,19 +6,33 @@ json_ui_page json do |page|
6
6
  page.list sections: [
7
7
  ->(section) do
8
8
  section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
9
- header.h2 text: 'Form Fields'
9
+ header.h2 text: 'Submission Logics'
10
10
  end
11
11
 
12
12
  section.rows builder: ->(template) do
13
- template.thumbnail title: 'Basic', onClick: ->(action) do
13
+ template.thumbnail title: 'Basic Logic', onClick: ->(action) do
14
14
  action.windows_open url: json_ui_garage_url(path: 'forms/basic')
15
15
  end
16
+ template.thumbnail title: "Submission Flow (timestamp: #{DateTime.current.to_i})", onClick: ->(action) do
17
+ action.windows_open url: json_ui_garage_url(path: 'forms/submission_flow')
18
+ end
19
+ template.thumbnail title: "Submission Indicator", onClick: ->(action) do
20
+ action.windows_open url: json_ui_garage_url(path: 'forms/submission_indicator')
21
+ end
22
+ template.thumbnail title: 'Text Validation - TODO: web, ios, android', onClick: ->(action) do
23
+ action.windows_open url: json_ui_garage_url(path: 'forms/text_validation')
24
+ end
25
+
26
+ end
27
+ end, ->(section) do
28
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
29
+ header.h2 text: 'Form Fields'
30
+ end
31
+
32
+ section.rows builder: ->(template) do
16
33
  template.thumbnail title: 'Pickers (TODO: ios, android)', onClick: ->(action) do
17
34
  action.windows_open url: json_ui_garage_url(path: 'forms/pickers')
18
35
  end
19
- template.thumbnail title: 'Checkboxes', onClick: ->(action) do
20
- action.windows_open url: json_ui_garage_url(path: 'forms/checkboxes')
21
- end
22
36
  template.thumbnail title: 'File Upload', onClick: ->(action) do
23
37
  action.windows_open url: json_ui_garage_url(path: 'forms/file_upload')
24
38
  end
@@ -29,33 +43,27 @@ json_ui_page json do |page|
29
43
  end
30
44
  end, ->(section) do
31
45
  section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
32
- header.h2 text: 'Submission Logics'
46
+ header.h2 text: 'Web Only'
33
47
  end
34
48
 
35
49
  section.rows builder: ->(template) do
36
- template.thumbnail title: "Submission Flow (timestamp: #{DateTime.current.to_i})", onClick: ->(action) do
37
- action.windows_open url: json_ui_garage_url(path: 'forms/submission_flow')
38
- end
39
- template.thumbnail title: "Submission Indicator", onClick: ->(action) do
40
- action.windows_open url: json_ui_garage_url(path: 'forms/submission_indicator')
41
- end
42
- template.thumbnail title: 'Text Validation - TODO: web, ios, android', onClick: ->(action) do
43
- action.windows_open url: json_ui_garage_url(path: 'forms/text_validation')
50
+ template.thumbnail title: 'Rich Text Editor', onClick: ->(action) do
51
+ action.windows_open url: json_ui_garage_url(path: 'forms/rich_text')
44
52
  end
45
53
 
46
54
  end
47
55
  end, ->(section) do
48
56
  section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
49
- header.h2 text: 'Web Only'
57
+ header.h2 text: 'Experimental (not required yet)'
50
58
  end
51
59
 
52
60
  section.rows builder: ->(template) do
53
- template.thumbnail title: 'Rich Text Editor', onClick: ->(action) do
54
- action.windows_open url: json_ui_garage_url(path: 'forms/rich_text')
55
- end
56
61
  template.thumbnail title: 'Dynamic Select', onClick: ->(action) do
57
62
  action.windows_open url: json_ui_garage_url(path: 'forms/dynamic_select')
58
63
  end
64
+ template.thumbnail title: 'Checkboxes', onClick: ->(action) do
65
+ action.windows_open url: json_ui_garage_url(path: 'forms/checkboxes')
66
+ end
59
67
 
60
68
  end
61
69
  end
@@ -4,6 +4,20 @@ json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
7
+ form.h2 text: 'Radio Group'
8
+ form.spacer height: 6
9
+ form.h4 text: 'Gender'
10
+ form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
11
+ group.fields_radio value: 'M', label: 'Male'
12
+ group.fields_radio value: 'F', label: 'Female'
13
+ end
14
+
15
+ form.spacer height: 20
16
+ form.h2 text: 'Single Checkbox'
17
+ form.fields_check name: 'user[age_range]', value: '16+', uncheckValue: '0-16', label: 'I am over 16 (has default value)'
18
+ form.fields_check name: 'user[employer]', value: 1, label: 'I am an employer (no default value)'
19
+
20
+ form.spacer height: 20
7
21
  form.h2 text: 'Select'
8
22
  form.spacer height: 6
9
23
  languages = {
@@ -23,15 +37,6 @@ json_ui_page json do |page|
23
37
  form.spacer height: 6
24
38
  form.fields_date name: 'user[date]', width: 'matchParent', label: 'Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
25
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'
26
-
27
- # form.spacer height: 20
28
- # form.h2 text: 'Radio/Check'
29
- # form.spacer height: 6
30
- # form.h4 text: 'Gender'
31
- # form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
32
- # group.fields_radio value: 'M', label: 'Male'
33
- # group.fields_radio value: 'F', label: 'Female'
34
- # end
35
40
 
36
41
  form.spacer height: 20
37
42
  form.h2 text: 'Map'
@@ -41,5 +46,28 @@ json_ui_page json do |page|
41
46
  longitudeField: { name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true }
42
47
 
43
48
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
49
+
44
50
  end
51
+
52
+
53
+ # scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
54
+ # form.spacer height: 20
55
+ # form.h2 text: 'Radio Group'
56
+ # form.spacer height: 6
57
+ # form.h4 text: 'Gender'
58
+ # form.fields_radioGroup name: 'user[gender]', childViews: ->(group) do
59
+ # group.fields_radio value: 'M', label: 'Male'
60
+ # group.fields_radio value: 'F', label: 'Female'
61
+ # end
62
+
63
+ # form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
64
+ # end
65
+
66
+ # scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: body_padding, childViews: ->(form) do
67
+ # form.spacer height: 20
68
+ # form.h2 text: 'Single Check'
69
+ # form.fields_check name: 'user[employer]', value: 2, uncheckValue: 1, label: 'I am an employer'
70
+
71
+ # form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
72
+ # end
45
73
  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.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -49,6 +49,7 @@ files:
49
49
  - app/views/app/views/json_ui/vue/renderer.html.erb
50
50
  - app/views/json_ui/garage/_nav_menu.json.jbuilder
51
51
  - app/views/json_ui/garage/actions/index.json.jbuilder
52
+ - app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder
52
53
  - app/views/json_ui/garage/forms/basic.json.jbuilder
53
54
  - app/views/json_ui/garage/forms/basic_post.json.jbuilder
54
55
  - app/views/json_ui/garage/forms/checkboxes.json.jbuilder