glib-web 0.2.13 → 0.2.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/json_ui/abstract_builder.rb +2 -0
  3. data/app/helpers/glib/json_ui/action_builder.rb +4 -0
  4. data/app/helpers/glib/json_ui/page_helper.rb +4 -0
  5. data/app/helpers/glib/json_ui/styling_helper.rb +4 -8
  6. data/app/helpers/glib/json_ui/view_builder.rb +1 -1
  7. data/app/helpers/glib/json_ui/view_builder/fields.rb +2 -0
  8. data/app/helpers/glib/json_ui/view_builder/panels.rb +13 -8
  9. data/app/views/json_ui/garage/actions/index.json.jbuilder +4 -1
  10. data/app/views/json_ui/garage/forms/basic.json.jbuilder +1 -1
  11. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +1 -1
  12. data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +1 -1
  13. data/app/views/json_ui/garage/forms/get_request.json.jbuilder +1 -1
  14. data/app/views/json_ui/garage/forms/index.json.jbuilder +4 -4
  15. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +1 -16
  16. data/app/views/json_ui/garage/forms/selects.json.jbuilder +1 -1
  17. data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +1 -1
  18. data/app/views/json_ui/garage/home/blank.json.jbuilder +1 -1
  19. data/app/views/json_ui/garage/lists/fab.json.jbuilder +1 -1
  20. data/app/views/json_ui/garage/lists/templating.json.jbuilder +2 -2
  21. data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +29 -0
  22. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +29 -0
  23. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +3 -3
  24. data/app/views/json_ui/garage/pages/index.json.jbuilder +31 -14
  25. data/app/views/json_ui/garage/pages/layout.json.jbuilder +3 -3
  26. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +1 -1
  27. data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +1 -1
  28. data/app/views/json_ui/garage/panels/card.json.jbuilder +85 -16
  29. data/app/views/json_ui/garage/panels/carousel.json.jbuilder +1 -1
  30. data/app/views/json_ui/garage/panels/custom.json.jbuilder +2 -2
  31. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +1 -1
  32. data/app/views/json_ui/garage/panels/index.json.jbuilder +17 -8
  33. data/app/views/json_ui/garage/panels/responsive.json.jbuilder +1 -1
  34. data/app/views/json_ui/garage/panels/split.json.jbuilder +1 -1
  35. data/app/views/json_ui/garage/panels/vertical.json.jbuilder +1 -1
  36. data/app/views/json_ui/garage/views/images.json.jbuilder +3 -3
  37. data/app/views/json_ui/garage/views/links.json.jbuilder +3 -3
  38. data/app/views/json_ui/garage/views/misc.json.jbuilder +1 -1
  39. data/app/views/json_ui/garage/views/texts.json.jbuilder +1 -1
  40. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f39277110861a205e86572fb7c4e3e25ae8a550
4
- data.tar.gz: 1fe363ea9f6186f6275ae2058db85782b4790643
3
+ metadata.gz: 9af143aaa548fc1fcad92cf73e2b8be4787f593f
4
+ data.tar.gz: b77e3a12b92a6275f214e0aa4a9d5feceea3821c
5
5
  SHA512:
6
- metadata.gz: 5d623b172742bb574f9ccd45644d315a73dff76c627766f744a9342bfee59c691cf2c0a37785105cf3444a61a6abe9982744372b87a06493d4d7c275e4592cc1
7
- data.tar.gz: 4fa48b1fdbe0d3f971197fdd4cd56c67f38fa5791c4922f5a004ba7e033fd77de4b867181b360fc417e7963f8554a68f92f5b115caf04cdb2666b47d7d3a97f6
6
+ metadata.gz: df7e7304cf6047e287cbd798a64f62fc9492c2fccda3ae36d90f2fcbbf2b3b9e9867def3c8a54447f3d73eb77a539e258860a60e1ee5e7944efb2d3e64be36f7
7
+ data.tar.gz: 86f0d9133fcab5dbfcbd13b8e8b53d4b49ee0e439161615e6f6da12ed4cd25237a5aae4ec4e31567deeb26d8dfb6bdcb14af92c0633a2724b03b4dc64e1bc698
@@ -208,6 +208,8 @@ module Glib
208
208
  end
