glib-web 0.2.14 → 0.2.15

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: 9af143aaa548fc1fcad92cf73e2b8be4787f593f
4
- data.tar.gz: b77e3a12b92a6275f214e0aa4a9d5feceea3821c
3
+ metadata.gz: 59b75aa6c868bd135ec30d6dbee76230273552a2
4
+ data.tar.gz: 97a6c118d67b7b30e5bef02d37cb72268291f145
5
5
  SHA512:
6
- metadata.gz: df7e7304cf6047e287cbd798a64f62fc9492c2fccda3ae36d90f2fcbbf2b3b9e9867def3c8a54447f3d73eb77a539e258860a60e1ee5e7944efb2d3e64be36f7
7
- data.tar.gz: 86f0d9133fcab5dbfcbd13b8e8b53d4b49ee0e439161615e6f6da12ed4cd25237a5aae4ec4e31567deeb26d8dfb6bdcb14af92c0633a2724b03b4dc64e1bc698
6
+ metadata.gz: 6a5b1aebfce1d89720cec4e13f91123fc1cc1345e0891deb5c9f9e8451ccff48823a71056e0d3dc17ad427162c39904e97b5b0db4218ec6af03448fe80c30354
7
+ data.tar.gz: d736bdf4eaa401c6ffacd9782093bb251d127c013838b3d501d9ba35f36b861b2218ad9fb5b943a8c84b1ef0b32250280099ea4201820cd8154f591b3a4baabd
@@ -44,11 +44,11 @@ module Glib
44
44
  action :onClose
45
45
  end
46
46
 
47
- class Confirm < Action
48
- string :message
49
- action :onConfirm
50
- action :onCancel
51
- end
47
+ # class Confirm < Action
48
+ # string :message
49
+ # action :onConfirm
50
+ # action :onCancel
51
+ # end
52
52
 
53
53
  class Options < Action
54
54
  string :message
@@ -64,6 +64,7 @@ module Glib
64
64
  string :url, cache: true
65
65
  end
66
66
 
67
+ # TODO: Deprecate
67
68
  # Consider renaming to ShowSnackbar
68
69
  class Snackbar < Action
69
70
  string :message
@@ -73,6 +74,43 @@ module Glib
73
74
  end
74
75
 
75
76
  end
77
+
78
+ module Snackbars
79
+ class Alert < Action
80
+ string :message
81
+ action :onClose
82
+
83
+ string :verticalPosition
84
+ string :horizontalPosition
85
+ singleton_array :styleClass, :styleClasses
86
+ end
87
+
88
+ # class Confirm < Action
89
+ # string :message
90
+ # action :onConfirm
91
+ # action :onCancel
92
+
93
+ # string :verticalPosition
94
+ # string :horizontalPosition
95
+ # singleton_array :styleClass, :styleClasses
96
+ # end
97
+
98
+ class Options < Action
99
+ string :message
100
+
101
+ string :verticalPosition
102
+ string :horizontalPosition
103
+ singleton_array :styleClass, :styleClasses
104
+
105
+ def buttons(block)
106
+ json.buttons do
107
+ block.call page.menu_builder
108
+ end
109
+ end
110
+
111
+ end
112
+
113
+ end
76
114
 
77
115
  module Forms
78
116
  class Submit < Action
@@ -83,6 +83,11 @@ module Glib
83
83
  action :onClick
84
84
  end
85
85
 
86
+ # class Banner < View
87
+ # icon :icon
88
+ # string :text
89
+ # end
90
+
86
91
  class Button < View
87
92
  icon :icon, cache: true
88
93
  string :text, cache: true
@@ -0,0 +1,24 @@
1
+ class Glib::JsonUi::ViewBuilder
2
+ module Banners
3
+
4
+ class Alert < View
5
+ icon :icon
6
+ string :message
7
+ singleton_array :styleClass, :styleClasses
8
+ end
9
+
10
+ # TODO: Implement
11
+ class Options < View
12
+ icon :icon
13
+ string :message
14
+ singleton_array :styleClass, :styleClasses
15
+
16
+ def buttons(block)
17
+ json.buttons do
18
+ block.call page.menu_builder
19
+ end
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -61,6 +61,7 @@ class Glib::JsonUi::ViewBuilder
61
61
 
