glib-web 0.15.3 → 0.16.0
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/view_builder/fields.rb +1 -1
- data/app/views/json_ui/garage/forms/_conditional_banner.json.jbuilder +11 -4
- data/app/views/json_ui/garage/forms/{_more_less_text.json.jbuilder → _read_more_text.json.jbuilder} +13 -6
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +33 -35
- data/app/views/json_ui/garage/forms/submit_on_change.json.jbuilder +2 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35210713e1cd16fb62b922a7b78f6c045a49d3eaa14e4a4adeb9630771c38059
|
4
|
+
data.tar.gz: a923627989ea43af99a03ad68ffb7f7784837eb4a4b3053304122eca5a8d1eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d57258dec4e72d2301cb8489139900a2e03e5177c073537db94cffa8dd9ef7dd69fba94434ee469f1762ade2845772eabdb2e89f1aa4cf8c9230c6cdb46087fe
|
7
|
+
data.tar.gz: d4e9622c9c1ad29f65b8b3d7505633845ffb003e910b498c4676c2ddf6cb9c14c9ebd8057325b0b031c2c7c0897e6ffea0c1ee8442fc0209ba2c671539dd891e
|
@@ -1,6 +1,11 @@
|
|
1
|
-
|
1
|
+
# display_key = local_assigns[:display_key] || :has_content
|
2
|
+
display_key = :has_content
|
3
|
+
@__banner_index ||= 0
|
4
|
+
toggle_name = "__banner_#{@__banner_index}"
|
5
|
+
|
6
|
+
panel.form_if_not_exists width: 'matchParent', childViews: ->(visibility) do
|
2
7
|
state = {
|
3
|
-
|
8
|
+
display_key => false
|
4
9
|
}
|
5
10
|
style_classes ||= nil
|
6
11
|
style_class ||= nil
|
@@ -19,10 +24,12 @@ panel.panels_form width: 'matchParent', childViews: ->(visibility) do
|
|
19
24
|
showIf: {
|
20
25
|
"==": [
|
21
26
|
{
|
22
|
-
"var":
|
27
|
+
"var": toggle_name
|
23
28
|
},
|
24
29
|
'show'
|
25
30
|
]
|
26
31
|
}
|
27
|
-
visibility.fields_hidden name:
|
32
|
+
visibility.fields_hidden name: toggle_name, value: state[display_key] ? 'show' : 'hide'
|
28
33
|
end
|
34
|
+
|
35
|
+
@__banner_index += 1
|
data/app/views/json_ui/garage/forms/{_more_less_text.json.jbuilder → _read_more_text.json.jbuilder}
RENAMED
@@ -1,14 +1,17 @@
|
|
1
1
|
if text.length > min_chars
|
2
|
+
@__read_more_index ||= 0
|
3
|
+
|
2
4
|
panel.form_if_not_exists childViews: ->(form) do
|
5
|
+
toggle_name = "__expand_#{@__read_more_index}"
|
3
6
|
form.markdown \
|
4
7
|
text: text.truncate(min_chars),
|
5
8
|
styleClasses: ['line-clamp', "line-clamp-#{max_lines}"],
|
6
9
|
showIf: {
|
7
10
|
"!=": [
|
8
11
|
{
|
9
|
-
"var":
|
12
|
+
"var": toggle_name
|
10
13
|
},
|
11
|
-
'
|
14
|
+
'true'
|
12
15
|
]
|
13
16
|
}
|
14
17
|
form.markdown \
|
@@ -16,21 +19,25 @@ if text.length > min_chars
|
|
16
19
|
showIf: {
|
17
20
|
"==": [
|
18
21
|
{
|
19
|
-
"var":
|
22
|
+
"var": toggle_name
|
20
23
|
},
|
21
|
-
'
|
24
|
+
'true'
|
22
25
|
]
|
23
26
|
}
|
27
|
+
|
28
|
+
# NOTE: Don't put a valueIf here in an attempt to implement accordions. It won't work due to circular updates, presumably between valueIf and the on/off icons and labels.
|
24
29
|
form.fields_check \
|
25
30
|
width: 'matchParent',
|
26
31
|
offIcon: 'expand_more',
|
27
32
|
onIcon: 'expand_less',
|
28
33
|
label: 'Read more',
|
29
34
|
onLabel: 'Read less',
|
30
|
-
checkValue: '
|
35
|
+
checkValue: 'true',
|
31
36
|
uncheckValue: nil,
|
32
|
-
name:
|
37
|
+
name: toggle_name,
|
33
38
|
disableDirtyCheck: true
|
39
|
+
|
40
|
+
@__read_more_index += 1
|
34
41
|
end
|
35
42
|
else
|
36
43
|
panel.markdown text: text
|
@@ -4,7 +4,6 @@ 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
|
8
7
|
form.h1 text: 'Text'
|
9
8
|
form.fields_password name: 'user[text1]', width: 'matchParent', label: 'Type "show"', value: ''
|
10
9
|
form.label text: 'Typed', showIf: {
|
@@ -136,7 +135,6 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
136
135
|
|
137
136
|
form.spacer height: 20
|
138
137
|
form.h1 text: 'Show/hide another field'
|
139
|
-
form.label text: ''
|
140
138
|
form.spacer height: 10
|
141
139
|
form.fields_check name: 'user[check3]', checkValue: 'on', label: 'Show field'
|
142
140
|
form.spacer height: 10
|
@@ -151,45 +149,45 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
151
149
|
|
152
150
|
form.spacer height: 20
|
153
151
|
form.h1 text: 'Show more/less text'
|
154
|
-
form.
|
155
|
-
render "#{@path_prefix}/forms/
|
152
|
+
form.spacer height: 10
|
153
|
+
render "#{@path_prefix}/forms/read_more_text",
|
154
|
+
panel: form,
|
155
|
+
min_chars: 300,
|
156
|
+
max_lines: 2,
|
157
|
+
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."
|
158
|
+
|
159
|
+
form.spacer height: 10
|
160
|
+
render "#{@path_prefix}/forms/read_more_text",
|
156
161
|
panel: form,
|
157
162
|
min_chars: 300,
|
158
163
|
max_lines: 2,
|
159
164
|
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
165
|
|
161
166
|
form.spacer height: 20
|
162
|
-
form.
|
163
|
-
form.spacer height:
|
164
|
-
|
167
|
+
form.h1 text: 'Show/hide conditional banner'
|
168
|
+
form.spacer height: 10
|
169
|
+
form.label text: 'The following banner does not appear because its menu is empty'
|
170
|
+
form.spacer height: 8
|
165
171
|
|
166
|
-
# panel
|
167
|
-
#
|
168
|
-
#
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
#
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
# yield(menu, state)
|
183
|
-
# end,
|
184
|
-
# showIf: {
|
185
|
-
# "==": [
|
186
|
-
# {
|
187
|
-
# "var": 'banner'
|
188
|
-
# },
|
189
|
-
# 'show'
|
190
|
-
# ]
|
191
|
-
# }
|
192
|
-
# visibility.fields_hidden name: 'banner', value: state[:has_content] ? 'show' : 'hide'
|
193
|
-
# end
|
172
|
+
render "#{@path_prefix}/forms/conditional_banner", panel: form, message: 'Admin menu 1' do |menu, state|
|
173
|
+
# This banner will not show because it does not have any content
|
174
|
+
# state[:has_content] = false
|
175
|
+
end
|
176
|
+
|
177
|
+
form.spacer height: 10
|
178
|
+
form.label text: 'The following banner appears because it has at least one menu item'
|
179
|
+
form.spacer height: 8
|
180
|
+
|
181
|
+
render "#{@path_prefix}/forms/conditional_banner", panel: form, message: 'Admin menu 2' do |menu, state|
|
182
|
+
state[:has_content] = true
|
183
|
+
|
184
|
+
menu.button styleClass: 'link', text: 'Add', onClick: ->(action) do
|
185
|
+
action.dialogs_alert message: 'Do something'
|
186
|
+
end
|
187
|
+
end
|
194
188
|
|
189
|
+
form.spacer height: 20
|
190
|
+
form.fields_submit text: 'Submit'
|
195
191
|
|
192
|
+
form.spacer height: 40
|
193
|
+
end
|
@@ -79,18 +79,12 @@ page.scroll childViews: ->(scroll) do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
form.spacer height: 20
|
82
|
-
form.h2 text: 'Text (Asynchronous)
|
82
|
+
form.h2 text: 'Text (Asynchronous)'
|
83
83
|
form.fields_text \
|
84
84
|
name: 'user[video_url]',
|
85
85
|
width: 'matchParent',
|
86
86
|
onChange: ->(action) do
|
87
|
-
action.
|
88
|
-
menu.http_post # TODO
|
89
|
-
|
90
|
-
# menu.button text: 'Yes, submit', onClick: ->(subaction) do
|
91
|
-
# action.forms_submit
|
92
|
-
# end
|
93
|
-
end
|
87
|
+
action.http_post url: json_ui_garage_url(path: 'forms/generic_post')
|
94
88
|
end
|
95
89
|
end
|
96
90
|
|
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.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -144,7 +144,7 @@ files:
|
|
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
146
|
- app/views/json_ui/garage/forms/_conditional_banner.json.jbuilder
|
147
|
-
- app/views/json_ui/garage/forms/
|
147
|
+
- app/views/json_ui/garage/forms/_read_more_text.json.jbuilder
|
148
148
|
- app/views/json_ui/garage/forms/basic.json.jbuilder
|
149
149
|
- app/views/json_ui/garage/forms/basic_post.json.jbuilder
|
150
150
|
- app/views/json_ui/garage/forms/checkboxes.json.jbuilder
|