209
209
 
210
210
  def self.singleton_array singletonName, arrayName
211
+ array arrayName
212
+
211
213
  define_method(singletonName) do |value|
212
214
  json.set! arrayName, [value]
213
215
  end
@@ -67,6 +67,9 @@ module Glib
67
67
  # Consider renaming to ShowSnackbar
68
68
  class Snackbar < Action
69
69
  string :message
70
+ string :verticalPosition
71
+ string :horizontalPosition
72
+ singleton_array :styleClass, :styleClasses
70
73
  end
71
74
 
72
75
  end
@@ -88,6 +91,7 @@ module Glib
88
91
 
89
92
  class Open < Action
90
93
  string :url, cache: true
94
+ action :onOpen
91
95
  end
92
96
 
93
97
  class OpenWeb < Action
@@ -41,6 +41,10 @@ module Glib
41
41
  end
42
42
  end
43
43
 
44
+ def template(template)
45
+ json.template template
46
+ end
47
+
44
48
  def leftDrawer(options = {})
45
49
  # json.leftDrawer do
46
50
  # json.title options[:title]
@@ -1,23 +1,19 @@
1
1
  module Glib
2
2
  module JsonUi
3
3
  module StylingHelper
4
- def json_padding_body
4
+ def glib_json_padding_body
5
5
  { top: 12, left: 20, right: 20, bottom: 12 }
6
6
  end
7
7
 
8
- def json_padding_list
8
+ def glib_json_padding_list
9
9
  { top: 12, bottom: 12, left: 16, right: 16 }
10
10
  end
11
-
12
- def json_padding_body_this
13
- { top: 6, right: 10, bottom: 6, left: 10 }
14
- end
15
11
 
16
- def json_image_standard_url
12
+ def glib_json_image_standard_url
17
13
  'https://cdn-images-1.medium.com/max/1200/1*Qc0XxYm-qAZL-7tjjlNfrg.png'
18
14
  end
19
15
 
20
- def json_image_avatar_url
16
+ def glib_json_image_avatar_url
21
17
  'https://www.wpjournalist.nl/wp-content/uploads/2019/03/avatar-jongen-voorbeeld-1.jpg'
22
18
  end
23
19
  end
@@ -14,7 +14,7 @@ module Glib
14
14
  length :height
15
15
  color :backgroundColor
16
16
  hash :padding
17
- array :styleClasses
17
+ # array :styleClasses
18
18
  singleton_array :styleClass, :styleClasses
19
19
 
20
20
  def analytics(value)
@@ -38,6 +38,8 @@ class Glib::JsonUi::ViewBuilder
38
38
  end
39
39
 
40
40
  class Number < Text
41
+ date :min
42
+ date :max
41
43
  end
42
44
 
43
45
  class Email < Text
@@ -37,18 +37,22 @@ class Glib::JsonUi::ViewBuilder
37
37
  end
38
38
 
39
39
  def model(models)
40
- @model = models.is_a?(Array) ? models.last : models
41
- @model_name ||= @model.class.model_name.singular
42
- @url ||= page.context.polymorphic_url(models)
43
- @method ||= if @model.persisted?
44
- :patch
45
- else
46
- :post
47
- end
40
+ @models = models
48
41
  end
49
42
 
50
43
  # Override
51
44
  def created
45
+ if @models
46
+ @model = @models.is_a?(Array) ? @models.last : @models
47
+ @model_name ||= @model.class.model_name.singular
48
+ @url ||= page.context.polymorphic_url(@models)
49
+ @method ||= if @model.persisted?
50
+ :patch
51
+ else
52
+ :post
53
+ end
54
+ end
55
+
52
56
  @method ||= :get
53
57
 
54
58
  json.url @url
@@ -150,6 +154,7 @@ class Glib::JsonUi::ViewBuilder
150
154
  string :distribution
151
155
  end
152
156
 
157
+ # TODO: Deprecate in favour of styleClasses
153
158
  class Card < View
154
159
  views :childViews
155
160
  end
@@ -31,9 +31,12 @@ json_ui_page json do |page|
31
31
  end
