glib-web 0.4.49 → 0.4.50
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2879893523ba9889fedf7a2bcd3e51958a99ad7
|
4
|
+
data.tar.gz: 0e6f5cf4958c64131c2194cdc9bc76b9d6d63ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5726baf5d47827701fafb0966161ff9650a49cab9ce60322d19a2d8ed23ab8f5ab33b58bf1927e67198bbb0797135f0cbca5a164a751f12f6bab0c175741d9a6
|
7
|
+
data.tar.gz: c906379501cd1be2ff58f881583e1e4471109eb343d8ac41ece00d6a8d78b0cf4015711480a111901ed23b8ca7fe9c82a7340dbd0f3b60b70bd7ed25c734d588
|
@@ -20,6 +20,7 @@ module Glib
|
|
20
20
|
views :cellViews
|
21
21
|
action :onClick
|
22
22
|
array :colSpans
|
23
|
+
array :colStyles
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
@@ -39,9 +40,9 @@ module Glib
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def rows(options = {})
|
42
|
-
block = options
|
43
|
+
block = options.delete(:builder)
|
43
44
|
json.rows do
|
44
|
-
if (objects = options
|
45
|
+
if (objects = options.delete(:objects))
|
45
46
|
objects.each_with_index do |object, index|
|
46
47
|
block&.call @template, object, index
|
47
48
|
end
|
@@ -49,6 +50,8 @@ module Glib
|
|
49
50
|
block&.call @template
|
50
51
|
end
|
51
52
|
end
|
53
|
+
|
54
|
+
raise "Invalid properties: #{options.keys}" if options.size > 0
|
52
55
|
end
|
53
56
|
|
54
57
|
# def rows(array = nil)
|
@@ -123,7 +123,15 @@ class Glib::JsonUi::ViewBuilder
|
|
123
123
|
array :options
|
124
124
|
bool :readOnly
|
125
125
|
bool :multiple, cache: true
|
126
|
-
bool :manualEntry
|
126
|
+
# bool :manualEntry
|
127
|
+
hash :append
|
128
|
+
end
|
129
|
+
|
130
|
+
class Autocomplete < AbstractField
|
131
|
+
array :options
|
132
|
+
bool :readOnly
|
133
|
+
bool :multiple, cache: true
|
134
|
+
# bool :manualEntry
|
127
135
|
hash :append
|
128
136
|
end
|
129
137
|
|
@@ -2,7 +2,7 @@ json.title 'Forms'
|
|
2
2
|
|
3
3
|
json_ui_page json do |page|
|
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
7
|
|
8
8
|
form.spacer height: 20
|
@@ -18,35 +18,50 @@ json_ui_page json do |page|
|
|
18
18
|
form.fields_select name: 'user[cities][]', width: 'matchParent', label: 'Preferred Languages', options: languages.map { |k, v| { value: k, text: v } }, value: ['melbourne', 'sydney'], multiple: true
|
19
19
|
|
20
20
|
form.spacer height: 20
|
21
|
-
form.h2 text: 'Select fields with
|
22
|
-
form.spacer height: 6
|
23
|
-
skills = ['Singing', 'Dancing', 'Fighting']
|
24
|
-
form.fields_select name: 'user[skill]', width: 'matchParent', label: 'Skill', options: skills, value: 'Singing', manualEntry: true
|
25
|
-
form.fields_select name: 'user[skills][]', width: 'matchParent', label: 'Skills', options: skills, value: ['Dancing', 'Fencing'], multiple: true, manualEntry: true
|
26
|
-
|
27
|
-
form.spacer height: 20
|
28
|
-
form.h2 text: 'Select fields with auto complete'
|
21
|
+
form.h2 text: 'Select fields with grouping'
|
29
22
|
form.spacer height: 6
|
30
23
|
form.label text: 'Applicable to select fields with many options'
|
31
24
|
form.spacer height: 6
|
32
|
-
|
25
|
+
|
33
26
|
languages = {
|
34
|
-
"
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
"
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"
|
44
|
-
|
45
|
-
|
46
|
-
|
27
|
+
"East Asia" => {
|
28
|
+
"zh" => "Chinese",
|
29
|
+
"ja" => "Japanese",
|
30
|
+
"ko" => "Korean",
|
31
|
+
},
|
32
|
+
"Middle East" => {
|
33
|
+
"ar" => 'Arabic',
|
34
|
+
"hi" => "Hindi",
|
35
|
+
},
|
36
|
+
"Europe" => {
|
37
|
+
"nl" => "Dutch",
|
38
|
+
"en" => "English",
|
39
|
+
"fr" => "French",
|
40
|
+
"de" => "German",
|
41
|
+
"it" => "Italian",
|
42
|
+
"pt" => "Portuguese",
|
43
|
+
"es" => "Spanish",
|
44
|
+
},
|
45
|
+
"Eastern Europe" => {
|
46
|
+
"ru" => "Russian",
|
47
|
+
}
|
47
48
|
}
|
48
|
-
|
49
|
-
|
49
|
+
options = []
|
50
|
+
languages.each do |group, sub|
|
51
|
+
options << { type: 'label', text: group }
|
52
|
+
options.concat(sub.map { |k, v| { value: k, text: v } })
|
53
|
+
options << { type: 'divider' }
|
54
|
+
end
|
55
|
+
|
56
|
+
form.fields_select name: 'user[language]', width: 'matchParent', label: 'Primary Language', options: options, value: 'nl'
|
57
|
+
form.fields_select name: 'user[languages][]', width: 'matchParent', label: 'Primary Language', options: options, value: ['ja', 'de'], multiple: true
|
58
|
+
|
59
|
+
form.spacer height: 20
|
60
|
+
form.h2 text: 'Autocomplete (select with manual entry)'
|
61
|
+
form.spacer height: 6
|
62
|
+
skills = ['Singing', 'Dancing', 'Fighting']
|
63
|
+
form.fields_autocomplete name: 'user[skill]', width: 'matchParent', label: 'Skill', options: skills, value: 'Singing'
|
64
|
+
form.fields_autocomplete name: 'user[skills][]', width: 'matchParent', label: 'Skills', options: skills, value: ['Dancing', 'Fencing'], multiple: true
|
50
65
|
|
51
66
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
52
67
|
|
@@ -24,7 +24,7 @@ json_ui_page json do |page|
|
|
24
24
|
|
25
25
|
items = [1, 2, 3]
|
26
26
|
section.rows objects: items, builder: ->(row, item, index) do
|
27
|
-
row.default cellViews: ->(cell) do
|
27
|
+
row.default colStyles: [{ width: 200, backgroundColor: '#eeeeee' }], cellViews: ->(cell) do
|
28
28
|
column_indexes.each do |i|
|
29
29
|
cell.label text: "Data #{item}"
|
30
30
|
end
|