glib-web 0.15.2 → 0.15.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/glib/json_ui/page_helper.rb +0 -1
- data/app/helpers/glib/json_ui/view_builder/panels.rb +4 -0
- data/app/helpers/glib/json_ui/view_builder.rb +8 -0
- data/app/views/json_ui/garage/forms/_conditional_banner.json.jbuilder +28 -0
- data/app/views/json_ui/garage/forms/_more_less_text.json.jbuilder +37 -0
- data/app/views/json_ui/garage/forms/full_page_form_dialog.json.jbuilder +3 -12
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +10 -38
- data/app/views/json_ui/garage/forms/submit_on_change.json.jbuilder +15 -0
- data/app/views/json_ui/garage/tables/layout.json.jbuilder +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c8f181923acfe45b4f5fc8db68d538d457518dec51a7f88591e9dd7f45b5fa2
|
4
|
+
data.tar.gz: 619177b9d7e1153eb15230797ba241c1c54c795b979aba1747a195d2310b7295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79b252be8c126c21548f4c4f100800156240026a96756ebbe5d97ff64684150392f3a76f2afaa1fffae0dce5c139026847ae12a836774a9aeeea1612b7b5ba5c
|
7
|
+
data.tar.gz: 82712cc9297d5ac4e76f79fe6f21cf42183b901dbbee57a01387c8cfb3e20311829078c600f069710f49db56d7c3c0e804bba25e8bb7a849e59d493cda144922
|
@@ -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)
|
@@ -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
|
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
|
-
|
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/more_less_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,21 @@ 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.sheets_select message: 'Submit data?', buttons: ->(menu) do
|
88
|
+
menu.http_post # TODO
|
89
|
+
|
90
|
+
# menu.button text: 'Yes, submit', onClick: ->(subaction) do
|
91
|
+
# action.forms_submit
|
92
|
+
# end
|
93
|
+
end
|
94
|
+
end
|
80
95
|
end
|
81
96
|
|
82
97
|
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.
|
4
|
+
version: 0.15.3
|
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/_more_less_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
|