62
62
  class Check < Text
63
63
  string :uncheckValue
64
+ bool :checked
64
65
  end
65
66
 
66
67
  # This doesn't use camel case because some terms have become single words (e.g. snackbar)
@@ -11,9 +11,19 @@ json_ui_page json do |page|
11
11
 
12
12
  section.rows builder: ->(template) do
13
13
  template.thumbnail title: 'dialogs/alert', onClick: ->(action) do
14
- action.dialogs_alert message: 'This is an alert'
14
+ action.dialogs_alert message: 'This is an alert dialog', onClose: ->(action) do
15
+ action.dialogs_snackbar message: 'Closed'
16
+ end
15
17
  end
16
18
 
19
+ # template.thumbnail title: 'dialogs/confirm (Experimental)', onClick: ->(action) do
20
+ # action.dialogs_confirm message: 'This is a confirm dialog', onCancel: ->(action) do
21
+ # action.dialogs_snackbar message: 'Canceled'
22
+ # end, onConfirm: ->(action) do
23
+ # action.dialogs_snackbar message: 'Confirmed'
24
+ # end
25
+ # end
26
+
17
27
  template.thumbnail title: 'dialogs/option', onClick: ->(action) do
18
28
  action.dialogs_options message: 'Select one', buttons: ->(menu) do
19
29
  menu.button text: 'Option1', onClick: ->(action) do
@@ -30,13 +40,47 @@ json_ui_page json do |page|
30
40
  action.dialogs_open url: json_ui_garage_url(path: 'forms/basic')
31
41
  end
32
42
 
33
- template.thumbnail title: 'dialogs/snackbar', onClick: ->(action) do
43
+ template.thumbnail title: 'dialogs/snackbar (Legacy)', onClick: ->(action) do
34
44
  action.dialogs_snackbar message: 'This is a default snackbar'
35
45
  end
36
46
 
37
- template.thumbnail title: 'dialogs/snackbar with styling', onClick: ->(action) do
38
- action.dialogs_snackbar message: 'This is a styled snackbar', verticalPosition: 'top', styleClass: 'success'
47
+ end
48
+ end, ->(section) do
49
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
50
+ header.h3 text: 'Snackbars'
51
+ end
52
+
53
+ section.rows builder: ->(template) do
54
+ template.thumbnail title: 'snackbars/alert', onClick: ->(action) do
55
+ action.snackbars_alert message: 'This is an alert snackbar', onClose: ->(action) do
56
+ action.dialogs_alert message: 'Closed'
57
+ end
39
58
  end
59
+
60
+ # template.thumbnail title: 'snackbars/confirm (Experimental)', onClick: ->(action) do
61
+ # action.snackbars_confirm message: 'This is a confirm dialog', onCancel: ->(action) do
62
+ # action.dialogs_alert message: 'Canceled'
63
+ # end, onConfirm: ->(action) do
64
+ # action.dialogs_alert message: 'Confirmed'
65
+ # end
66
+ # end
67
+
68
+ template.thumbnail title: 'snackbars/options', onClick: ->(action) do
69
+ action.snackbars_options message: 'Select one', buttons: ->(menu) do
70
+ menu.button text: 'Option1', onClick: ->(action) do
71
+ action.dialogs_alert message: 'Option 1'
72
+ end
73
+ menu.button text: 'Option2', onClick: ->(action) do
74
+ action.dialogs_alert message: 'Option 2'
75
+ end
76
+ menu.button text: 'Cancel'
77
+ end
78
+ end
79
+
80
+ template.thumbnail title: 'snackbars with styling', onClick: ->(action) do
81
+ action.snackbars_alert message: 'This is a styled snackbar', verticalPosition: 'top', styleClass: 'success'
82
+ end
83
+
40
84
  end
41
85
  end, ->(section) do
42
86
  section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
