glib-web 0.15.2 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71cb6d54bc1fbb2c25ccbeffe5c3973a9c6623a796a0bdf34ce76d6f83598ea6
4
- data.tar.gz: 78d7afacf9d015032060e8da2d77bb3ae88d31676ac22a5bb39776007e70cb2e
3
+ metadata.gz: 99bf3258f6448750d3db9022e35d80e45f67e8b7e60ce5aecccabc7d19906c58
4
+ data.tar.gz: 0c51b914c22854ec4632dcc755a0fe55789f9a8ad4d40a4db722ecdd07e2e619
5
5
  SHA512:
6
- metadata.gz: b550f286f9f170a4a4bff70aca2d0f42a4f5327941d9228a47c172a832106af08d1bc525d6756b2902277e112c3b7ca5f146e6472cf4b27f642ba94f5e777e80
7
- data.tar.gz: 14ffeb553fff62702924f8a558245f2cb9703f39d2873d9ad9a2e3b1831ab35edd75f6961d95b9d80fd090e5cb641e52843d4b2e4a15e07891cc3e958ca65e24
6
+ metadata.gz: a310b5e78a79a69e85b91f56a0f7ed91caf37db79ff655607d890dad1b449613ec885394a418f01db3d535e209bff140de5ff103711b4e4a3bd0806f27701d7c
7
+ data.tar.gz: da97a6021872ad5b623ef57d1969e82d3d692fb62cf965cf0bd460174f36a89fa10e974d11ed7dc2888894d5dd432b27845c3986efdb5a796ed88297cb970b95
@@ -224,7 +224,6 @@ module Glib
224
224
  end
225
225
  end
226
226
  end
227
-
228
227
  end
229
228
  end
230
229
  end
@@ -99,6 +99,10 @@ class Glib::JsonUi::ViewBuilder
99
99
  end
100
100
  end
101
101
 
102
+ if page.current_form
103
+ raise 'Nested form is not allowed'
104
+ end
105
+
102
106
  # NOTE: this pattern will not work for views that can be nested. Luckily forms shouldn't be nested anyway.
103
107
  page.current_form = self
104
108
  @childViewsBlock.call(page.view_builder)
@@ -23,6 +23,14 @@ module Glib
23
23
  add_view m, *args
24
24
  end
25
25
 
26
+ def form_if_not_exists(*args)
27
+ if page.current_form
28
+ panels_responsive *args
29
+ else
30
+ panels_form *args
31
+ end
32
+ end
33
+
26
34
  class View < JsonUiElement
27
35
  string :id
28
36
  length :width
@@ -0,0 +1,28 @@
1
+ panel.panels_form width: 'matchParent', childViews: ->(visibility) do
2
+ state = {
3
+ has_content: false
4
+ }
5
+ style_classes ||= nil
6
+ style_class ||= nil
7
+ padding ||= nil
8
+ id ||= nil
9
+
10
+ visibility.banners_select \
11
+ id: id,
12
+ width: 'matchParent',
13
+ styleClass: style_class || (style_classes ? nil : 'warning'),
14
+ message: message,
15
+ padding: padding,
16
+ buttons: ->(menu) do
17
+ yield(menu, state)
18
+ end,
19
+ showIf: {
20
+ "==": [
21
+ {
22
+ "var": 'banner'
23
+ },
24
+ 'show'
25
+ ]
26
+ }
27
+ visibility.fields_hidden name: 'banner', value: state[:has_content] ? 'show' : 'hide'
28
+ end
@@ -0,0 +1,37 @@
1
+ if text.length > min_chars
2
+ panel.form_if_not_exists childViews: ->(form) do
3
+ form.markdown \
4
+ text: text.truncate(min_chars),
5
+ styleClasses: ['line-clamp', "line-clamp-#{max_lines}"],
6
+ showIf: {
7
+ "!=": [
8
+ {
9
+ "var": 'expand'
10
+ },
11
+ 'expand'
12
+ ]
13
+ }
14
+ form.markdown \
15
+ text: text,
16
+ showIf: {
17
+ "==": [
18
+ {
19
+ "var": 'expand'
20
+ },
21
+ 'expand'
22
+ ]
23
+ }
24
+ form.fields_check \
25
+ width: 'matchParent',
26
+ offIcon: 'expand_more',
27
+ onIcon: 'expand_less',
28
+ label: 'Read more',
29
+ onLabel: 'Read less',
30
+ checkValue: 'expand',
31
+ uncheckValue: nil,
32
+ name: 'expand',
33
+ disableDirtyCheck: true
34
+ end
35
+ else
36
+ panel.markdown text: text
37
+ end
@@ -4,18 +4,9 @@ page = json_ui_page json
4
4
 
