glib-web 4.8.2 → 4.9.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/panels.rb +34 -22
- data/app/views/json_ui/garage/forms/bulk_edit_post2.json.jbuilder +12 -13
- data/app/views/json_ui/garage/tables/bulk_edit.json.jbuilder +4 -8
- data/app/views/json_ui/garage/tables/panel_content.json.jbuilder +57 -25
- 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: 4bc560f6e7a39207eccdf57d1824992450c6ff9032cbb1598164c5a1fceac013
|
4
|
+
data.tar.gz: 33fc04d6d58545ed3951d942ed8d5002a772bc164442ba73bb4f27c409342fe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e78cc53ddcde671449504a62d1ccb33b746df252f1807d357a8665b764c4330de15a394eee3baf0e715b96eba81ad00a7dcc98c0e15d6da73d2e7e8e050ae05
|
7
|
+
data.tar.gz: c4352064bfb0d6d402f43b4d128c24e215406700bd79e5b63e584b30a3888b1e078271cffb7a886c4a08467bfc9790455a19f47ca0d12240e10f059cc2989549
|
@@ -326,36 +326,18 @@ class Glib::JsonUi::ViewBuilder
|
|
326
326
|
end
|
327
327
|
end
|
328
328
|
|
329
|
-
class
|
329
|
+
class Table2 < View
|
330
330
|
attr_reader :template
|
331
331
|
|
332
|
-
hash :
|
333
|
-
|
334
|
-
|
335
|
-
action :onLoadRows
|
336
|
-
action :onCellChange
|
337
|
-
|
338
|
-
string :paramNameForFormData
|
339
|
-
|
340
|
-
array :viewHeaders
|
341
|
-
action :onRowSelected
|
332
|
+
hash :nextPage
|
333
|
+
action :onScrollToTop
|
334
|
+
action :onScrollToBottom
|
342
335
|
|
343
336
|
def initialize(json, page)
|
344
337
|
super
|
345
338
|
@template = Glib::JsonUi::TableBuilders::Template.new(json, self)
|
346
339
|
end
|
347
340
|
|
348
|
-
# Experimental
|
349
|
-
panels_builder :accessory, :header, :footer
|
350
|
-
|
351
|
-
def viewCells(values)
|
352
|
-
json.set! 'viewCells' do
|
353
|
-
values.each do |value|
|
354
|
-
value.call(page.view_builder)
|
355
|
-
end
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
359
341
|
def header(options = {})
|
360
342
|
json.header do
|
361
343
|
json.backgroundColor options.delete(:backgroundColor)
|
@@ -383,6 +365,29 @@ class Glib::JsonUi::ViewBuilder
|
|
383
365
|
|
384
366
|
raise "Invalid properties: #{options.keys}" if options.size > 0
|
385
367
|
end
|
368
|
+
end
|
369
|
+
|
370
|
+
class BulkEdit2 < View
|
371
|
+
hash :import, required: [:submitUrl, :paramName]
|
372
|
+
|
373
|
+
string :statusViewIdPrefix
|
374
|
+
array :viewHeaders
|
375
|
+
|
376
|
+
action :onLoadRows
|
377
|
+
action :onCellChange
|
378
|
+
string :paramNameForFormData
|
379
|
+
action :onRowSelected
|
380
|
+
|
381
|
+
# Experimental
|
382
|
+
panels_builder :accessory, :header, :footer
|
383
|
+
|
384
|
+
def viewCells(values)
|
385
|
+
json.set! 'viewCells' do
|
386
|
+
values.each do |value|
|
387
|
+
value.call(page.view_builder)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
386
391
|
|
387
392
|
def dataRows(value)
|
388
393
|
json.dataRows value
|
@@ -559,6 +564,13 @@ class Glib::JsonUi::ViewBuilder
|
|
559
564
|
# end
|
560
565
|
end
|
561
566
|
|
567
|
+
class Pagination < View
|
568
|
+
int :length
|
569
|
+
int :value
|
570
|
+
action :onChange
|
571
|
+
string :paramNameForFieldName
|
572
|
+
end
|
573
|
+
|
562
574
|
module ModelPanel
|
563
575
|
attr_reader :model_name # See Panels::Form.field_name
|
564
576
|
attr_reader :assoc_order_index
|
@@ -1,16 +1,15 @@
|
|
1
|
+
sleep 0.1
|
2
|
+
status_cell = params[:user]['statusCompId']
|
1
3
|
json_ui_response json do |action|
|
2
|
-
action.
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
material: {
|
12
|
-
name: 'verified'
|
13
|
-
}
|
4
|
+
action.components_set \
|
5
|
+
targetId: status_cell,
|
6
|
+
data: {
|
7
|
+
styleClasses: ['success'],
|
8
|
+
material: {
|
9
|
+
name: 'verified'
|
10
|
+
},
|
11
|
+
tooltip: {
|
12
|
+
text: 'Saved'
|
14
13
|
}
|
15
|
-
|
14
|
+
}
|
16
15
|
end
|
@@ -45,7 +45,6 @@ page.scroll childViews: ->(scroll) do
|
|
45
45
|
backgroundColor: '#e2e2e2',
|
46
46
|
import: { submitUrl: json_ui_garage_url(path: 'forms/bulk_edit_post2'), paramName: 'user' },
|
47
47
|
viewHeaders: [
|
48
|
-
{ text: '', id: 'status', minWidth: 24 },
|
49
48
|
{ text: 'Month', id: 'month', importable: true },
|
50
49
|
{ text: 'Electricity usage', id: 'electricity_usage', importable: true },
|
51
50
|
{ text: 'Gas usage', id: 'gas_usage', importable: true },
|
@@ -53,19 +52,16 @@ page.scroll childViews: ->(scroll) do
|
|
53
52
|
],
|
54
53
|
viewCells: [
|
55
54
|
->(view) do
|
56
|
-
view.
|
55
|
+
view.fields_number width: 'matchParent'
|
57
56
|
end,
|
58
57
|
->(view) do
|
59
|
-
view.fields_number width:
|
58
|
+
view.fields_number width: 'matchParent'
|
60
59
|
end,
|
61
60
|
->(view) do
|
62
|
-
view.fields_number width:
|
61
|
+
view.fields_number width: 'matchParent'
|
63
62
|
end,
|
64
63
|
->(view) do
|
65
|
-
view.
|
66
|
-
end,
|
67
|
-
->(view) do
|
68
|
-
view.fields_select options: options
|
64
|
+
view.fields_select width: 'matchParent', options: options
|
69
65
|
end
|
70
66
|
],
|
71
67
|
paramNameForFormData: 'message',
|
@@ -3,34 +3,66 @@ json.title 'Tables'
|
|
3
3
|
page = json_ui_page json
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
page.
|
7
|
-
->(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
scroll.panels_form childViews: ->(form) do
|
8
|
+
form.panels_table styleClass: 'table--grid', sections: [
|
9
|
+
->(section) do
|
10
|
+
section.header cellViews: ->(header) do
|
11
|
+
header.panels_horizontal childViews: ->(horizontal) do
|
12
|
+
horizontal.fields_check name: 'check_all', checkValue: 1, value: 0, onChange: ->(action) do
|
13
|
+
check_ids = (0..2).map { |i| "item_#{i}" }
|
14
|
+
action.logics_set targetIds: check_ids, conditionalData: {
|
15
|
+
value: { 'var': 'check_all' }
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
header.label text: 'Vertical'
|
20
|
+
header.label text: 'Horizontal'
|
21
|
+
header.label text: 'Unordered List'
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
items = [1, 2, 3]
|
25
|
+
section.rows objects: items, builder: ->(row, item, index) do
|
26
|
+
row.default colStyles: [{ width: 200, backgroundColor: '#eeeeee' }], cellViews: ->(cell) do
|
27
|
+
cell.panels_horizontal childViews: ->(horizontal) do
|
28
|
+
horizontal.fields_check \
|
29
|
+
id: "item_#{index}",
|
30
|
+
name: 'user[items][]',
|
31
|
+
checkValue: index, # In the real-world, this is going to be the ID of a DB record.
|
32
|
+
onChange: ->(action) do
|
33
|
+
# TODO: Fix fields_check so it can support arrays
|
34
|
+
action.logics_set targetId: 'submit_button', conditionalData: {
|
35
|
+
text: {
|
36
|
+
'printf': [
|
37
|
+
'Submit {0} items',
|
38
|
+
{ 'countNonNull': [{ 'var': 'user[items]' }] }
|
39
|
+
]
|
40
|
+
}
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
cell.panels_vertical childViews: ->(vertical) do
|
46
|
+
vertical.h3 text: "Title #{item}"
|
47
|
+
vertical.spacer height: 4
|
48
|
+
vertical.label text: "Subtitle #{item}"
|
49
|
+
end
|
28
50
|
|
29
|
-
|
30
|
-
|
31
|
-
|
51
|
+
cell.panels_horizontal childViews: ->(vertical) do
|
52
|
+
vertical.label text: "Left #{item}"
|
53
|
+
vertical.spacer width: 10
|
54
|
+
vertical.label text: "Right #{item}"
|
55
|
+
end
|
56
|
+
|
57
|
+
cell.panels_ul childViews: ->(ul) do
|
58
|
+
ul.label text: "Item A#{item}"
|
59
|
+
ul.label text: "Item B#{item}"
|
60
|
+
end
|
61
|
+
end
|
32
62
|
end
|
33
63
|
end
|
34
|
-
|
64
|
+
]
|
65
|
+
|
66
|
+
form.fields_submit id: 'submit_button', text: 'Submit'
|
35
67
|
end
|
36
|
-
|
68
|
+
end
|