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 +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/_read_more_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 +9 -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: 99bf3258f6448750d3db9022e35d80e45f67e8b7e60ce5aecccabc7d19906c58
|
4
|
+
data.tar.gz: 0c51b914c22854ec4632dcc755a0fe55789f9a8ad4d40a4db722ecdd07e2e619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a310b5e78a79a69e85b91f56a0f7ed91caf37db79ff655607d890dad1b449613ec885394a418f01db3d535e209bff140de5ff103711b4e4a3bd0806f27701d7c
|
7
|
+
data.tar.gz: da97a6021872ad5b623ef57d1969e82d3d692fb62cf965cf0bd460174f36a89fa10e974d11ed7dc2888894d5dd432b27845c3986efdb5a796ed88297cb970b95
|
@@ -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/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.
|
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
|