blacklight-spotlight 4.7.1 → 5.0.0.pre.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -12
- data/Rakefile +8 -1
- data/app/assets/javascripts/spotlight/application.js +0 -1
- data/app/assets/javascripts/spotlight/spotlight.esm.js +3620 -3847
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +3620 -3852
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/assets/stylesheets/spotlight/_accessibility.scss +0 -9
- data/app/assets/stylesheets/spotlight/_autocomplete.scss +49 -0
- data/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +0 -1
- data/app/assets/stylesheets/spotlight/_blacklight_overrides.scss +1 -6
- data/app/assets/stylesheets/spotlight/_browse.scss +2 -2
- data/app/assets/stylesheets/spotlight/_catalog.scss +40 -41
- data/app/assets/stylesheets/spotlight/_curation.scss +1 -1
- data/app/assets/stylesheets/spotlight/_exhibit_admin.scss +7 -0
- data/app/assets/stylesheets/spotlight/_exhibits_index.scss +8 -5
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +3 -3
- data/app/assets/stylesheets/spotlight/_header.scss +13 -0
- data/app/assets/stylesheets/spotlight/_mixins.scss +3 -4
- data/app/assets/stylesheets/spotlight/_nestable.scss +2 -12
- data/app/assets/stylesheets/spotlight/_pages.scss +11 -9
- data/app/assets/stylesheets/spotlight/_report_a_problem.scss +1 -3
- data/app/assets/stylesheets/spotlight/_sir-trevor_overrides.scss +2 -2
- data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -1
- data/app/assets/stylesheets/spotlight/_tag_selector.scss +34 -0
- data/app/assets/stylesheets/spotlight/_variables.scss +0 -8
- data/app/components/spotlight/analytics/dashboard_component.html.erb +3 -3
- data/app/components/spotlight/breadcrumbs_component.html.erb +13 -19
- data/app/components/spotlight/bulk_action_component.rb +1 -1
- data/app/components/spotlight/document_component.rb +1 -1
- data/app/components/spotlight/save_search_component.rb +1 -1
- data/app/components/spotlight/select_image_component.html.erb +17 -0
- data/app/components/spotlight/select_image_component.rb +24 -0
- data/app/components/spotlight/skip_link_component.rb +16 -0
- data/app/components/spotlight/tag_selector_component.html.erb +40 -0
- data/app/components/spotlight/tag_selector_component.rb +41 -0
- data/app/components/spotlight/tag_selector_component.yml +6 -0
- data/app/components/spotlight/title_component.html.erb +8 -0
- data/app/components/spotlight/title_component.rb +22 -0
- data/app/controllers/spotlight/accessibility_controller.rb +2 -2
- data/app/controllers/spotlight/catalog_controller.rb +7 -2
- data/app/controllers/spotlight/contact_email_controller.rb +8 -2
- data/app/controllers/spotlight/languages_controller.rb +9 -4
- data/app/helpers/spotlight/application_helper.rb +7 -0
- data/app/helpers/spotlight/crop_helper.rb +4 -0
- data/app/helpers/spotlight/meta_helper.rb +59 -36
- data/app/javascript/spotlight/admin/blacklight_configuration.js +1 -1
- data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +70 -34
- data/app/javascript/spotlight/admin/blocks/block.js +1 -0
- data/app/javascript/spotlight/admin/blocks/browse_block.js +8 -12
- data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +14 -18
- data/app/javascript/spotlight/admin/blocks/pages_block.js +6 -10
- data/app/javascript/spotlight/admin/blocks/resources_block.js +33 -15
- data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +11 -6
- data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +1 -0
- data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +4 -3
- data/app/javascript/spotlight/admin/copy_email_addresses.js +2 -0
- data/app/javascript/spotlight/admin/crop.js +45 -17
- data/app/javascript/spotlight/admin/croppable.js +8 -1
- data/app/javascript/spotlight/admin/croppable_modal.js +68 -0
- data/app/javascript/spotlight/admin/exhibits.js +15 -10
- data/app/javascript/spotlight/admin/form_observer.js +1 -1
- data/app/javascript/spotlight/admin/index.js +0 -10
- data/app/javascript/spotlight/admin/locks.js +15 -5
- data/app/javascript/spotlight/admin/pages.js +1 -1
- data/app/javascript/spotlight/admin/search_typeahead.js +62 -55
- data/app/javascript/spotlight/admin/spotlight_nestable.js +173 -50
- data/app/javascript/spotlight/admin/visibility_toggle.js +1 -11
- data/app/javascript/spotlight/controllers/index.js +8 -0
- data/app/javascript/spotlight/controllers/tag_selector_controller.js +203 -0
- data/app/javascript/spotlight/core.js +4 -6
- data/app/javascript/spotlight/index.js +2 -0
- data/app/javascript/spotlight/user/browse_group_categories.js +2 -0
- data/app/javascript/spotlight/user/carousel.js +3 -1
- data/app/javascript/spotlight/user/index.js +0 -2
- data/app/models/sir_trevor_rails/block.rb +5 -4
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/solr_documents_embed_block.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/uploaded_items_block.rb +1 -1
- data/app/models/spotlight/page_configurations.rb +1 -1
- data/app/views/catalog/_add_tags.html.erb +2 -2
- data/app/views/catalog/_change_visibility.html.erb +1 -1
- data/app/views/catalog/_remove_tags.html.erb +2 -2
- data/app/views/layouts/spotlight/base.html.erb +24 -13
- data/app/views/layouts/spotlight/spotlight.html.erb +6 -6
- data/app/views/shared/_masthead.html.erb +4 -31
- data/app/views/shared/_site_sidebar.html.erb +1 -1
- data/app/views/shared/_user_util_links.html.erb +3 -1
- data/app/views/spotlight/accessibility/alt_text.html.erb +2 -2
- data/app/views/spotlight/admin_users/index.html.erb +3 -3
- data/app/views/spotlight/appearances/edit.html.erb +1 -1
- data/app/views/spotlight/browse/_search_box.html.erb +8 -8
- data/app/views/spotlight/browse/show.html.erb +1 -1
- data/app/views/spotlight/bulk_updates/_download.html.erb +1 -1
- data/app/views/spotlight/bulk_updates/_upload.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_header.html.erb +1 -1
- data/app/views/spotlight/catalog/_edit_default.html.erb +2 -1
- data/app/views/spotlight/catalog/select_image.html.erb +1 -0
- data/app/views/spotlight/contacts/_form.html.erb +1 -1
- data/app/views/spotlight/exhibits/_contact.html.erb +5 -6
- data/app/views/spotlight/exhibits/_delete.html.erb +1 -1
- data/app/views/spotlight/exhibits/_languages.html.erb +3 -2
- data/app/views/spotlight/featured_images/_form.html.erb +6 -2
- data/app/views/spotlight/featured_images/_upload_form.html.erb +1 -1
- data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +1 -1
- data/app/views/spotlight/metadata_configurations/edit.html.erb +6 -6
- data/app/views/spotlight/pages/show.html.erb +1 -1
- data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
- data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
- data/app/views/spotlight/roles/index.html.erb +1 -1
- data/app/views/spotlight/searches/_form.html.erb +1 -1
- data/app/views/spotlight/shared/_dd3_item.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +1 -1
- data/app/views/spotlight/tags/index.html.erb +2 -3
- data/app/views/spotlight/translations/_import.html.erb +2 -2
- data/config/importmap.rb +5 -0
- data/config/locales/spotlight.en.yml +2 -0
- data/config/routes.rb +5 -3
- data/lib/generators/spotlight/assets/generator_common_utilities.rb +36 -0
- data/lib/generators/spotlight/assets/importmap_generator.rb +87 -0
- data/lib/generators/spotlight/assets/propshaft_generator.rb +96 -0
- data/lib/generators/spotlight/assets_generator.rb +22 -0
- data/lib/generators/spotlight/install_generator.rb +8 -36
- data/lib/generators/spotlight/scaffold_resource_generator.rb +1 -1
- data/lib/generators/spotlight/templates/assets/spotlight.scss +6 -0
- data/lib/generators/spotlight/templates/javascript/jquery-shim.js +1 -0
- data/lib/spotlight/engine.rb +7 -6
- data/lib/spotlight/version.rb +1 -1
- data/spec/support/features/capybara_wait_metadata_helper.rb +13 -0
- data/spec/support/features/test_features_helpers.rb +16 -30
- data/vendor/assets/javascripts/tiny-slider.js +3 -0
- metadata +35 -87
- data/app/assets/stylesheets/spotlight/#_accessibility.scss# +0 -12
- data/app/javascript/spotlight/admin/checkbox_submit.js +0 -75
- data/app/javascript/spotlight/admin/exhibit_tag_autocomplete.js +0 -39
- data/app/javascript/spotlight/user/report_a_problem.js +0 -30
- data/app/views/spotlight/browse/_tophat.html.erb +0 -1
- data/app/views/spotlight/catalog/_tophat_default.html.erb +0 -1
- data/app/views/spotlight/home_pages/_tophat.html.erb +0 -2
- data/app/views/spotlight/pages/_tophat.html.erb +0 -1
- data/lib/generators/spotlight/templates/spotlight.js +0 -1
- data/lib/generators/spotlight/templates/spotlight.scss +0 -5
- data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +0 -20
- data/vendor/assets/javascripts/bootstrap-tagsinput.js +0 -530
- data/vendor/assets/javascripts/jquery.serializejson.js +0 -234
- data/vendor/assets/javascripts/nestable.js +0 -645
- data/vendor/assets/javascripts/sir-trevor.js +0 -23508
- data/vendor/assets/javascripts/typeahead.bundle.min.js +0 -7
- data/vendor/assets/stylesheets/bootstrap-tagsinput.css +0 -46
@@ -1,234 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
SerializeJSON jQuery plugin.
|
3
|
-
https://github.com/marioizquierdo/jquery.serializeJSON
|
4
|
-
version 2.4.2 (Oct, 2014)
|
5
|
-
|
6
|
-
Copyright (c) 2014 Mario Izquierdo
|
7
|
-
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
8
|
-
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
9
|
-
*/
|
10
|
-
(function ($) {
|
11
|
-
"use strict";
|
12
|
-
|
13
|
-
// jQuery('form').serializeJSON()
|
14
|
-
$.fn.serializeJSON = function (options) {
|
15
|
-
var serializedObject, formAsArray, keys, type, value, _ref, f, opts;
|
16
|
-
f = $.serializeJSON;
|
17
|
-
opts = f.optsWithDefaults(options); // calculate values for options {parseNumbers, parseBoolens, parseNulls}
|
18
|
-
f.validateOptions(opts);
|
19
|
-
formAsArray = this.serializeArray(); // array of objects {name, value}
|
20
|
-
f.readCheckboxUncheckedValues(formAsArray, this, opts); // add {name, value} of unchecked checkboxes if needed
|
21
|
-
|
22
|
-
serializedObject = {};
|
23
|
-
$.each(formAsArray, function (i, input) {
|
24
|
-
keys = f.splitInputNameIntoKeysArray(input.name);
|
25
|
-
type = keys.pop(); // the last element is always the type ("string" by default)
|
26
|
-
if (type !== 'skip') { // easy way to skip a value
|
27
|
-
value = f.parseValue(input.value, type, opts); // string, number, boolean or null
|
28
|
-
if (opts.parseWithFunction && type === '_') value = opts.parseWithFunction(value, input.name); // allow for custom parsing
|
29
|
-
f.deepSet(serializedObject, keys, value, opts);
|
30
|
-
}
|
31
|
-
});
|
32
|
-
return serializedObject;
|
33
|
-
};
|
34
|
-
|
35
|
-
// Use $.serializeJSON as namespace for the auxiliar functions
|
36
|
-
// and to define defaults
|
37
|
-
$.serializeJSON = {
|
38
|
-
|
39
|
-
defaultOptions: {
|
40
|
-
parseNumbers: false, // convert values like "1", "-2.33" to 1, -2.33
|
41
|
-
parseBooleans: false, // convert "true", "false" to true, false
|
42
|
-
parseNulls: false, // convert "null" to null
|
43
|
-
parseAll: false, // all of the above
|
44
|
-
parseWithFunction: null, // to use custom parser, a function like: function(val){ return parsed_val; }
|
45
|
-
checkboxUncheckedValue: undefined, // to include that value for unchecked checkboxes (instead of ignoring them)
|
46
|
-
useIntKeysAsArrayIndex: false // name="foo[2]" value="v" => {foo: [null, null, "v"]}, instead of {foo: ["2": "v"]}
|
47
|
-
},
|
48
|
-
|
49
|
-
// Merge options with defaults to get {parseNumbers, parseBoolens, parseNulls, useIntKeysAsArrayIndex}
|
50
|
-
optsWithDefaults: function(options) {
|
51
|
-
var f, parseAll;
|
52
|
-
if (options == null) options = {}; // arg default value = {}
|
53
|
-
f = $.serializeJSON;
|
54
|
-
parseAll = f.optWithDefaults('parseAll', options);
|
55
|
-
return {
|
56
|
-
parseNumbers: parseAll || f.optWithDefaults('parseNumbers', options),
|
57
|
-
parseBooleans: parseAll || f.optWithDefaults('parseBooleans', options),
|
58
|
-
parseNulls: parseAll || f.optWithDefaults('parseNulls', options),
|
59
|
-
parseWithFunction: f.optWithDefaults('parseWithFunction', options),
|
60
|
-
checkboxUncheckedValue: f.optWithDefaults('checkboxUncheckedValue', options),
|
61
|
-
useIntKeysAsArrayIndex: f.optWithDefaults('useIntKeysAsArrayIndex', options)
|
62
|
-
}
|
63
|
-
},
|
64
|
-
|
65
|
-
optWithDefaults: function(key, options) {
|
66
|
-
return (options[key] !== false) && (options[key] !== '') && (options[key] || $.serializeJSON.defaultOptions[key]);
|
67
|
-
},
|
68
|
-
|
69
|
-
validateOptions: function(opts) {
|
70
|
-
var opt, validOpts;
|
71
|
-
validOpts = ['parseNumbers', 'parseBooleans', 'parseNulls', 'parseAll', 'parseWithFunction', 'checkboxUncheckedValue', 'useIntKeysAsArrayIndex']
|
72
|
-
for (opt in opts) {
|
73
|
-
if (validOpts.indexOf(opt) === -1) {
|
74
|
-
throw new Error("serializeJSON ERROR: invalid option '" + opt + "'. Please use one of " + validOpts.join(','));
|
75
|
-
}
|
76
|
-
}
|
77
|
-
},
|
78
|
-
|
79
|
-
// Convert the string to a number, boolean or null, depending on the enable option and the string format.
|
80
|
-
parseValue: function(str, type, opts) {
|
81
|
-
var value, f;
|
82
|
-
f = $.serializeJSON;
|
83
|
-
if (type == 'string') return str; // force string
|
84
|
-
if (type == 'number' || (opts.parseNumbers && f.isNumeric(str))) return Number(str); // number
|
85
|
-
if (type == 'boolean' || (opts.parseBooleans && (str === "true" || str === "false"))) return (["false", "null", "undefined", "", "0"].indexOf(str) === -1); // boolean
|
86
|
-
if (type == 'null' || (opts.parseNulls && str == "null")) return ["false", "null", "undefined", "", "0"].indexOf(str) !== -1 ? null : str; // null
|
87
|
-
if (type == 'array' || type == 'object') return JSON.parse(str); // array or objects require JSON
|
88
|
-
if (type == 'auto') return f.parseValue(str, null, {parseNumbers: true, parseBooleans: true, parseNulls: true}); // try again with something like "parseAll"
|
89
|
-
return str; // otherwise, keep same string
|
90
|
-
},
|
91
|
-
|
92
|
-
isObject: function(obj) { return obj === Object(obj); }, // is this variable an object?
|
93
|
-
isUndefined: function(obj) { return obj === void 0; }, // safe check for undefined values
|
94
|
-
isValidArrayIndex: function(val) { return /^[0-9]+$/.test(String(val)); }, // 1,2,3,4 ... are valid array indexes
|
95
|
-
isNumeric: function(obj) { return obj - parseFloat(obj) >= 0; }, // taken from jQuery.isNumeric implementation. Not using jQuery.isNumeric to support old jQuery and Zepto versions
|
96
|
-
|
97
|
-
// Split the input name in programatically readable keys.
|
98
|
-
// The last element is always the type (default "_").
|
99
|
-
// Examples:
|
100
|
-
// "foo" => ['foo', '_']
|
101
|
-
// "foo:string" => ['foo', 'string']
|
102
|
-
// "foo:boolean" => ['foo', 'boolean']
|
103
|
-
// "[foo]" => ['foo', '_']
|
104
|
-
// "foo[inn][bar]" => ['foo', 'inn', 'bar', '_']
|
105
|
-
// "foo[inn[bar]]" => ['foo', 'inn', 'bar', '_']
|
106
|
-
// "foo[inn][arr][0]" => ['foo', 'inn', 'arr', '0', '_']
|
107
|
-
// "arr[][val]" => ['arr', '', 'val', '_']
|
108
|
-
// "arr[][val]:null" => ['arr', '', 'val', 'null']
|
109
|
-
splitInputNameIntoKeysArray: function (name) {
|
110
|
-
var keys, nameWithoutType, type, _ref, f;
|
111
|
-
f = $.serializeJSON;
|
112
|
-
_ref = f.extractTypeFromInputName(name), nameWithoutType = _ref[0], type = _ref[1];
|
113
|
-
keys = nameWithoutType.split('['); // split string into array
|
114
|
-
keys = $.map(keys, function (key) { return key.replace(/]/g, ''); }); // remove closing brackets
|
115
|
-
if (keys[0] === '') { keys.shift(); } // ensure no opening bracket ("[foo][inn]" should be same as "foo[inn]")
|
116
|
-
keys.push(type); // add type at the end
|
117
|
-
return keys;
|
118
|
-
},
|
119
|
-
|
120
|
-
// Returns [name-without-type, type] from name.
|
121
|
-
// "foo" => ["foo", "_"]
|
122
|
-
// "foo:boolean" => ["foo", "boolean"]
|
123
|
-
// "foo[bar]:null" => ["foo[bar]", "null"]
|
124
|
-
extractTypeFromInputName: function(name) {
|
125
|
-
var match, f;
|
126
|
-
f = $.serializeJSON;
|
127
|
-
if (match = name.match(/(.*):([^:]+)$/)){
|
128
|
-
var validTypes = ['string', 'number', 'boolean', 'null', 'array', 'object', 'skip', 'auto']; // validate type
|
129
|
-
if (validTypes.indexOf(match[2]) !== -1) {
|
130
|
-
return [match[1], match[2]];
|
131
|
-
} else {
|
132
|
-
throw new Error("serializeJSON ERROR: Invalid type " + match[2] + " found in input name '" + name + "', please use one of " + validTypes.join(', '))
|
133
|
-
}
|
134
|
-
} else {
|
135
|
-
return [name, '_']; // no defined type, then use parse options
|
136
|
-
}
|
137
|
-
},
|
138
|
-
|
139
|
-
// Set a value in an object or array, using multiple keys to set in a nested object or array:
|
140
|
-
//
|
141
|
-
// deepSet(obj, ['foo'], v) // obj['foo'] = v
|
142
|
-
// deepSet(obj, ['foo', 'inn'], v) // obj['foo']['inn'] = v // Create the inner obj['foo'] object, if needed
|
143
|
-
// deepSet(obj, ['foo', 'inn', '123'], v) // obj['foo']['arr']['123'] = v //
|
144
|
-
//
|
145
|
-
// deepSet(obj, ['0'], v) // obj['0'] = v
|
146
|
-
// deepSet(arr, ['0'], v, {useIntKeysAsArrayIndex: true}) // arr[0] = v
|
147
|
-
// deepSet(arr, [''], v) // arr.push(v)
|
148
|
-
// deepSet(obj, ['arr', ''], v) // obj['arr'].push(v)
|
149
|
-
//
|
150
|
-
// arr = [];
|
151
|
-
// deepSet(arr, ['', v] // arr => [v]
|
152
|
-
// deepSet(arr, ['', 'foo'], v) // arr => [v, {foo: v}]
|
153
|
-
// deepSet(arr, ['', 'bar'], v) // arr => [v, {foo: v, bar: v}]
|
154
|
-
// deepSet(arr, ['', 'bar'], v) // arr => [v, {foo: v, bar: v}, {bar: v}]
|
155
|
-
//
|
156
|
-
deepSet: function (o, keys, value, opts) {
|
157
|
-
var key, nextKey, tail, lastIdx, lastVal, f;
|
158
|
-
if (opts == null) opts = {};
|
159
|
-
f = $.serializeJSON;
|
160
|
-
if (f.isUndefined(o)) { throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined"); }
|
161
|
-
if (!keys || keys.length === 0) { throw new Error("ArgumentError: param 'keys' expected to be an array with least one element"); }
|
162
|
-
|
163
|
-
key = keys[0];
|
164
|
-
|
165
|
-
// Only one key, then it's not a deepSet, just assign the value.
|
166
|
-
if (keys.length === 1) {
|
167
|
-
if (key === '') {
|
168
|
-
o.push(value); // '' is used to push values into the array (assume o is an array)
|
169
|
-
} else {
|
170
|
-
o[key] = value; // other keys can be used as object keys or array indexes
|
171
|
-
}
|
172
|
-
|
173
|
-
// With more keys is a deepSet. Apply recursively.
|
174
|
-
} else {
|
175
|
-
|
176
|
-
nextKey = keys[1];
|
177
|
-
|
178
|
-
// '' is used to push values into the array,
|
179
|
-
// with nextKey, set the value into the same object, in object[nextKey].
|
180
|
-
// Covers the case of ['', 'foo'] and ['', 'var'] to push the object {foo, var}, and the case of nested arrays.
|
181
|
-
if (key === '') {
|
182
|
-
lastIdx = o.length - 1; // asume o is array
|
183
|
-
lastVal = o[lastIdx];
|
184
|
-
if (f.isObject(lastVal) && (f.isUndefined(lastVal[nextKey]) || keys.length > 2)) { // if nextKey is not present in the last object element, or there are more keys to deep set
|
185
|
-
key = lastIdx; // then set the new value in the same object element
|
186
|
-
} else {
|
187
|
-
key = lastIdx + 1; // otherwise, point to set the next index in the array
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
// o[key] defaults to object or array, depending if nextKey is an array index (int or '') or an object key (string)
|
192
|
-
if (f.isUndefined(o[key])) {
|
193
|
-
if (nextKey === '') { // '' is used to push values into the array.
|
194
|
-
o[key] = [];
|
195
|
-
} else if (opts.useIntKeysAsArrayIndex && f.isValidArrayIndex(nextKey)) { // if 1, 2, 3 ... then use an array, where nextKey is the index
|
196
|
-
o[key] = [];
|
197
|
-
} else { // for anything else, use an object, where nextKey is going to be the attribute name
|
198
|
-
o[key] = {};
|
199
|
-
}
|
200
|
-
}
|
201
|
-
|
202
|
-
// Recursively set the inner object
|
203
|
-
tail = keys.slice(1);
|
204
|
-
f.deepSet(o[key], tail, value, opts);
|
205
|
-
}
|
206
|
-
},
|
207
|
-
|
208
|
-
// Fill the formAsArray object with values for the unchecked checkbox inputs,
|
209
|
-
// using the same format as the jquery.serializeArray function.
|
210
|
-
// The value of the unchecked values is determined from the opts.checkboxUncheckedValue
|
211
|
-
// and/or the data-unchecked-value attribute of the inputs.
|
212
|
-
readCheckboxUncheckedValues: function (formAsArray, $form, opts) {
|
213
|
-
var selector, $uncheckedCheckboxes, $el, dataUncheckedValue, f;
|
214
|
-
if (opts == null) opts = {};
|
215
|
-
f = $.serializeJSON;
|
216
|
-
|
217
|
-
selector = 'input[type=checkbox][name]:not(:checked,[disabled])';
|
218
|
-
$uncheckedCheckboxes = $form.find(selector).add($form.filter(selector));
|
219
|
-
$uncheckedCheckboxes.each(function (i, el) {
|
220
|
-
$el = $(el);
|
221
|
-
dataUncheckedValue = $el.attr('data-unchecked-value');
|
222
|
-
if(dataUncheckedValue) { // data-unchecked-value has precedence over option opts.checkboxUncheckedValue
|
223
|
-
formAsArray.push({name: el.name, value: dataUncheckedValue});
|
224
|
-
} else {
|
225
|
-
if (!f.isUndefined(opts.checkboxUncheckedValue)) {
|
226
|
-
formAsArray.push({name: el.name, value: opts.checkboxUncheckedValue});
|
227
|
-
}
|
228
|
-
}
|
229
|
-
});
|
230
|
-
}
|
231
|
-
|
232
|
-
};
|
233
|
-
|
234
|
-
}(window.jQuery || window.Zepto || window.$));
|