@@ -16,7 +16,8 @@ json_ui_page json do |page|
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_url
19
+ form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Photo', accepts: rules2, directUploadUrl: rails_direct_uploads_url,
20
+ styleClass: 'avatar'
20
21
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
21
22
  end)
22
23
  end
@@ -9,16 +9,13 @@ json_ui_page json do |page|
9
9
  form.h2 text: 'Basic select fields'
10
10
  form.spacer height: 6
11
11
  languages = {
12
- 'zh-HK' => 'Hong Kong',
13
- 'zh-TW' => 'Taiwan',
14
- 'zh-CN' => 'China',
15
- 'ja-JP' => 'Japan',
16
- 'ko-KR' => 'Korea',
17
- 'ru-RU' => 'Russian',
18
- 'en-PH' => 'Philippines'
12
+ 'brisbane' => 'Brisbane',
13
+ 'canberra' => 'Canberra',
14
+ 'melbourne' => 'Melbourne',
15
+ 'sydney' => 'Sydney',
19
16
  }
20
- form.fields_select name: 'user[primary_language]', width: 'matchParent', label: 'Primary Language', options: languages.map { |k, v| { value: k, text: v } }, value: 'ja-JP'
21
- 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
17
+ form.fields_select name: 'user[city]', width: 'matchParent', label: 'Primary Language', options: languages.map { |k, v| { value: k, text: v } }, value: 'canberra'
18
+ form.fields_select name: 'user[cities][]', width: 'matchParent', label: 'Preferred Languages', options: languages.map { |k, v| { value: k, text: v } }, value: ['melbourne', 'sydney'], multiple: true
22
19
 
23
20
  form.spacer height: 20
24
21
  form.h2 text: 'Select fields with manual entry'
@@ -32,7 +29,24 @@ json_ui_page json do |page|
32
29
  form.spacer height: 6
33
30
  form.label text: 'Applicable to select fields with many options'
34
31
  form.spacer height: 6
35
- # TODO
32
+
33
+ languages = {
34
+ "ar" => 'Arabic',
35
+ "zh" => "Chinese",
36
+ "nl" => "Dutch",
37
+ "en" => "English",
38
+ "fr" => "French",
39
+ "de" => "German",
40
+ "hi" => "Hindi",
41
+ "it" => "Italian",
42
+ "ja" => "Japanese",
43
+ "ko" => "Korean",
44
+ "pt" => "Portuguese",
45
+ "ru" => "Russian",
46
+ "es" => "Spanish",
47
+ }
48
+ form.fields_select name: 'user[language]', width: 'matchParent', label: 'Primary Language', options: languages.map { |k, v| { value: k, text: v } }, value: 'nl'
49
+ form.fields_select name: 'user[languages][]', width: 'matchParent', label: 'Primary Language', options: languages.map { |k, v| { value: k, text: v } }, value: ['fr', 'de'], multiple: true
36
50
 
37
51
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
38
52
 
@@ -71,23 +71,24 @@ json_ui_page json do |page|
71
71
  scroll.h2 text: 'Grid-like layout'
72
72
  scroll.spacer height: 6
73
73
  scroll.panels_responsive childViews: ->(horizontal) do
74
- horizontal.panels_column lg: 4, padding: glib_json_padding_body, childViews: ->(column) do
75
- column.panels_vertical styleClass: 'card', width: 'matchParent', childViews: ->(column) do
74
+ gap = { top: 12, left: 10, right: 10, bottom: 12 }
75
+ horizontal.panels_column lg: 4, padding: gap, childViews: ->(column) do
76
+ column.panels_vertical styleClass: 'card', width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
76
77
  column.button text: '1'
77
78
  end
78
79
  end
79
- horizontal.panels_column lg: 4, padding: glib_json_padding_body, childViews: ->(column) do
80
- column.panels_vertical styleClass: 'card', width: 'matchParent', childViews: ->(column) do
80
+ horizontal.panels_column lg: 4, padding: gap, childViews: ->(column) do
81
+ column.panels_vertical styleClass: 'card', width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
81
82
  column.button text: '2'
82
83
  end
83
84
  end
