glib-web 4.7.0 → 4.8.1
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/forms_helper.rb +2 -1
- data/app/helpers/glib/json_ui/action_builder/files.rb +3 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +11 -2
- data/app/helpers/glib/json_ui/view_builder/panels.rb +5 -1
- data/app/helpers/glib/json_ui/view_builder.rb +1 -0
- data/app/models/glib/application_record.rb +10 -0
- data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +3 -3
- data/app/views/json_ui/garage/panels/tree.json.jbuilder +11 -3
- data/app/views/json_ui/garage/test_page/form.json.jbuilder +20 -2
- 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: 4af5ec6464503d4acd2375f22f2e7dbde209b628be35a6b749761a360e8ff061
|
4
|
+
data.tar.gz: d5447a14755f928524a26367f1ef9a132c773d8d2bce6bb3380be3503b7532eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12b6d7f44ef0255a67551dc26ef975ffa474d6fbfbeca8603769e26fd05af893b186efe4a8837e4a98f5f36e9da3aa4b8d191d8a8f8413304cbaafe31e4e1d2f
|
7
|
+
data.tar.gz: 5ff79df928df12a4d3fdbdf7c8d5badd688bdd37c887573d4abfdeae4adbdf19e24bfc8abc79d8d2d29fa4f4ed74725c3878232ce42e06fd06908ccb328b02a9
|
@@ -2,7 +2,8 @@ module Glib
|
|
2
2
|
module FormsHelper
|
3
3
|
def glib_form_field_label(model_name, prop, args = {})
|
4
4
|
I18n.t("dt_models.#{model_name}.#{prop}.label", **args.merge(default: nil)) ||
|
5
|
-
I18n.t("activerecord.attributes.#{model_name}.#{prop}", **args)
|
5
|
+
I18n.t("activerecord.attributes.#{model_name}.#{prop}", **args.merge(default: nil)) ||
|
6
|
+
I18n.t("activemodel.attributes.#{model_name}.#{prop}", **args)
|
6
7
|
end
|
7
8
|
|
8
9
|
def glib_form_hint_label(model_name, prop, args = {})
|
@@ -191,7 +191,9 @@ class Glib::JsonUi::ViewBuilder
|
|
191
191
|
end
|
192
192
|
|
193
193
|
class Select < AbstractField
|
194
|
-
|
194
|
+
attr_reader :_options
|
195
|
+
|
196
|
+
# array :options
|
195
197
|
# bool :readOnly
|
196
198
|
bool :multiple, cache: true
|
197
199
|
# bool :manualEntry
|
@@ -200,6 +202,11 @@ class Glib::JsonUi::ViewBuilder
|
|
200
202
|
panels_builder :accessory, :header, :footer
|
201
203
|
bool :clearable
|
202
204
|
|
205
|
+
def options(value)
|
206
|
+
@_options = value
|
207
|
+
json.set! 'options', value&.to_a
|
208
|
+
end
|
209
|
+
|
203
210
|
def searchable(value)
|
204
211
|
@searchable = value
|
205
212
|
end
|
@@ -207,7 +214,9 @@ class Glib::JsonUi::ViewBuilder
|
|
207
214
|
def created
|
208
215
|
super
|
209
216
|
|
210
|
-
|
217
|
+
if @searchable.nil?
|
218
|
+
@searchable = _options.size >= 10
|
219
|
+
end
|
211
220
|
json.set! 'searchable', @searchable
|
212
221
|
end
|
213
222
|
end
|
@@ -102,7 +102,9 @@ class Glib::JsonUi::ViewBuilder
|
|
102
102
|
if name.ends_with?('_id') && is_single_association?(model, name.chomp('_id'))
|
103
103
|
name = name.chomp('_id') # Always uses non-ID property name in i18n files
|
104
104
|
end
|
105
|
-
I18n.t("dt_models.#{model_name}.#{name}.label", **args.merge(default: nil)) ||
|
105
|
+
I18n.t("dt_models.#{model_name}.#{name}.label", **args.merge(default: nil)) ||
|
106
|
+
I18n.t("activerecord.attributes.#{model_name}.#{name}", **args.merge(default: nil)) ||
|
107
|
+
I18n.t("activemodel.attributes.#{model_name}.#{name}", **args)
|
106
108
|
end
|
107
109
|
|
108
110
|
def hint_label(prop, args)
|
@@ -427,6 +429,8 @@ class Glib::JsonUi::ViewBuilder
|
|
427
429
|
class Tree < View
|
428
430
|
include Glib::JsonUi::Upload
|
429
431
|
|
432
|
+
string :paramNameForFormData
|
433
|
+
string :paramNameForContext
|
430
434
|
string :selected
|
431
435
|
action :onDropFile
|
432
436
|
action :onDropView
|
@@ -21,5 +21,15 @@ module Glib
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
def assert_core_columns_exist
|
26
|
+
if Rails.env.development? || Rails.env.test?
|
27
|
+
[:id, :created_at, :updated_at].each do |column_name|
|
28
|
+
unless self.class.column_names.include?(column_name.to_s)
|
29
|
+
raise ActiveRecord::ConfigurationError, "#{self.class.table_name}.#{column_name} should exist"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
24
34
|
end
|
25
35
|
end
|
@@ -46,7 +46,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
|
|
46
46
|
],
|
47
47
|
imageUploader: {
|
48
48
|
name: 'user[images_attributes][]',
|
49
|
-
accepts: { fileType: 'image
|
49
|
+
accepts: { fileType: 'image', maxFileSize: 5000 },
|
50
50
|
directUploadUrl: glib_direct_uploads_url
|
51
51
|
},
|
52
52
|
onChange: ->(action) do
|
@@ -383,7 +383,7 @@ page.form \
|
|
383
383
|
end
|
384
384
|
end
|
385
385
|
|
386
|
-
form.
|
386
|
+
form.panels_responsive \
|
387
387
|
id: 'panel7a',
|
388
388
|
styleClass: 'border-2',
|
389
389
|
width: 'matchParent',
|
@@ -392,7 +392,7 @@ page.form \
|
|
392
392
|
vertical.fields_text name: 'user[0][loadif_target9]', width: 'matchParent', value: 'Value 7a'
|
393
393
|
end
|
394
394
|
|
395
|
-
form.
|
395
|
+
form.panels_responsive \
|
396
396
|
id: 'panel7b',
|
397
397
|
styleClass: 'border-2',
|
398
398
|
width: 'matchParent',
|
@@ -401,7 +401,7 @@ page.form \
|
|
401
401
|
vertical.fields_text name: 'user[1][loadif_target9]', width: 'matchParent', value: 'Value 7b'
|
402
402
|
end
|
403
403
|
|
404
|
-
form.
|
404
|
+
form.panels_responsive \
|
405
405
|
id: 'panel7c',
|
406
406
|
styleClass: 'border-2',
|
407
407
|
width: 'matchParent',
|
@@ -1,9 +1,12 @@
|
|
1
1
|
json.title 'Panels'
|
2
2
|
|
3
3
|
onDropFile = ->(action) do
|
4
|
-
action.files_upload
|
5
|
-
|
6
|
-
|
4
|
+
action.files_upload \
|
5
|
+
directUploadUrl: glib_direct_uploads_url,
|
6
|
+
paramNameForFiles: 'signedIds',
|
7
|
+
onFinished: ->(saction) do
|
8
|
+
saction.http_post url: json_ui_garage_url(path: 'forms/generic_post_all')
|
9
|
+
end
|
7
10
|
end
|
8
11
|
onDropView = ->(action) do
|
9
12
|
action.http_post url: json_ui_garage_url(path: 'forms/generic_post_all')
|
@@ -18,6 +21,8 @@ json_ui_page json do |page|
|
|
18
21
|
|
19
22
|
scroll.panels_column md: { cols: 4 }, childViews: ->(col) do
|
20
23
|
scroll.panels_tree \
|
24
|
+
paramNameForContext: 'moved',
|
25
|
+
# paramNameForFormData: 'message',
|
21
26
|
onDropFile: onDropFile,
|
22
27
|
onDropView: onDropView,
|
23
28
|
selected: params[:selected] || 'arabian-1.mp3',
|
@@ -33,6 +38,7 @@ json_ui_page json do |page|
|
|
33
38
|
id: 'pop',
|
34
39
|
title: 'Pop',
|
35
40
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
41
|
+
dropData: { genre: 'pop' },
|
36
42
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'pop') },
|
37
43
|
subtitle: params['selected'] == 'pop' ? 'Pop music is a genre of popular music that originated in its modern' : nil,
|
38
44
|
rows: ['pop-1.mp3', 'pop-2.mp3', 'pop-3.mp3']
|
@@ -40,6 +46,7 @@ json_ui_page json do |page|
|
|
40
46
|
id: 'arab',
|
41
47
|
title: 'Arabian',
|
42
48
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
49
|
+
dropData: { genre: 'arab' },
|
43
50
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'arab') },
|
44
51
|
subtitle: params['selected'] == 'arab' ? 'Arabic music is the music of the Arab world' : nil,
|
45
52
|
rows: ['arabian-1.mp3', 'arabian-2.mp3', 'arabian-3.mp3']
|
@@ -48,6 +55,7 @@ json_ui_page json do |page|
|
|
48
55
|
title: 'Phonk',
|
49
56
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'phonk') },
|
50
57
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
58
|
+
dropData: { genre: 'phonk' },
|
51
59
|
subtitle: params['selected'] == 'phonk' ? 'Phonk is a subgenre of hip hop and trap music' : nil,
|
52
60
|
rows: ['phonk1.mp3', 'phonk-2.mp3', { id: 'hard-phonk', title: 'Hard Phonk', rows: ['hard-phonk-1.mp3', 'hard-phonk-2.mp3'] }]
|
53
61
|
end
|
@@ -44,7 +44,11 @@ page.body childViews: ->(body) do
|
|
44
44
|
end
|
45
45
|
hori.spacer width: 4
|
46
46
|
hori.button text: 'hide select', onClick: ->(action) do
|
47
|
-
action.
|
47
|
+
action.runMultiple childActions: ->(saction) do
|
48
|
+
['select', 'select1', 'select2', 'select3'].each do |id|
|
49
|
+
saction.components_set targetId: id, data: { displayed: false }
|
50
|
+
end
|
51
|
+
end
|
48
52
|
end
|
49
53
|
hori.spacer height: 4
|
50
54
|
hori.button text: 'hide jack', onClick: ->(action) do
|
@@ -71,8 +75,22 @@ page.body childViews: ->(body) do
|
|
71
75
|
|
72
76
|
form.fields_date width: 'matchParent', name: 'user[date]', id: 'date', value: Date.new(2024, 7, 24), validation: validation
|
73
77
|
form.hr width: 'matchParent'
|
74
|
-
form.fields_select multiple: true, width: 'matchParent', name: 'user[select][]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
|
78
|
+
form.fields_select clearable: true, multiple: true, width: 'matchParent', name: 'user[select][]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
|
75
79
|
form.hr width: 'matchParent'
|
80
|
+
form.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', id: 'select1', childViews: ->(flow) do
|
81
|
+
form.fields_select clearable: true, width: 'matchParent', name: 'user[select1]', options: options, value: 'option1'
|
82
|
+
form.hr width: 'matchParent'
|
83
|
+
end
|
84
|
+
form.panels_horizontal id: 'select2', width: 'matchParent', childViews: ->(hori) do
|
85
|
+
form.fields_select clearable: true, width: 'matchParent', name: 'user[select2]', options: options, value: 'option2'
|
86
|
+
form.hr width: 'matchParent'
|
87
|
+
end
|
88
|
+
form.panels_split id: 'select3', width: 'matchParent', content: ->(split) do
|
89
|
+
split.left childViews: ->(right) do
|
90
|
+
form.fields_select clearable: true, width: 'matchParent', name: 'user[select3]', options: options, value: 'option3'
|
91
|
+
form.hr width: 'matchParent'
|
92
|
+
end
|
93
|
+
end
|
76
94
|
form.fields_chipGroup width: 'matchParent', name: 'user[chip_group]', id: 'chip_group', options: options, value: ['option2'], validation: validation
|
77
95
|
form.hr width: 'matchParent'
|
78
96
|
form.fields_radioGroup width: 'matchParent', name: 'user[radio_group]', id: 'radio_group', value: 'option3', validation: validation, childViews: ->(radio) do
|