glib-web 3.28.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/json/libs.rb +4 -4
- data/app/helpers/glib/json_ui/abstract_builder.rb +0 -8
- data/app/helpers/glib/json_ui/action_builder/components.rb +0 -5
- data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -23
- data/app/helpers/glib/json_ui/action_builder/logics.rb +11 -0
- data/app/helpers/glib/json_ui/action_builder/popovers.rb +0 -9
- data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -5
- data/app/helpers/glib/json_ui/action_builder.rb +0 -24
- data/app/helpers/glib/json_ui/builder/mouse_events.rb +0 -7
- data/app/helpers/glib/json_ui/default.rb +4 -4
- data/app/helpers/glib/json_ui/list_builders.rb +0 -3
- data/app/helpers/glib/json_ui/page_helper.rb +7 -1
- data/app/helpers/glib/json_ui/view_builder/fields.rb +7 -38
- data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder.rb +3 -14
- data/app/policies/glib/application_policy.rb +0 -6
- data/app/views/json_ui/garage/actions/_components.json.jbuilder +2 -6
- data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +0 -14
- data/app/views/json_ui/garage/actions/_reload.json.jbuilder +1 -1
- data/app/views/json_ui/garage/actions/partial_update.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +1 -3
- data/app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_read_more_text.json.jbuilder +27 -20
- data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +49 -68
- data/app/views/json_ui/garage/forms/dirty_prompt.json.jbuilder +0 -28
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +1 -3
- data/app/views/json_ui/garage/forms/otp_field.json.jbuilder +11 -9
- data/app/views/json_ui/garage/forms/rich_text_preview.json.jbuilder +0 -1
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +17 -24
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +317 -271
- data/app/views/json_ui/garage/forms/timers.json.jbuilder +0 -90
- data/app/views/json_ui/garage/notifications/action_cable.json.jbuilder +3 -3
- data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +4 -0
- data/app/views/json_ui/garage/views/{components_update.json.jbuilder → components_replace.json.jbuilder} +6 -6
- data/app/views/json_ui/garage/views/controls.json.jbuilder +0 -32
- data/lib/glib/test_helpers.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 075c1d55a3db9efb8b8fd9302c410203f54f3feaf13e9debb3273fab7facf009
|
4
|
+
data.tar.gz: c9f19882259bb4e898578994734ece1c472a63b0dfffd7b41cb9fa8a3f89d1bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c07ee59726cdf85c3cedf5970097fff38916c1e56d062332f61d7fd2692ebf316d9eacb32c9d6e4a65bedec4af28f66ceddf86fe95c84d0fba87ec215250ca6
|
7
|
+
data.tar.gz: 70d5e728d9730c9b0f2d63d9d34bea15654d8d8048eba682f114ec29c937020c1e058d205d523837a63ea54fa3ef878de498cd310cf1d96e52b435d7ded18109
|
@@ -74,7 +74,7 @@ module Glib::Json::Libs
|
|
74
74
|
url.sub(/[\&\?]format=json/, '');
|
75
75
|
end
|
76
76
|
|
77
|
-
def glib_redirect_to(url, return_to_previous: false)
|
77
|
+
def glib_redirect_to(url, return_to_previous: false, status: :ok)
|
78
78
|
url = __delete_redirect_back_url(url) if return_to_previous
|
79
79
|
|
80
80
|
respond_to do |format|
|
@@ -87,7 +87,7 @@ module Glib::Json::Libs
|
|
87
87
|
return
|
88
88
|
end
|
89
89
|
|
90
|
-
json_ui_redirect_to url
|
90
|
+
json_ui_redirect_to url, status: status
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -235,7 +235,7 @@ module Glib::Json::Libs
|
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
|
-
def json_ui_redirect_to(url)
|
238
|
+
def json_ui_redirect_to(url, status: :ok)
|
239
239
|
# Use windows_reload instead of windows_open so clicking back will skip the bridging page.
|
240
240
|
# on_response = { action: 'windows/open', url: url }
|
241
241
|
on_response = { action: 'windows/reload', url: url }
|
@@ -248,7 +248,7 @@ module Glib::Json::Libs
|
|
248
248
|
|
249
249
|
# Use onResponse because it is harder to guarantee that `onLoad` executes in Vuejs because it relies
|
250
250
|
# on app.vue's reactivity.
|
251
|
-
render json: { onResponse: on_response }
|
251
|
+
render json: { onResponse: on_response }, status: status
|
252
252
|
end
|
253
253
|
|
254
254
|
module ClassMethods
|
@@ -202,14 +202,6 @@ module Glib
|
|
202
202
|
else
|
203
203
|
data = {}
|
204
204
|
name = value
|
205
|
-
# data = { material: { name: value } }
|
206
|
-
|
207
|
-
# name = value
|
208
|
-
|
209
|
-
# TODO: deprecated
|
210
|
-
# json.set!(propName) do
|
211
|
-
# json.name name
|
212
|
-
# end
|
213
205
|
end
|
214
206
|
|
215
207
|
json.set!(propName) do
|
@@ -7,26 +7,9 @@ class Glib::JsonUi::ActionBuilder
|
|
7
7
|
action :onClose
|
8
8
|
end
|
9
9
|
|
10
|
-
# class Show < Action
|
11
|
-
# string :body
|
12
|
-
# action :onLoad
|
13
|
-
# action :onClose
|
14
|
-
# end
|
15
|
-
|
16
|
-
# Deprecated in favour of `sheets/select`
|
17
|
-
class Options < Action
|
18
|
-
string :message
|
19
|
-
|
20
|
-
def buttons(block)
|
21
|
-
json.buttons do
|
22
|
-
block.call page.menu_builder
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
10
|
|
27
11
|
class Show < Action
|
28
12
|
panels_builder :content, :body
|
29
|
-
bool :showClose # deprecated
|
30
13
|
bool :disableCloseButton
|
31
14
|
string :fullscreen # mobile, always
|
32
15
|
length :width
|
@@ -45,7 +28,6 @@ class Glib::JsonUi::ActionBuilder
|
|
45
28
|
|
46
29
|
class Open < Action
|
47
30
|
string :url, cache: true
|
48
|
-
bool :showClose # deprecated
|
49
31
|
bool :disableCloseButton
|
50
32
|
string :fullscreen
|
51
33
|
length :width
|
@@ -54,13 +36,8 @@ class Glib::JsonUi::ActionBuilder
|
|
54
36
|
bool :updateExisting
|
55
37
|
end
|
56
38
|
|
57
|
-
# Deprecation canceled. This is still useful for a scenario where the previous dialog
|
58
|
-
# was unknown, so we simply want to reload its content.
|
59
39
|
class Reload < Action
|
60
|
-
# Deprecated. Should just use dialogs_show or dialogs_open if
|
61
|
-
# these attributes are needed.
|
62
40
|
string :url, cache: true
|
63
|
-
bool :showClose # deprecated
|
64
41
|
bool :disableCloseButton
|
65
42
|
string :fullscreen # mobile, always
|
66
43
|
length :width
|
@@ -1,14 +1,5 @@
|
|
1
1
|
class Glib::JsonUi::ActionBuilder
|
2
2
|
module Popovers
|
3
|
-
# Deprecated. Use popovers_show instead.
|
4
|
-
class Open < Action
|
5
|
-
string :key
|
6
|
-
views :childViews
|
7
|
-
string :placement
|
8
|
-
int :offset
|
9
|
-
int :width
|
10
|
-
singleton_array :styleClass, :styleClasses
|
11
|
-
end
|
12
3
|
|
13
4
|
class Show < Action
|
14
5
|
panels_builder :content, :body
|
@@ -20,6 +20,7 @@ class Glib::JsonUi::ActionBuilder
|
|
20
20
|
|
21
21
|
class Reload < Action
|
22
22
|
string :url, cache: true
|
23
|
+
bool :disableDirtyCheck
|
23
24
|
action :onReload
|
24
25
|
end
|
25
26
|
|
@@ -42,11 +43,6 @@ class Glib::JsonUi::ActionBuilder
|
|
42
43
|
action :onOpen
|
43
44
|
end
|
44
45
|
|
45
|
-
# Any component can listen to the refresh_state event and react appropriately.
|
46
|
-
# E.g. Stripe credit card component can refresh its token to make sure it is not stale.
|
47
|
-
class RefreshState < Action
|
48
|
-
end
|
49
|
-
|
50
46
|
class Print < Action
|
51
47
|
end
|
52
48
|
end
|
@@ -110,30 +110,6 @@ module Glib
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
module Logics
|
114
|
-
# Future: Replace showIf and loadIf
|
115
|
-
# Example:
|
116
|
-
# `submitWhenNotDisplayed` is false by default
|
117
|
-
# fields_text id: 'my_text', displayed: false, submitWhenNotDisplayed: true
|
118
|
-
#
|
119
|
-
# logics_if condition: { '==', BLAH1, BLAH2 }, true: ->(action) do
|
120
|
-
# action.components_set targetId: 'my_text', displayed: true
|
121
|
-
# end
|
122
|
-
#
|
123
|
-
# class If < Action
|
124
|
-
# hash :condition
|
125
|
-
# action :true
|
126
|
-
# action :false
|
127
|
-
# end
|
128
|
-
|
129
|
-
class Set < Action
|
130
|
-
string :targetId
|
131
|
-
hash :conditionalData
|
132
|
-
hash :variables
|
133
|
-
action :onSet
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
113
|
module Timeouts
|
138
114
|
class Set < Action
|
139
115
|
string :timerId
|
@@ -17,13 +17,6 @@ module Glib
|
|
17
17
|
key = 'tooltip_test'
|
18
18
|
end
|
19
19
|
onMouseEnter ->(action) do
|
20
|
-
# action.popovers_open(
|
21
|
-
# key: key,
|
22
|
-
# placement: options[:placement] || 'top',
|
23
|
-
# childViews: ->(view) {
|
24
|
-
# view.p styleClass: 'tooltip', text: options[:text]
|
25
|
-
# }
|
26
|
-
# )
|
27
20
|
|
28
21
|
action.popovers_show(
|
29
22
|
key: key,
|
@@ -3,12 +3,12 @@ module Glib
|
|
3
3
|
module Default
|
4
4
|
def default_accepts(value)
|
5
5
|
default_max_size_error = {
|
6
|
-
body: I18n.t('
|
7
|
-
button: I18n.t('
|
6
|
+
body: I18n.t('glib.accepts.max_file_size_error.body', default: nil) || 'Files exceed the maximum size',
|
7
|
+
button: I18n.t('glib.accepts.max_file_size_error.button', default: nil) || 'Dismiss'
|
8
8
|
}
|
9
9
|
default_max_length_error = {
|
10
|
-
body: I18n.t('
|
11
|
-
button: I18n.t('
|
10
|
+
body: I18n.t('glib.accepts.max_file_length_error.body', default: nil) || 'Files exceed the maximum limit per upload',
|
11
|
+
button: I18n.t('glib.accepts.max_file_length_error.button', default: nil) || 'Dismiss'
|
12
12
|
}
|
13
13
|
|
14
14
|
{
|
@@ -237,7 +237,7 @@ module Glib
|
|
237
237
|
def form(options = {})
|
238
238
|
form = Glib::JsonUi::ViewBuilder::Panels::Form.new(json, self)
|
239
239
|
form.childViews(->(view_builder) { })
|
240
|
-
panel_options = options.slice!(:url, :method, :local, :onSubmit, :paramNameForFormData, :model, :onChange)
|
240
|
+
panel_options = options.slice!(:url, :method, :local, :onSubmit, :paramNameForFormData, :model, :onChange, :onChangeAndLoad)
|
241
241
|
|
242
242
|
json.fullPageForm do
|
243
243
|
json.view 'panels/fullPageForm'
|
@@ -283,6 +283,12 @@ module Glib
|
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
286
|
+
if (on_unload = options[:unload])
|
287
|
+
json.onUnload do
|
288
|
+
on_unload.call @action_builder
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
286
292
|
if (on_refocus = options[:refocus])
|
287
293
|
json.onRefocus do
|
288
294
|
on_refocus.call @action_builder
|
@@ -9,6 +9,7 @@ class Glib::JsonUi::ViewBuilder
|
|
9
9
|
hash :validation
|
10
10
|
bool :disableDirtyCheck
|
11
11
|
action :onChange
|
12
|
+
action :onChangeAndLoad
|
12
13
|
string :paramNameForFormData
|
13
14
|
string :paramNameForFieldName
|
14
15
|
|
@@ -155,9 +156,6 @@ class Glib::JsonUi::ViewBuilder
|
|
155
156
|
def value(value)
|
156
157
|
@value = value if value != Glib::Value::DEFAULT
|
157
158
|
end
|
158
|
-
|
159
|
-
# TODO: Remove (deprecated). Where possible, use value instead of this
|
160
|
-
bool :checked
|
161
159
|
end
|
162
160
|
|
163
161
|
# This doesn't use camel case because some terms have become single words (e.g. snackbar)
|
@@ -173,15 +171,6 @@ class Glib::JsonUi::ViewBuilder
|
|
173
171
|
string :cacheKey
|
174
172
|
end
|
175
173
|
|
176
|
-
# Deprecated
|
177
|
-
# Just use fields_select with options provided by the backend. This allows greater flexibility,
|
178
|
-
# which is important because different systems might want to use different values for
|
179
|
-
# countries as well as for regions, e.g. alpha2 vs alpha3
|
180
|
-
# See app/views/json_ui/garage/forms/pickers.json.jbuilder for an example
|
181
|
-
class Country < AbstractField
|
182
|
-
hash :region
|
183
|
-
end
|
184
|
-
|
185
174
|
class Select < AbstractField
|
186
175
|
array :options
|
187
176
|
# bool :readOnly
|
@@ -209,14 +198,6 @@ class Glib::JsonUi::ViewBuilder
|
|
209
198
|
end
|
210
199
|
end
|
211
200
|
|
212
|
-
# TODO: Remove (deprecated)
|
213
|
-
class Autocomplete < AbstractField
|
214
|
-
array :options
|
215
|
-
# bool :readOnly
|
216
|
-
bool :multiple, cache: true
|
217
|
-
# bool :manualEntry
|
218
|
-
hash :append
|
219
|
-
end
|
220
201
|
|
221
202
|
class DynamicSelect < AbstractField
|
222
203
|
array :selectedOptions
|
@@ -286,7 +267,6 @@ class Glib::JsonUi::ViewBuilder
|
|
286
267
|
string :fileUrl
|
287
268
|
string :fileTitle
|
288
269
|
string :uploadText
|
289
|
-
string :uploadIcon # deprecated
|
290
270
|
hash :placeholderView
|
291
271
|
hash :infoSpec
|
292
272
|
string :storagePrefix
|
@@ -298,9 +278,9 @@ class Glib::JsonUi::ViewBuilder
|
|
298
278
|
|
299
279
|
def created
|
300
280
|
@buttonLabels ||= ActiveSupport::HashWithIndifferentAccess.new
|
301
|
-
@buttonLabels['change'] ||= I18n.t('
|
302
|
-
@buttonLabels['upload'] ||= I18n.t('
|
303
|
-
@buttonLabels['delete'] ||= I18n.t('
|
281
|
+
@buttonLabels['change'] ||= I18n.t('glib.change') if I18n.exists?('glib.change')
|
282
|
+
@buttonLabels['upload'] ||= I18n.t('glib.upload') if I18n.exists?('glib.upload')
|
283
|
+
@buttonLabels['delete'] ||= I18n.t('glib.delete') if I18n.exists?('glib.delete')
|
304
284
|
|
305
285
|
json.set! :buttonLabels, @buttonLabels
|
306
286
|
|
@@ -331,7 +311,6 @@ class Glib::JsonUi::ViewBuilder
|
|
331
311
|
array :files
|
332
312
|
string :directUploadUrl
|
333
313
|
string :uploadTitle
|
334
|
-
string :uploadFailedText # deprecated
|
335
314
|
action :onFinishUpload
|
336
315
|
string :strategy # can be "delegate" or "dropUpload"
|
337
316
|
string :url # http post end point if you don't want to use onFinishUpload
|
@@ -341,15 +320,6 @@ class Glib::JsonUi::ViewBuilder
|
|
341
320
|
|
342
321
|
required :accepts, :directUploadUrl
|
343
322
|
|
344
|
-
# deprecated
|
345
|
-
def title(value)
|
346
|
-
@placeholder = value
|
347
|
-
end
|
348
|
-
|
349
|
-
# deprecated
|
350
|
-
def subtitle(value)
|
351
|
-
@hint = value
|
352
|
-
end
|
353
323
|
|
354
324
|
def accepts(value)
|
355
325
|
@accepts = value
|
@@ -366,11 +336,11 @@ class Glib::JsonUi::ViewBuilder
|
|
366
336
|
def created
|
367
337
|
super
|
368
338
|
|
369
|
-
@placeholder ||= I18n.t('
|
370
|
-
@hint ||= I18n.t('
|
339
|
+
@placeholder ||= I18n.t('glib.multi_upload.placeholder', default: nil)
|
340
|
+
@hint ||= I18n.t('glib.multi_upload.hint', default: nil)
|
371
341
|
|
372
342
|
['200', '403', '401', 'else'].each do |status|
|
373
|
-
key = "
|
343
|
+
key = "glib.multi_upload.responseMessages.#{status}"
|
374
344
|
@responseMessages[status] = I18n.t(key) if I18n.exists?(key)
|
375
345
|
end
|
376
346
|
json.responseMessages (@responseMessages || {}).reverse_merge({
|
@@ -469,7 +439,6 @@ class Glib::JsonUi::ViewBuilder
|
|
469
439
|
class Otp < AbstractField
|
470
440
|
int :length
|
471
441
|
string :type
|
472
|
-
string :align # deprecated
|
473
442
|
end
|
474
443
|
|
475
444
|
class Rating < AbstractField
|
@@ -41,16 +41,15 @@ module Glib
|
|
41
41
|
hash :padding
|
42
42
|
singleton_array :styleClass, :styleClasses
|
43
43
|
|
44
|
-
hash :valueIf
|
45
|
-
|
46
44
|
hash :showIf
|
47
45
|
hash :loadIf
|
48
46
|
action :onIfTrue
|
49
47
|
action :onIfFalse
|
50
48
|
|
49
|
+
bool :displayed
|
50
|
+
bool :submitWhenNotDisplayed
|
51
|
+
|
51
52
|
hash :analytics
|
52
|
-
# hash :tooltip
|
53
|
-
array :extensions # deprecated
|
54
53
|
hash :dragData
|
55
54
|
|
56
55
|
def self.component_name
|
@@ -166,9 +165,6 @@ module Glib
|
|
166
165
|
class Icon < View
|
167
166
|
badgeable
|
168
167
|
|
169
|
-
# TODO: Remove later. Deprecated.
|
170
|
-
icon :spec
|
171
|
-
|
172
168
|
action :onClick
|
173
169
|
color :color
|
174
170
|
|
@@ -204,13 +200,6 @@ module Glib
|
|
204
200
|
action :onClick
|
205
201
|
color :color
|
206
202
|
bool :disabled
|
207
|
-
|
208
|
-
# TODO: This should be deprecated in favour of `popovers/open`
|
209
|
-
def childButtons(block)
|
210
|
-
json.childButtons do
|
211
|
-
block.call page.menu_builder
|
212
|
-
end
|
213
|
-
end
|
214
203
|
end
|
215
204
|
|
216
205
|
class Fab < View
|
@@ -4,14 +4,10 @@ section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
section.rows builder: ->(template) do
|
7
|
-
template.thumbnail title: 'components/
|
8
|
-
action.windows_open url: json_ui_garage_url(path: 'views/
|
7
|
+
template.thumbnail title: 'components/replace', onClick: ->(action) do
|
8
|
+
action.windows_open url: json_ui_garage_url(path: 'views/components_replace')
|
9
9
|
end
|
10
10
|
|
11
|
-
# template.thumbnail title: 'components/replace', onClick: ->(action) do
|
12
|
-
# action.windows_open url: json_ui_garage_url(path: 'views/components')
|
13
|
-
# end
|
14
|
-
|
15
11
|
template.thumbnail title: 'components/set', onClick: ->(action) do
|
16
12
|
action.windows_open url: json_ui_garage_url(path: 'views/components_set')
|
17
13
|
end
|
@@ -40,20 +40,6 @@ section.rows builder: ->(template) do
|
|
40
40
|
# end
|
41
41
|
# end
|
42
42
|
|
43
|
-
# TODO: Deprecate
|
44
|
-
template.thumbnail title: 'dialogs/option (Deprecated)', onClick: ->(action) do
|
45
|
-
# TODO: Rename to `dialogs/menu`
|
46
|
-
action.dialogs_options message: 'Select one', buttons: ->(menu) do
|
47
|
-
menu.button text: 'Option1', onClick: ->(action) do
|
48
|
-
action.dialogs_alert message: 'Option 1'
|
49
|
-
end
|
50
|
-
menu.button text: 'Option2', onClick: ->(action) do
|
51
|
-
action.dialogs_alert message: 'Option 2'
|
52
|
-
end
|
53
|
-
menu.button text: 'Cancel'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
43
|
template.thumbnail title: 'dialogs/show', onClick: ->(action) do
|
58
44
|
render 'json_ui/garage/actions/dialogs_show', json: json, action: action, dialog_mode: :show
|
59
45
|
end
|
@@ -16,7 +16,7 @@ section.rows builder: ->(template) do
|
|
16
16
|
action.windows_reload url: json_ui_garage_url(path: 'actions/index', reload_counter: reload_counter + 1)
|
17
17
|
end
|
18
18
|
|
19
|
-
template.thumbnail title: "components/
|
19
|
+
template.thumbnail title: "components/replace (counter: #{reload_counter})", onClick: ->(action) do
|
20
20
|
action.http_get url: json_ui_garage_url(path: 'actions/partial_update', reload_counter: reload_counter + 1)
|
21
21
|
end
|
22
22
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
name = params[:name]
|
2
|
-
action.
|
2
|
+
action.components_replace targetId: 'greeting', views: ->(update) do
|
3
3
|
update.panels_vertical childViews: ->(vertical) do
|
4
4
|
name = params[:name]
|
5
5
|
vertical.fields_hidden name: 'name', value: name
|
@@ -6,26 +6,9 @@ if text.length > min_chars
|
|
6
6
|
form.markdown \
|
7
7
|
text: text.truncate(min_chars),
|
8
8
|
styleClasses: ['line-clamp', "line-clamp-#{max_lines}"],
|
9
|
-
|
10
|
-
|
11
|
-
{
|
12
|
-
"var": toggle_name
|
13
|
-
},
|
14
|
-
'true'
|
15
|
-
]
|
16
|
-
}
|
17
|
-
form.markdown \
|
18
|
-
text: text,
|
19
|
-
showIf: {
|
20
|
-
"==": [
|
21
|
-
{
|
22
|
-
"var": toggle_name
|
23
|
-
},
|
24
|
-
'true'
|
25
|
-
]
|
26
|
-
}
|
9
|
+
id: "#{id}-off"
|
10
|
+
form.markdown id: "#{id}-on", text: text
|
27
11
|
|
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.
|
29
12
|
form.fields_check \
|
30
13
|
width: 'matchParent',
|
31
14
|
offIcon: 'expand_more',
|
@@ -35,7 +18,31 @@ if text.length > min_chars
|
|
35
18
|
checkValue: 'true',
|
36
19
|
uncheckValue: nil,
|
37
20
|
name: toggle_name,
|
38
|
-
disableDirtyCheck: true
|
21
|
+
disableDirtyCheck: true,
|
22
|
+
onChangeAndLoad: ->(action) do
|
23
|
+
action.runMultiple childActions: ->(saction) do
|
24
|
+
saction.logics_set targetId: "#{id}-on", conditionalData: {
|
25
|
+
displayed: {
|
26
|
+
"==": [
|
27
|
+
{
|
28
|
+
"var": toggle_name
|
29
|
+
},
|
30
|
+
'true'
|
31
|
+
]
|
32
|
+
}
|
33
|
+
}
|
34
|
+
saction.logics_set targetId: "#{id}-off", conditionalData: {
|
35
|
+
displayed: {
|
36
|
+
"!=": [
|
37
|
+
{
|
38
|
+
"var": toggle_name
|
39
|
+
},
|
40
|
+
'true'
|
41
|
+
]
|
42
|
+
}
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
39
46
|
|
40
47
|
@__read_more_index += 1
|
41
48
|
end
|