84
- horizontal.panels_column lg: 4, padding: glib_json_padding_body, childViews: ->(column) do
85
- column.panels_vertical styleClass: 'card', width: 'matchParent', childViews: ->(column) do
85
+ horizontal.panels_column lg: 4, padding: gap, childViews: ->(column) do
86
+ column.panels_vertical styleClass: 'card', width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
86
87
  column.button text: '3'
87
88
  end
88
89
  end
89
- horizontal.panels_column lg: 4, padding: glib_json_padding_body, childViews: ->(column) do
90
- column.panels_vertical styleClass: 'card', width: 'matchParent', childViews: ->(column) do
90
+ horizontal.panels_column lg: 4, padding: gap, childViews: ->(column) do
91
+ column.panels_vertical styleClass: 'card', width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
91
92
  column.button text: '4'
92
93
  end
93
94
  end
@@ -0,0 +1,19 @@
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
+
8
+ scroll.spacer height: 20
9
+ scroll.h2 text: 'Alert banner'
10
+ scroll.spacer height: 6
11
+ scroll.banners_alert width: 'matchParent', icon: 'info', message: 'This is an alert banner'
12
+
13
+ scroll.spacer height: 20
14
+ scroll.h2 text: 'Alert banner with styling'
15
+ scroll.spacer height: 6
16
+ scroll.banners_alert width: 'matchParent', icon: 'info', message: 'This is an alert banner', styleClass: 'success'
17
+
18
+ end
19
+ end
@@ -23,6 +23,9 @@ json_ui_page json do |page|
23
23
  template.thumbnail title: 'Links', onClick: ->(action) do
24
24
  action.windows_open url: json_ui_garage_url(path: 'views/links')
25
25
  end
26
+ template.thumbnail title: 'Banners', onClick: ->(action) do
27
+ action.windows_open url: json_ui_garage_url(path: 'views/banners')
28
+ end
26
29
  end
27
30
 
28
31
  end
@@ -20,8 +20,8 @@ json_ui_page json do |page|
20
20
 
21
21
  scroll.spacer height: 20
22
22
  scroll.hr width: 'matchParent'
23
- scroll.spacer height: 20
24
23
 
24
+ scroll.spacer height: 20
25
25
  scroll.h2 text: 'Paragraph'
26
26
  scroll.spacer height: 6
27
27
  scroll.p text: 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC,'\
@@ -33,9 +33,15 @@ json_ui_page json do |page|
33
33
  'The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum"'\
34
34
  ' by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.'
35
35
 
36
+ scroll.spacer height: 20
36
37
  scroll.h2 text: 'Chip'
37
38
  scroll.spacer height: 6
38
39
  scroll.chip text: 'pending'
39
40
 
41
+ scroll.spacer height: 20
42
+ scroll.h2 text: 'Banner'
43
+ scroll.spacer height: 6
44
+ scroll.banners_alert icon: 'info', message: 'This is an alert banner'
45
+
40
46
  end
41
47
  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.14
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -44,6 +44,7 @@ files:
44
44
  - app/helpers/glib/json_ui/styling_helper.rb
45
45
  - app/helpers/glib/json_ui/table_builders.rb
46
46
  - app/helpers/glib/json_ui/view_builder.rb
47
+ - app/helpers/glib/json_ui/view_builder/banners.rb
47
48
  - app/helpers/glib/json_ui/view_builder/fields.rb
48
49
  - app/helpers/glib/json_ui/view_builder/panels.rb
49
50
  - app/views/app/views/json_ui/vue/renderer.html.erb
@@ -92,6 +93,7 @@ files:
92
93
  - app/views/json_ui/garage/panels/split.json.jbuilder
93
94
  - app/views/json_ui/garage/panels/table.json.jbuilder
94
95
  - app/views/json_ui/garage/panels/vertical.json.jbuilder
96
+ - app/views/json_ui/garage/views/banners.json.jbuilder
95
97
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder
96
98
  - app/views/json_ui/garage/views/carousels.json.jbuilder
97
99
  - app/views/json_ui/garage/views/charts.json.jbuilder