glib-web 4.11.4 → 4.13.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/ui.rb +6 -0
- data/app/helpers/glib/json_ui/action_builder/components.rb +1 -0
- data/app/helpers/glib/json_ui/action_builder/logics.rb +1 -0
- data/app/helpers/glib/json_ui/action_builder/popovers.rb +2 -0
- data/app/helpers/glib/json_ui/action_builder/sheets.rb +1 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +1 -1
- data/app/helpers/glib/json_ui/view_builder/fields.rb +8 -3
- data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/bulk_edit_post2.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +61 -0
- data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +0 -10
- data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +15 -1
- data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +4 -2
- data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +17 -12
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +15 -3
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +2 -2
- data/app/views/json_ui/garage/tables/bulk_edit.json.jbuilder +4 -5
- data/app/views/json_ui/garage/views/controls.json.jbuilder +2 -1
- data/app/views/layouts/json_ui/renderer.html.erb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c597b4f85658814671fef38361d34b1a4210d7ee40b1644e10396b43f6232e7
|
4
|
+
data.tar.gz: ac3eaacdc14a17abad4f020f3a27382c0eb2a44d5da68600367fa0c710b8d1b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbbd8349fb818a58a6785c1f32f44b5e3126ae1cd7c975f91e9b6916fb776252cfcfa35f55e70aa62b831c0a35a2377b2e6e9ffd6642733c5d524d83c1030855
|
7
|
+
data.tar.gz: e45bcc94a58ba3e482f805d890ce01ae2ce4ba1f55a9f22c5a194c89dc7c0aa6c69fc89668d3085bcf0683380d59da638da6e863507c41a8b0560669d2d41c82
|
@@ -84,7 +84,13 @@ module Glib::Json::Ui
|
|
84
84
|
end
|
85
85
|
|
86
86
|
private
|
87
|
+
def glib_theme
|
88
|
+
{}
|
89
|
+
end
|
90
|
+
|
87
91
|
def __json_ui_vue(hash, options)
|
92
|
+
@__json_ui_setting = { theme: glib_theme }.to_json
|
93
|
+
|
88
94
|
renderer_path = params[:_skip_custom_render] == 'true' ? 'layouts/json_ui/no_custom' : options[:renderer_path]
|
89
95
|
@__json_ui_orig_page = response.body
|
90
96
|
response.body = render_to_string(
|
@@ -8,7 +8,7 @@ module Glib
|
|
8
8
|
class MenuItem < JsonUiElement
|
9
9
|
include Builder::MouseEvents
|
10
10
|
|
11
|
-
hash :analytics, optional: [:featured, :disabled]
|
11
|
+
hash :analytics, optional: [:featured, :disabled, :group, :action]
|
12
12
|
hash :tooltip, required: [:text], optional: [:placement, :position]
|
13
13
|
end
|
14
14
|
|
@@ -7,6 +7,7 @@ class Glib::JsonUi::ViewBuilder
|
|
7
7
|
bool :readOnly
|
8
8
|
bool :disabled
|
9
9
|
bool :disableDirtyCheck
|
10
|
+
bool :clearable
|
10
11
|
action :onChange
|
11
12
|
action :onChangeAndLoad
|
12
13
|
string :paramNameForFormData
|
@@ -162,6 +163,7 @@ class Glib::JsonUi::ViewBuilder
|
|
162
163
|
class CheckGroup < AbstractField
|
163
164
|
views :childViews
|
164
165
|
string :uncheckValue
|
166
|
+
bool :watchNoneOfAbove
|
165
167
|
end
|
166
168
|
|
167
169
|
class Check < Text
|
@@ -171,6 +173,7 @@ class Glib::JsonUi::ViewBuilder
|
|
171
173
|
string :offIcon
|
172
174
|
string :onLabel
|
173
175
|
hash :image, required: [:url, :template], optional: [:width, :height]
|
176
|
+
bool :indeterminate
|
174
177
|
|
175
178
|
def value(value)
|
176
179
|
@value = value if value != Glib::Value::DEFAULT
|
@@ -201,7 +204,9 @@ class Glib::JsonUi::ViewBuilder
|
|
201
204
|
|
202
205
|
panels_builder :accessory, :header, :footer
|
203
206
|
bool :clearable
|
204
|
-
bool :
|
207
|
+
bool :watchNoneOfAbove
|
208
|
+
bool :prependSelectAll
|
209
|
+
# bool :csvMode
|
205
210
|
|
206
211
|
def options(value)
|
207
212
|
@_options = value
|
@@ -294,8 +299,8 @@ class Glib::JsonUi::ViewBuilder
|
|
294
299
|
action :onClick
|
295
300
|
string :offIcon
|
296
301
|
string :onIcon
|
297
|
-
hash :image, required: [:url, :template], optional: [:width, :height]
|
298
|
-
hash :icon, required: [:name, :template], optional: [:color, :size]
|
302
|
+
hash :image, required: [:url, :template], optional: [:width, :height, :subtitle]
|
303
|
+
hash :icon, required: [:name, :template], optional: [:color, :size, :subtitle]
|
299
304
|
|
300
305
|
views :childViews
|
301
306
|
end
|
@@ -5,7 +5,7 @@ end
|
|
5
5
|
|
6
6
|
section.rows builder: ->(template) do
|
7
7
|
template.thumbnail title: 'sheets/select', onClick: ->(action) do
|
8
|
-
action.sheets_select message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed rutrum vel nisi in pharetra. Aenean mollis feugiat elementum. Donec tempor arcu fringilla risus finibus cursus. Donec eleifend ex sit amet odio rutrum, vitae ornare nunc congue. In hac habitasse platea dictumst. Curabitur at velit et odio ornare vestibulum sit amet vitae ex. Proin tincidunt rutrum libero vitae tempus.', buttons: ->(menu) do
|
8
|
+
action.sheets_select overlay: true, message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed rutrum vel nisi in pharetra. Aenean mollis feugiat elementum. Donec tempor arcu fringilla risus finibus cursus. Donec eleifend ex sit amet odio rutrum, vitae ornare nunc congue. In hac habitasse platea dictumst. Curabitur at velit et odio ornare vestibulum sit amet vitae ex. Proin tincidunt rutrum libero vitae tempus.', buttons: ->(menu) do
|
9
9
|
menu.button text: 'Option1', onClick: ->(subaction) do
|
10
10
|
subaction.dialogs_alert message: 'Option 1'
|
11
11
|
end
|
@@ -8,6 +8,12 @@ page.scroll childViews: ->(scroll) do
|
|
8
8
|
url: json_ui_garage_url(path: 'forms/generic_post'),
|
9
9
|
method: 'post',
|
10
10
|
padding: glib_json_padding_body,
|
11
|
+
onChange: ->(action) do
|
12
|
+
action.logics_set targetId: 'checker2', skipOnChange: true, conditionalData: {
|
13
|
+
value: { "==": [{ "countNonNull": [{ "var": 'user[foo][]' }] }, 3] },
|
14
|
+
indeterminate: { "<": [0, { "countNonNull": [{ "var": 'user[foo][]' }] }, 3] }
|
15
|
+
}
|
16
|
+
end,
|
11
17
|
childViews: ->(form) do
|
12
18
|
form.spacer height: 20
|
13
19
|
form.h2 text: 'Check Group'
|
@@ -38,6 +44,61 @@ page.scroll childViews: ->(scroll) do
|
|
38
44
|
form.fields_check name: 'user[choice][]', label: 'Choice 1', checkValue: 'choice_1'
|
39
45
|
form.fields_check name: 'user[choice][]', label: 'Choice 2', checkValue: 'choice_2'
|
40
46
|
|
47
|
+
form.spacer height: 20
|
48
|
+
form.h2 text: 'Checkboxes with none_of_above'
|
49
|
+
form.fields_checkGroup \
|
50
|
+
watchNoneOfAbove: true,
|
51
|
+
name: 'user[favorite_fruits][]',
|
52
|
+
value: 'grape',
|
53
|
+
uncheckValue: 1,
|
54
|
+
childViews: ->(group) do
|
55
|
+
group.fields_check label: 'Grape', checkValue: 'grape'
|
56
|
+
group.fields_check label: 'Banana', checkValue: 'banana'
|
57
|
+
group.fields_check label: 'Durian', checkValue: 'durian'
|
58
|
+
group.fields_check label: 'I dont like fruits', checkValue: 'none_of_above'
|
59
|
+
end
|
60
|
+
|
61
|
+
form.spacer height: 20
|
62
|
+
form.h2 text: 'Check all with checkGroup'
|
63
|
+
form.button id: 'checker', text: 'check all', onClick: ->(action) do
|
64
|
+
action.components_invoke targetId: 'check_all', name: 'checkAll'
|
65
|
+
end
|
66
|
+
form.fields_checkGroup \
|
67
|
+
id: 'check_all',
|
68
|
+
name: 'user[favorite_fruits2][]',
|
69
|
+
uncheckValue: 1,
|
70
|
+
onChangeAndLoad: ->(action) do
|
71
|
+
action.logics_set targetId: 'checker', conditionalData: {
|
72
|
+
text: {
|
73
|
+
"if": [
|
74
|
+
{
|
75
|
+
"==": [
|
76
|
+
{
|
77
|
+
"count": [{ "var": 'user[favorite_fruits2][]' }]
|
78
|
+
},
|
79
|
+
3
|
80
|
+
]
|
81
|
+
},
|
82
|
+
'uncheck all',
|
83
|
+
'check all'
|
84
|
+
]
|
85
|
+
}
|
86
|
+
}
|
87
|
+
end,
|
88
|
+
childViews: ->(group) do
|
89
|
+
group.fields_check label: 'Grape', checkValue: 'grape'
|
90
|
+
group.fields_check label: 'Banana', checkValue: 'banana'
|
91
|
+
group.fields_check label: 'Durian', checkValue: 'durian'
|
92
|
+
end
|
93
|
+
|
94
|
+
form.spacer height: 20
|
95
|
+
form.h2 text: 'Check all without checkGroup'
|
96
|
+
form.fields_check name: 'check_all_1', id: 'checker2', label: 'check all', checkValue: true, onChange: ->(action) do
|
97
|
+
action.logics_set targetIds: ['check1', 'check2', 'check3'], conditionalData: { value: { "!!": [{ "var": 'check_all_1' }] } }
|
98
|
+
end
|
99
|
+
form.fields_check id: 'check1', name: 'user[foo][]', label: 'Option 1', checkValue: true
|
100
|
+
form.fields_check id: 'check2', name: 'user[foo][]', label: 'Option 2', checkValue: true
|
101
|
+
form.fields_check id: 'check3', name: 'user[foo][]', label: 'Option 3', checkValue: true
|
41
102
|
|
42
103
|
form.spacer height: 20
|
43
104
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
@@ -26,16 +26,6 @@ page.form \
|
|
26
26
|
end
|
27
27
|
form.fields_datetime id: 'date2', name: 'user[datetime_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01'
|
28
28
|
|
29
|
-
form.spacer height: 20
|
30
|
-
form.h2 text: 'Check/uncheck All'
|
31
|
-
form.spacer height: 6
|
32
|
-
form.fields_check name: 'user[check_all]', label: 'All', checkValue: true, onChangeAndLoad: ->(action) do
|
33
|
-
action.logics_set targetIds: ['check1', 'check2', 'check3'], conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
|
34
|
-
end
|
35
|
-
form.fields_check id: 'check1', name: 'user[check1]', label: 'Check 1', checkValue: true
|
36
|
-
form.fields_check id: 'check2', name: 'user[check2]', label: 'Check 2', checkValue: true
|
37
|
-
form.fields_check id: 'check3', name: 'user[check3]', label: 'Check 3', checkValue: true
|
38
|
-
|
39
29
|
form.spacer height: 20
|
40
30
|
form.h2 text: 'Divided by 3 (with precision set)'
|
41
31
|
form.spacer height: 6
|
@@ -22,7 +22,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
22
22
|
{ name: 'type', value: 'yes_no' },
|
23
23
|
]
|
24
24
|
]
|
25
|
-
form.fields_dynamicGroup width: 'matchParent', name: 'user[evaluation]', groupFieldProperties: properties, titlePrefix: 'Entry', content: ->(group) do
|
25
|
+
form.fields_dynamicGroup id: 'form_dynamic_group', width: 'matchParent', name: 'user[evaluation]', groupFieldProperties: properties, titlePrefix: 'Entry', content: ->(group) do
|
26
26
|
group.template padding: { left: 32 }, childViews: ->(template) do
|
27
27
|
template.spacer height: 10
|
28
28
|
template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
|
@@ -103,6 +103,20 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
+
form.panels_horizontal \
|
107
|
+
align: 'middle',
|
108
|
+
childViews: ->(horizontal) do
|
109
|
+
horizontal.icon \
|
110
|
+
name: 'add_circle',
|
111
|
+
styleClasses: ['success']
|
112
|
+
|
113
|
+
horizontal.spacer width: 10
|
114
|
+
horizontal.h4 text: 'Add item'
|
115
|
+
end,
|
116
|
+
onClick: ->(action) do
|
117
|
+
action.components_invoke targetId: 'form_dynamic_group', name: 'addGroup'
|
118
|
+
end
|
119
|
+
|
106
120
|
form.spacer height: 20
|
107
121
|
form.fields_submit text: 'Submit'
|
108
122
|
end
|
@@ -11,13 +11,15 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
11
11
|
|
12
12
|
form.fields_dynamicSelect name: 'user[primary_language]', width: 'matchParent', label: 'Primary Language',
|
13
13
|
selectedOptions: [ { value: 'id3', text: 'Item 3' } ],
|
14
|
-
url: json_ui_garage_url(path: 'forms/dynamic_select_data')
|
14
|
+
url: json_ui_garage_url(path: 'forms/dynamic_select_data'),
|
15
|
+
placeholder: 'Start typing'
|
15
16
|
|
16
17
|
form.spacer height: 14
|
17
18
|
form.fields_dynamicSelect name: 'user[preferred_languages][]', width: 'matchParent', label: 'Preferred Languages',
|
18
19
|
selectedOptions: [ { value: 'id3', text: 'Item 3' }, { value: 'id5', text: 'Item 5' } ],
|
19
20
|
url: json_ui_garage_url(path: 'forms/dynamic_select_data'),
|
20
|
-
multiple: true
|
21
|
+
multiple: true,
|
22
|
+
placeholder: 'Start typing'
|
21
23
|
|
22
24
|
form.spacer height: 14
|
23
25
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
@@ -22,17 +22,22 @@ end
|
|
22
22
|
# end
|
23
23
|
# end
|
24
24
|
|
25
|
-
|
26
|
-
section
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
25
|
+
if (query_keyword = params[:q]).present?
|
26
|
+
section = json_ui_section json
|
27
|
+
section.rows builder: ->(row) do
|
28
|
+
count_per_page = 20
|
29
|
+
count_per_page.times do |i|
|
30
|
+
index = page * count_per_page + i
|
31
|
+
# title: "City #{index} (#{query_keyword})",
|
32
|
+
row.custom \
|
33
|
+
subtitle: "State #{index}",
|
34
|
+
subsubtitle: "Country #{index}",
|
35
|
+
extra: {
|
36
|
+
value: "id#{index}",
|
37
|
+
text: "City #{index} (#{query_keyword})"
|
38
|
+
}
|
39
|
+
end
|
37
40
|
end
|
41
|
+
else
|
42
|
+
json.rows []
|
38
43
|
end
|
@@ -50,9 +50,10 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
50
50
|
|
51
51
|
form.spacer height: 6
|
52
52
|
|
53
|
-
options = languages.map { |k, v| { value: k, text: v
|
54
|
-
options << { value:
|
53
|
+
options = languages.map { |k, v| { value: k, text: v } }
|
54
|
+
options << { value: 'none_of_above', text: 'None of the above' }
|
55
55
|
form.fields_select \
|
56
|
+
watchNoneOfAbove: true,
|
56
57
|
name: 'user[cities][]',
|
57
58
|
width: 'matchParent',
|
58
59
|
label: 'Cities',
|
@@ -63,6 +64,17 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
63
64
|
action.dialogs_alert message: 'Options selected'
|
64
65
|
end
|
65
66
|
|
67
|
+
form.spacer height: 6
|
68
|
+
form.fields_select \
|
69
|
+
watchNoneOfAbove: true,
|
70
|
+
prependSelectAll: true,
|
71
|
+
name: 'user[cities2][]',
|
72
|
+
width: 'matchParent',
|
73
|
+
label: 'Cities',
|
74
|
+
options: options[0..-2],
|
75
|
+
value: ['melbourne', 'sydney'],
|
76
|
+
multiple: true
|
77
|
+
|
66
78
|
form.spacer height: 20
|
67
79
|
form.h2 text: 'Select fields with grouping'
|
68
80
|
form.spacer height: 6
|
@@ -142,7 +154,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
142
154
|
name: 'user[animal_or_plant]',
|
143
155
|
width: 'matchParent',
|
144
156
|
label: 'Animal or Plant',
|
145
|
-
options: [{ text: 'Animal', value: 'animal' }, { text: 'Plant', value: 'plant' }],
|
157
|
+
options: [{ icon: { name: 'pets' }, text: 'Animal', value: 'animal' }, { icon: { name: 'forest' }, text: 'Plant', value: 'plant' }],
|
146
158
|
value: 'animal',
|
147
159
|
onChangeAndLoad: ->(action) do
|
148
160
|
action.http_get url: json_ui_garage_url(path: 'forms/update_options')
|
@@ -129,7 +129,7 @@ page.form \
|
|
129
129
|
|
130
130
|
res.panels_column width: 'matchParent', lg: { cols: 4 }, childViews: ->(column) do
|
131
131
|
column.fields_radio\
|
132
|
-
width:
|
132
|
+
width: 'matchParent',
|
133
133
|
value: 'yes', label: 'Yes', icon: { template: 'featured', name: 'edit', size: 40, color: '#d1d1d1' },
|
134
134
|
onClick: ->(action) do
|
135
135
|
action.windows_openWeb url: 'http://www.google.com'
|
@@ -137,7 +137,7 @@ page.form \
|
|
137
137
|
end
|
138
138
|
res.panels_column width: 'matchParent', lg: { cols: 4 }, childViews: ->(column) do
|
139
139
|
column.fields_radio\
|
140
|
-
width:
|
140
|
+
width: 'matchParent',
|
141
141
|
value: 'no', label: 'No',
|
142
142
|
image: { template: 'featured', url: 'https://cdn.pixabay.com/photo/2020/08/05/13/12/eco-5465432_1280.png', width: 80, height: 80 },
|
143
143
|
onClick: ->(action) do
|
@@ -48,12 +48,12 @@ page.scroll childViews: ->(scroll) do
|
|
48
48
|
horizontal.label text: 'Total: '
|
49
49
|
horizontal.label id: 'loaded_count', text: '0'
|
50
50
|
|
51
|
-
horizontal.label text: " #{symbol_horizontal_separator} "
|
51
|
+
# horizontal.label text: " #{symbol_horizontal_separator} "
|
52
52
|
|
53
53
|
horizontal.label text: 'Selected: '
|
54
54
|
horizontal.label id: 'selected_count', text: '0'
|
55
55
|
|
56
|
-
horizontal.label text: " #{symbol_horizontal_separator} "
|
56
|
+
# horizontal.label text: " #{symbol_horizontal_separator} "
|
57
57
|
horizontal.chip \
|
58
58
|
id: 'succeeded_count',
|
59
59
|
styleClass: 'success',
|
@@ -64,11 +64,10 @@ page.scroll childViews: ->(scroll) do
|
|
64
64
|
scroll.panels_bulkEdit2 \
|
65
65
|
id: 'import_table',
|
66
66
|
width: 'matchParent',
|
67
|
-
backgroundColor: '#e2e2e2',
|
68
67
|
paramNameForRowId: 'row_id',
|
69
68
|
import: { submitUrl: json_ui_garage_url(path: 'forms/bulk_edit_post2'), paramName: 'user' },
|
70
69
|
viewHeaders: [
|
71
|
-
{ text: 'Month', id: 'month', importable: true },
|
70
|
+
{ text: 'Month', id: 'month', importable: true, tooltip: { text: 'Month', placement: 'top' } },
|
72
71
|
{ text: 'Electricity usage', id: 'electricity_usage', importable: true },
|
73
72
|
{ text: 'Gas usage', id: 'gas_usage', importable: true },
|
74
73
|
{ text: 'Sources', id: 'sources', importable: true },
|
@@ -142,7 +141,7 @@ page.scroll childViews: ->(scroll) do
|
|
142
141
|
conditionalData: {
|
143
142
|
text: {
|
144
143
|
"printf": [
|
145
|
-
|
144
|
+
'Uploaded: {0}',
|
146
145
|
{ "count": [{ "var": 'data.succeededRows' }] }
|
147
146
|
]
|
148
147
|
},
|
@@ -34,6 +34,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
34
34
|
|
35
35
|
action.popovers_show \
|
36
36
|
key: 'menu',
|
37
|
+
overlay: true,
|
37
38
|
placement: 'left',
|
38
39
|
content: ->(dialog) do
|
39
40
|
dialog.body padding: glib_json_padding_body, childViews: ->(view) do
|
@@ -57,10 +58,10 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
57
58
|
text: 'Button with tooltip and dropdown',
|
58
59
|
tooltip: { text: 'Tooltip 1' },
|
59
60
|
onClick: ->(action) do
|
60
|
-
|
61
61
|
action.popovers_show \
|
62
62
|
key: 'menu',
|
63
63
|
placement: 'bottom-start',
|
64
|
+
overlay: true,
|
64
65
|
width: 200,
|
65
66
|
content: ->(dialog) do
|
66
67
|
dialog.body styleClass: 'popover-menu', padding: glib_json_padding_body, childViews: ->(res) do
|