32
32
 
33
33
  template.thumbnail title: 'dialogs/snackbar', onClick: ->(action) do
34
- action.dialogs_snackbar message: 'This is a snackbar'
34
+ action.dialogs_snackbar message: 'This is a default snackbar'
35
35
  end
36
36
 
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'
39
+ end
37
40
  end
38
41
  end, ->(section) do
39
42
  section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
@@ -3,7 +3,7 @@ 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: json_padding_body, childViews: ->(form) do
6
+ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
8
8
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
9
9
 
@@ -5,7 +5,7 @@ json_ui_page json do |page|
5
5
 
6
6
  page.scroll childViews: ->(scroll) do
7
7
 
8
- scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: json_padding_body, childViews: ->(form) do
8
+ scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
9
9
  form.spacer height: 20
10
10
  form.h2 text: 'Check Group'
11
11
  form.fields_checkGroup name: 'user[skills][]', uncheckValue: 1, childViews: ->(group) do
@@ -3,7 +3,7 @@ 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/generic_post'), method: 'post', padding: json_padding_body, childViews: ->(form) do
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
  form.h2 text: 'Dynamic Select'
8
8
  form.spacer height: 6
9
9
 
@@ -5,7 +5,7 @@ data = params[:user] || {}
5
5
  json_ui_page json do |page|
6
6
  render "#{@path_prefix}/nav_menu", json: json, page: page
7
7
 
8
- page.form url: json_ui_garage_url(path: 'forms/get_request'), method: 'get', padding: json_padding_body, childViews: ->(form) do
8
+ page.form url: json_ui_garage_url(path: 'forms/get_request'), method: 'get', padding: glib_json_padding_body, childViews: ->(form) do
9
9
  # TODO: Potential improvement:
10
10
  # Use `reload` behaviour instead of `open` (i.e. don't keep adding URL to history).
11
11
  # Probably introduce a flag to panels_form so developer can enable/disable this behaviour.
@@ -5,7 +5,7 @@ json_ui_page json do |page|
5
5
 