5
5
  render "#{@path_prefix}/nav_menu", json: json, page: page
6
6
 
7
- page.form url: json_ui_garage_url(path: 'forms/basic_post?id=dialog'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
+ page.form url: json_ui_garage_url(path: 'forms/basic_post', id: :dialog), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
8
8
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
9
9
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
10
- end
11
-
12
- page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
13
- footer.label text: 'This button will submit the form above because this whole page is wrapped in a giant form.'
14
- footer.spacer height: 6
15
-
16
- footer.panels_split width: 'matchParent', content: ->(content) do
17
- content.right childViews: ->(right) do
18
- right.fields_submit text: 'Submit'
19
- end
20
- end
10
+ form.spacer height: 14
11
+ form.fields_submit text: 'Submit'
21
12
  end
@@ -4,6 +4,7 @@ page = json_ui_page json
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: glib_json_padding_body, childViews: ->(form) do
7
+ # page.scroll childViews: ->(form) do
7
8
  form.h1 text: 'Text'
8
9
  form.fields_password name: 'user[text1]', width: 'matchParent', label: 'Type "show"', value: ''
9
10
  form.label text: 'Typed', showIf: {
@@ -148,49 +149,20 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
148
149
  ]
149
150
  }
150
151
 
152
+ form.spacer height: 20
153
+ form.h1 text: 'Show more/less text'
154
+ form.label text: ''
155
+ render "#{@path_prefix}/forms/read_more_text",
156
+ panel: form,
157
+ min_chars: 300,
158
+ max_lines: 2,
159
+ text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
160
+
151
161
  form.spacer height: 20
152
162
  form.fields_submit text: 'Submit'
153
163
  form.spacer height: 40
154
164
  end
155
165
 
156
- # if text.length > 100
157
- # inner_column.panels_form local: true, childViews: ->(form) do
158
- # form.markdown \
159
- # text: text,
160
- # styleClasses: ['many-line'],
161
- # showIf: {
162
- # "!=": [
163
- # {
164
- # "var": 'expand[bundle_description]'
165
- # },
166
- # 'expand'
167
- # ]
168
- # }
169
- # form.markdown \
170
- # text: text,
171
- # showIf: {
172
- # "==": [
173
- # {
174
- # "var": 'expand[bundle_description]'
175
- # },
176
- # 'expand'
177
- # ]
178
- # }
179
- # form.fields_check \
180
- # width: 'matchParent',
181
- # offIcon: 'expand_more',
182
- # onIcon: 'expand_less',
183
- # label: 'Read more',
184
- # onLabel: 'Read less',
185
- # checkValue: 'expand',
186
- # uncheckValue: nil,
187
- # name: 'expand[bundle_description]',
188
- # disableDirtyCheck: true
189
- # end
190
- # else
191
- # inner_column.markdown text: text
192
- # end
193
-
194
166
  # panel.panels_form width: 'matchParent', childViews: ->(visibility) do
195
167
  # state = {
196
168
  # has_content: false
@@ -77,6 +77,15 @@ page.scroll childViews: ->(scroll) do
77
77
  end
78
78
  end
79
79
  end
80
+
81
+ form.spacer height: 20
82
+ form.h2 text: 'Text (Asynchronous) -- TODO'
83
+ form.fields_text \
84
+ name: 'user[video_url]',
85
+ width: 'matchParent',
86
+ onChange: ->(action) do
87
+ action.http_post # TODO
88
+ end
80
89
  end
81
90
 
82
91
  end
@@ -4,7 +4,7 @@ page = json_ui_page json
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  column_indexes = (1..5)
7
- page.table sections: [
7
+ page.table styleClass: 'table--grid', sections: [
8
8
  ->(section) do
9
9
  section.rows builder: ->(row) do
10
10
  row.default colSpans: [3, 2], cellViews: ->(cell) do
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.15.2
4
+ version: 0.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -143,6 +143,8 @@ files:
143
143
  - app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder
144
144
  - app/views/json_ui/garage/actions/index.json.jbuilder
145
145
  - app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder
146
+ - app/views/json_ui/garage/forms/_conditional_banner.json.jbuilder
147
+ - app/views/json_ui/garage/forms/_read_more_text.json.jbuilder
146
148
  - app/views/json_ui/garage/forms/basic.json.jbuilder
147
149
  - app/views/json_ui/garage/forms/basic_post.json.jbuilder
148
150
  - app/views/json_ui/garage/forms/checkboxes.json.jbuilder