activeadmin_addons 0.8.0 → 0.9.0
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: 339767451d690dce0857728e0b000055c3d20a3e
|
4
|
+
data.tar.gz: 33a38a21e81194a21ba00d9ab5d0d4d148dcec37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f5b389bc1614ba65c83aa4393541981fd6b8731b8b45f629b5491515c89ec34a9ab723c21a8d883c9ce5d5d7a9d0048c3770f806c09cf0d5c6f76dbc241bdf2
|
7
|
+
data.tar.gz: 2a8036767416393893109731f0062ef18039585cafff10c2c4e0556f2cec35ffc4076b1a9d059db6ae71b266cc7f9fe410d42b3aeb3371254e01991173ba56d8
|
@@ -65,6 +65,7 @@ $(function() {
|
|
65
65
|
var displayName = $(el).data('display_name');
|
66
66
|
var parent = $(el).data('parent');
|
67
67
|
var model = $(el).data('model');
|
68
|
+
var responseRoot = $(el).data('response_root');
|
68
69
|
var collection = $(el).data('collection');
|
69
70
|
var minimumInputLength = $(el).data('minimum_input_length');
|
70
71
|
var order = fields[0] + '_desc';
|
@@ -96,6 +97,10 @@ $(function() {
|
|
96
97
|
return query;
|
97
98
|
},
|
98
99
|
results: function(data, page) {
|
100
|
+
if(data.constructor == Object) {
|
101
|
+
data = data[responseRoot];
|
102
|
+
}
|
103
|
+
|
99
104
|
return {
|
100
105
|
results: jQuery.map(data, function(resource) {
|
101
106
|
return {
|
@@ -75,6 +75,7 @@ class NestedSelectInput < Formtastic::Inputs::StringInput
|
|
75
75
|
|
76
76
|
opts["id"] = build_select_id(attribute)
|
77
77
|
opts["data-url"] = get_option(level, :url, build_url(attribute))
|
78
|
+
opts["data-response_root"] = (level[:response_root] || opts["data-url"].to_s.split('/').last)
|
78
79
|
opts["data-selected"] = instance.try(opts["data-display_name"])
|
79
80
|
|
80
81
|
opts.merge(select_html_parent_options(level[:parent_attribute]))
|
@@ -5,6 +5,7 @@ class SearchSelectInput < Formtastic::Inputs::StringInput
|
|
5
5
|
opts[:class] = ['select2-ajax'].concat([@options[:class]] || []).join(' ')
|
6
6
|
opts["data-fields"] = (@options[:fields] || []).to_json
|
7
7
|
opts["data-url"] = @options[:url] || ""
|
8
|
+
opts["data-response_root"] = @options[:response_root] || @options[:url].to_s.split('/').last
|
8
9
|
opts["data-display_name"] = @options[:display_name] || "name"
|
9
10
|
opts["data-minimum_input_length"] = @options[:minimum_input_length] || 1
|
10
11
|
opts["data-selected"] = relation.try(opts["data-display_name"].to_sym)
|