6
6
  page.list sections: [
7
7
  ->(section) do
8
- section.header padding: json_padding_list, childViews: ->(header) do
8
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
9
9
  header.h2 text: 'Submission Logics'
10
10
  end
11
11
 
@@ -28,7 +28,7 @@ json_ui_page json do |page|
28
28
 
29
29
  end
30
30
  end, ->(section) do
31
- section.header padding: json_padding_list, childViews: ->(header) do
31
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
32
32
  header.h2 text: 'Form Fields'
33
33
  end
34
34
 
@@ -48,7 +48,7 @@ json_ui_page json do |page|
48
48
 
49
49
  end
50
50
  end, ->(section) do
51
- section.header padding: json_padding_list, childViews: ->(header) do
51
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
52
52
  header.h2 text: 'Web Only'
53
53
  end
54
54
 
@@ -59,7 +59,7 @@ json_ui_page json do |page|
59
59
 
60
60
  end
61
61
  end, ->(section) do
62
- section.header padding: json_padding_list, childViews: ->(header) do
62
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
63
63
  header.h2 text: 'Experimental (not required yet)'
64
64
  end
65
65
 
@@ -3,7 +3,7 @@ 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/generic_post'), method: 'post', padding: json_padding_body, childViews: ->(form) do
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
  form.h2 text: 'Radio Group'
8
8
  form.spacer height: 6
9
9
  form.h4 text: 'Gender'
@@ -17,21 +17,6 @@ json_ui_page json do |page|
17
17
  form.fields_check name: 'user[age_range]', value: '16+', uncheckValue: '0-16', label: 'I am over 16 (has default value)'
18
18
  form.fields_check name: 'user[employer]', value: 1, label: 'I am an employer (no default value)'
19
19
 
20
- # form.spacer height: 20
21
- # form.h2 text: 'Select'
22
- # form.spacer height: 6
23
- # languages = {
24
- # 'zh-HK' => 'Hong Kong',
25
- # 'zh-TW' => 'Taiwan',
26
- # 'zh-CN' => 'China',
27
- # 'ja-JP' => 'Japan',
28
- # 'ko-KR' => 'Korea',
29
- # 'ru-RU' => 'Russian',
30
- # 'en-PH' => 'Philippines'
31
- # }
32
- # form.fields_select name: 'user[primary_language]', width: 'matchParent', label: 'Primary Language', options: languages.map { |k, v| { value: k, text: v } }, value: 'ja-JP'
33
- # 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
34
-
35
20
  form.spacer height: 20
36
21
  form.h2 text: 'Date/Time'
37
22
  form.spacer height: 6
@@ -3,7 +3,7 @@ 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/generic_post'), method: 'post', padding: json_padding_body, childViews: ->(form) do
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
 
8
8
  form.spacer height: 20
9
9
  form.h2 text: 'Basic select fields'
@@ -3,7 +3,7 @@ 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/generic_post'), method: 'post', padding: json_padding_body, childViews: ->(form) do
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
  form.fields_email name: 'user[email]', width: 'matchParent', label: 'Email'
8
8
  form.fields_url name: 'user[url]', width: 'matchParent', label: 'URL'
9
9
  form.fields_number name: 'user[number]', width: 'matchParent', label: 'Number'
@@ -5,7 +5,7 @@ json.title 'Menu'
5
5
  json_ui_page json do |page|
6
6
  render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
7
7
 
8
- page.scroll padding: json_padding_body, childViews: ->(scroll) do
8
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
9
9
  scroll.label text: 'Blank page'
10
10
  end
11
11
  end
@@ -3,7 +3,7 @@ json.title 'Lists'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- # page.body height: 'matchParent', padding: json_padding_body, childViews: ->(body) do
6
+ # page.body height: 'matchParent', padding: glib_json_padding_body, childViews: ->(body) do
7
7
  page.body childViews: ->(body) do
8
8
  body.fab icon: 'add', onClick: ->(action) { action.dialogs_alert message: 'Perform action' }
9
9
 
@@ -13,8 +13,8 @@ json_ui_page json do |page|
13
13
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
14
14
  end
15
15
  template.thumbnail title: 'Item with subtitle', subtitle: 'Item subtitle'
16
- template.thumbnail title: 'Item with thumbnail image', subtitle: 'Item subtitle', imageUrl: json_image_standard_url
17
- template.featured title: 'Featured with featured image', subtitle: 'Item subtitle', imageUrl: json_image_standard_url
16
+ template.thumbnail title: 'Item with thumbnail image', subtitle: 'Item subtitle', imageUrl: glib_json_image_standard_url
17
+ template.featured title: 'Featured with featured image', subtitle: 'Item subtitle', imageUrl: glib_json_image_standard_url
18
18
  end
19
19
  end
20
20
  end
@@ -0,0 +1,29 @@
1
+ json.title 'Pages'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.template 'flatCentered'
7
+
8
+ page.header childViews: ->(header) do
9
+ header.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
10
+ card.h1 text: 'Header'
11
+ end
12
+ header.spacer height: 20
13
+ end
14
+
15
+ page.footer childViews: ->(footer) do
16
+ footer.spacer height: 20
17
+ footer.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
18
+ card.h1 text: 'Footer'
19
+ end
20
+ end
21
+
22
+ page.body childViews: ->(scroll) do
23
+ scroll.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
24
+ (1..100).each do |index|
25
+ scroll.label text: 'Content'
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ json.title 'Pages'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.template 'fullWidth'
7
+
8
+ page.header childViews: ->(header) do
9
+ header.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
10
+ card.h1 text: 'Header'
11
+ end
12
+ header.spacer height: 10
13
+ end
14
+
15
+ page.footer childViews: ->(footer) do
16
+ footer.spacer height: 10
17
+ footer.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
18
+ card.h1 text: 'Footer'
19
+ end
20
+ end
21
+
22
+ page.body childViews: ->(scroll) do
23
+ scroll.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
24
+ (1..100).each do |index|
25
+ scroll.label text: 'Content'
26
+ end
27
+ end
28
+ end
29
+ end
@@ -3,15 +3,15 @@ json.title 'Pages'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.header padding: json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
6
+ page.header padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
7
7
  header.h1 text: 'Header'
8
8
  end
9
9
 
10
- page.body height: 'matchParent', padding: json_padding_body, childViews: ->(body) do
10
+ page.body height: 'matchParent', padding: glib_json_padding_body, childViews: ->(body) do
11
11
  body.button width: 'matchParent', height: 'matchParent', text: 'Full Width/Height'
12
12
  end
13
13
 
14
- page.footer height: 80, padding: json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
14
+ page.footer height: 80, padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
15
15
  footer.h1 text: 'Footer'
16
16
  end
17
17
  end
@@ -3,24 +3,41 @@ json.title 'Pages'
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
- page.list firstSection: ->(section) do
7
- section.rows builder: ->(template) do
8
- template.thumbnail title: 'Hamburger Layout', onClick: ->(action) do
9
- action.windows_open url: json_ui_garage_url(path: 'pages/layout')
10
- end
11
-
12
- template.thumbnail title: 'Full Width/Height', onClick: ->(action) do
13
- action.windows_open url: json_ui_garage_url(path: 'pages/full_width_height')
6
+ page.list sections: [
7
+ ->(section) do
8
+ section.rows builder: ->(template) do
9
+ template.thumbnail title: 'Hamburger Layout', onClick: ->(action) do
10
+ action.windows_open url: json_ui_garage_url(path: 'pages/layout')
11
+ end
12
+
13
+ template.thumbnail title: 'Full Width/Height', onClick: ->(action) do
14
+ action.windows_open url: json_ui_garage_url(path: 'pages/full_width_height')
15
+ end
16
+
17
+ template.thumbnail title: 'Tab Bar', onClick: ->(action) do
18
+ action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar')
19
+ end
20
+
21
+ template.thumbnail title: 'Nav Buttons', onClick: ->(action) do
22
+ action.windows_open url: json_ui_garage_url(path: 'pages/nav_buttons')
23
+ end
14
24
  end
15
-
16
- template.thumbnail title: 'Tab Bar', onClick: ->(action) do
17
- action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar')
25
+ end,
26
+ ->(section) do
27
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
28
+ header.h2 text: 'Templates (Web Only)'
18
29
  end
19
30
 
20
- template.thumbnail title: 'Nav Buttons', onClick: ->(action) do
21
- action.windows_open url: json_ui_garage_url(path: 'pages/nav_buttons')
31
+ section.rows builder: ->(template) do
32
+ template.thumbnail title: 'Flat Centered', onClick: ->(action) do
33
+ action.windows_open url: json_ui_garage_url(path: 'pages/flat_centered')
34
+ end
35
+
36
+ template.thumbnail title: 'Full Width', onClick: ->(action) do
37
+ action.windows_open url: json_ui_garage_url(path: 'pages/full_width')
38
+ end
22
39
  end
23
40
  end
41
+ ]
24
42
 
25
- end
26
43
  end
@@ -3,15 +3,15 @@ json.title 'Pages'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.header padding: json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
6
+ page.header padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
7
7
  header.h1 text: 'Header'
8
8
  end
9
9
 
10
- page.footer padding: json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
10
+ page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
11
11
  footer.h1 text: 'Footer'
12
12
  end
13
13
 
14
- page.scroll padding: json_padding_body, childViews: ->(scroll) do
14
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
15
15
  (1..100).each do |index|
16
16
  scroll.label text: 'Content'
17
17
  end
@@ -15,7 +15,7 @@ json_ui_page json do |page|
15
15
  end
16
16
  end
17
17
 
18
- page.scroll padding: json_padding_body, childViews: ->(scroll) do
18
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
19
19
  scroll.label text: 'See the right menu buttons on the nav bar'
20
20
  end
21
21
  end
@@ -14,7 +14,7 @@ json_ui_page json do |page|
14
14
  end
15
15
  end
16
16
 
17
- page.scroll padding: json_padding_body, childViews: ->(scroll) do
17
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
18
18
  scroll.label text: "Tab index #{params[:tab].to_i} selected"
19
19
 
20
20
  scroll.spacer height: 10
@@ -3,24 +3,93 @@ 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 backgroundColor: '#fafafa', padding: json_padding_body_this, childViews: ->(scroll) do
7
- scroll.panels_card width: 'matchParent', padding: json_padding_body, childViews: ->(card) do
8
- card.h1 text: 'With Default Layout'
9
- card.spacer height: 6
10
- card.button text: 'Button1'
11
- card.button text: 'Button2'
12
- card.button text: 'Button3'
13
- end
6
+ page.scroll backgroundColor: '#fafafa', padding: { top: 10, right: 10, bottom: 10, left: 10 }, childViews: ->(scroll) do
7
+
8
+
9
+ # TODO: Deprecate in favour of styleClasses
10
+ # scroll.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
11
+ # card.h1 text: 'With Default Layout'
12
+ # card.spacer height: 6
13
+ # card.button text: 'Button1'
14
+ # card.button text: 'Button2'
15
+ # card.button text: 'Button3'
16
+ # end
14
17
 
15
- scroll.spacer height: 10
18
+ # scroll.spacer height: 10
16
19
 
17
- scroll.panels_card width: 'matchParent', padding: json_padding_body, childViews: ->(card) do
18
- card.h1 text: 'With Child Panel'
19
- card.spacer height: 6
20
- card.panels_horizontal backgroundColor: '#b3bac2', childViews: ->(panel) do
21
- panel.button text: 'Button1'
22
- panel.button text: 'Button2'
23
- panel.button text: 'Button3'
20
+ # scroll.panels_card width: 'matchParent', padding: glib_json_padding_body, childViews: ->(card) do
21
+ # card.h1 text: 'With Child Panel'
22
+ # card.spacer height: 6
23
+ # card.panels_horizontal backgroundColor: '#b3bac2', childViews: ->(panel) do
24
+ # panel.button text: 'Button1'
25
+ # panel.button text: 'Button2'
26
+ # panel.button text: 'Button3'
27
+ # end
28
+ # end
29
+
30
+ scroll.h2 text: 'Vertical panel'
31
+ scroll.spacer height: 6
32
+ scroll.panels_vertical styleClass: 'card', padding: glib_json_padding_body, width: 'matchParent', childViews: ->(panel) do
33
+ panel.button text: 'Button1'
34
+ panel.button text: 'Button2'
35
+ panel.button text: 'Button3'
36
+ end
37
+
38
+ scroll.spacer height: 20
39
+ scroll.h2 text: 'Horizontal panel'
40
+ scroll.spacer height: 6
41
+ scroll.panels_horizontal styleClass: 'card', padding: glib_json_padding_body, width: 'matchParent', childViews: ->(panel) do
42
+ panel.button text: 'Button1'
43
+ panel.button text: 'Button2'
44
+ panel.button text: 'Button3'
45
+ end
46
+
47
+ scroll.spacer height: 20
48
+ scroll.h2 text: 'Split panel'
49
+ scroll.spacer height: 6
50
+ scroll.panels_split styleClass: 'card', padding: glib_json_padding_body, width: 'matchParent', leftViews: ->(panel) do
51
+ panel.button text: '1'
52
+ end, centerViews: ->(panel) do
53
+ panel.button width: 'matchParent', text: '2'
54
+ end, rightViews: ->(panel) do
55
+ panel.button text: '3'
56
+ end
57
+
58
+ scroll.spacer height: 20
59
+ scroll.h2 text: 'Responsive panel'
60
+ scroll.spacer height: 6
61
+ scroll.panels_responsive styleClass: 'card', padding: glib_json_padding_body, childViews: ->(horizontal) do
62
+ horizontal.panels_column lg: 8, backgroundColor: '#c3cad2', childViews: ->(column) do
63
+ column.button text: '1'
64
+ end
65
+ horizontal.panels_column lg: 4, backgroundColor: '#b3bac2', childViews: ->(column) do
66
+ column.button text: '2'
67
+ end
68
+ end
69
+
70
+ scroll.spacer height: 20
71
+ scroll.h2 text: 'Grid-like layout'
72
+ scroll.spacer height: 6
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
76
+ column.button text: '1'
77
+ end
78
+ 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
81
+ column.button text: '2'
82
+ end
83
+ 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
86
+ column.button text: '3'
87
+ end
88
+ 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
91
+ column.button text: '4'
92
+ end
24
93
  end
25
94
  end
26
95
 
@@ -6,7 +6,7 @@ image_url2 = 'https://s.abcnews.com/images/International/Guam03-gty-jrl-170809_1
6
6
  json_ui_page json do |page|
7
7
  render "#{@path_prefix}/nav_menu", json: json, page: page
8
8
 
9
- page.scroll padding: json_padding_body, childViews: ->(scroll) do
9
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
10
10
  scroll.h1 text: 'Carousel panel'
11
11
  scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
12
12
  carousel.image url: image_url1, width: 'matchParent'
@@ -3,11 +3,11 @@ 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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.h2 text: 'Thumbnail Template'
8
8
  scroll.spacer height: 6
9
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' }
10
+ data: { imageUrl: glib_json_image_standard_url, title: 'Title', subtitle: 'Use the same template from list templates' }
11
11
 
12
12
  scroll.spacer height: 20
13
13
  scroll.h2 text: 'Non-existent Template'
@@ -3,7 +3,7 @@ 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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.h1 text: 'Horizontal panel'
8
8
  scroll.panels_horizontal backgroundColor: '#b3bac2', childViews: ->(panel) do
9
9
  panel.button text: '1'
@@ -5,7 +5,7 @@ json_ui_page json do |page|
5
5
 
6
6
  page.list sections: [
7
7
  ->(section) do
8
- section.header padding: json_padding_list, childViews: ->(header) do
8
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
9
9
  header.h2 text: 'Layout for child components'
10
10
  end
11
11
 
@@ -25,7 +25,7 @@ json_ui_page json do |page|
25
25
 
26
26
  end
27
27
  end, ->(section) do
28
- section.header padding: json_padding_list, childViews: ->(header) do
28
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
29
29
  header.h2 text: 'Layout with sub-panels'
30
30
  header.spacer height: 6
31
31
  header.label text: 'Each sub-panel is a vertical panel'
@@ -41,9 +41,10 @@ json_ui_page json do |page|
41
41
  template.thumbnail title: 'List', subtitle: 'Sub-panels: header, footer', onClick: ->(action) do
42
42
  action.windows_open url: json_ui_garage_url(path: 'lists/index')
43
43
  end
44
+
44
45
  end
45
46
  end, ->(section) do
46
- section.header padding: json_padding_list, childViews: ->(header) do
47
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
47
48
  header.h2 text: 'Layout with uniform rows'
48
49
  end
49
50
 
@@ -57,7 +58,7 @@ json_ui_page json do |page|
57
58
 
58
59
  end
59
60
  end, ->(section) do
60
- section.header padding: json_padding_list, childViews: ->(header) do
61
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
61
62
  header.h2 text: 'Non-layout'
62
63
  header.spacer height: 6
63
64
  header.label text: 'Adds functionality to a vertical layout'
@@ -70,16 +71,13 @@ json_ui_page json do |page|
70
71
  template.thumbnail title: 'Form', subtitle: 'Adds form functionality', onClick: ->(action) do
71
72
  action.windows_open url: json_ui_garage_url(path: 'forms/index')
72
73
  end
73
- template.thumbnail title: 'Card', subtitle: 'Adds card-like bevel', onClick: ->(action) do
74
- action.windows_open url: json_ui_garage_url(path: 'panels/card')
75
- end
76
74
  template.thumbnail title: 'Column', subtitle: 'Adds control over layout inside a responsive panel', onClick: ->(action) do
77
75
  action.windows_open url: json_ui_garage_url(path: 'panels/responsive')
78
76
  end
79
77
 
80
78
  end
81
79
  end, ->(section) do
82
- section.header padding: json_padding_list, childViews: ->(header) do
80
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
83
81
  header.h2 text: 'Child-less Layout'
84
82
  end
85
83
 
@@ -88,6 +86,17 @@ json_ui_page json do |page|
88
86
  action.windows_open url: json_ui_garage_url(path: 'panels/custom')
89
87
  end
90
88
 
89
+ end
90
+ end, ->(section) do
91
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
92
+ header.h2 text: 'Styling'
93
+ end
94
+
95
+ section.rows builder: ->(template) do
96
+ template.thumbnail title: 'Card', onClick: ->(action) do
97
+ action.windows_open url: json_ui_garage_url(path: 'panels/card')
98
+ end
99
+
91
100
  end
92
101
  end,
93
102
  ]
@@ -3,7 +3,7 @@ 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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.label text: 'Shrink the browser\'s width to see how the column panels are rearranged. On mobile screens, they are always arranged vertically'
8
8
 
9
9
  scroll.spacer height: 20
@@ -3,7 +3,7 @@ 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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
 
8
8
  # TODO: Consider moving towards this
9
9
  # scroll.panels_split width: 'matchParent', builder: ->(builder) do
@@ -3,7 +3,7 @@ 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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.h1 text: 'Vertical panel'
8
8
  scroll.panels_vertical backgroundColor: '#b3bac2', childViews: ->(panel) do
9
9
  panel.button text: 'Button1'
@@ -3,10 +3,10 @@ json.title 'Views'
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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.h2 text: 'Avatar'
8
8
  scroll.spacer height: 6
9
- scroll.avatar url: json_image_avatar_url
9
+ scroll.avatar url: glib_json_image_avatar_url
10
10
 
11
11
  scroll.spacer height: 20
12
12
  scroll.h2 text: 'Icon'
@@ -16,7 +16,7 @@ json_ui_page json do |page|
16
16
  scroll.spacer height: 20
17
17
  scroll.h2 text: 'Image with URL'
18
18
  scroll.spacer height: 6
19
- scroll.image width: 100, url: json_image_standard_url
19
+ scroll.image width: 100, url: glib_json_image_standard_url
20
20
 
21
21
  scroll.spacer height: 20
22
22
  scroll.h2 text: 'Image with base64 data'
@@ -3,7 +3,7 @@ json.title 'Views'
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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
 
8
8
  scroll.h2 text: 'Standard button'
9
9
  scroll.spacer height: 6
@@ -43,7 +43,7 @@ json_ui_page json do |page|
43
43
  scroll.h2 text: 'Avatar with onClick'
44
44
  # TODO: Make sure "open in new tab" works
45
45
  scroll.spacer height: 10
46
- scroll.avatar url: json_image_avatar_url, styleClass: 'link', onClick: ->(action) do
46
+ scroll.avatar url: glib_json_image_avatar_url, styleClass: 'link', onClick: ->(action) do
47
47
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
48
48
  end
49
49
 
@@ -51,7 +51,7 @@ json_ui_page json do |page|
51
51
  scroll.h2 text: 'Image with onClick'
52
52
  # TODO: Make sure "open in new tab" works
53
53
  scroll.spacer height: 10
54
- scroll.image width: 100, url: json_image_standard_url, styleClass: 'link', onClick: ->(action) do
54
+ scroll.image width: 100, url: glib_json_image_standard_url, styleClass: 'link', onClick: ->(action) do
55
55
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
56
56
  end
57
57
 
@@ -3,7 +3,7 @@ json.title 'Views'
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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.spacer height: 20
8
8
  scroll.h2 text: 'Map'
9
9
  scroll.spacer height: 6
@@ -3,7 +3,7 @@ json.title 'Views'
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: json_padding_body, childViews: ->(scroll) do
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.h1 text: 'Heading 1'
8
8
 
9
9
  scroll.spacer height: 10
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.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -76,6 +76,8 @@ files:
76
76
  - app/views/json_ui/garage/lists/index.json.jbuilder
77
77
  - app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder
78
78
  - app/views/json_ui/garage/lists/templating.json.jbuilder
79
+ - app/views/json_ui/garage/pages/flat_centered.json.jbuilder
80
+ - app/views/json_ui/garage/pages/full_width.json.jbuilder
79
81
  - app/views/json_ui/garage/pages/full_width_height.json.jbuilder
80
82
  - app/views/json_ui/garage/pages/index.json.jbuilder
81
83
  - app/views/json_ui/garage/pages/layout.json.jbuilder