activeadmin_addons 0.2.6 → 0.2.7

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: 6b07ada844c58bb9c3d4ea159936036ec72bb3c6
4
- data.tar.gz: 43034c21385e90504f8ac1a7a36e44b4e5cf24f7
3
+ metadata.gz: 1110538781573fbe7162c64b28bfcb58018505c4
4
+ data.tar.gz: 51fad730b2eb10c3c0c1dc810813556abe53d52f
5
5
  SHA512:
6
- metadata.gz: ff61a99492333012a68715dce2277752f44e27213df2cafee1ecd3aa2e1d446b16077119b684d101d5fc879e193fd48f4ac19a7848848981e782f81b15c57f0a
7
- data.tar.gz: 38278fad95d29aad03517020c30fc72b7683314495ff0e36ab5d49f002f78109b23d372c88ecda5c2cfa411a0b7cc070a556f4369eed21b0d584c266fb25b418
6
+ metadata.gz: 0024e1722cb4a43d3a918e34dc22e8f12a3576ed5db1f626b9972ebb8a5cf67175a5e3ac4541096efb8af558df689b787aabe257fe92057a252b66e3f8d2900d
7
+ data.tar.gz: d0de9005c672a8a642830b91a389163231e3c3f1c2d529e4f00e955e23c12d7bbb54c87fa87ccf46a3f06ab2bc422295b24bde870f1ebab8c40f1cafaac0f33f
@@ -3,70 +3,76 @@
3
3
 
4
4
  $(function() {
5
5
 
6
- $('.select2-tags').each(function(i, el) {
7
- $(el).select2({
8
- width: '80%',
9
- tags: $(el).data('collection')
10
- });
11
- });
6
+ setupSelect2();
12
7
 
13
- $('select:not(.default-select)').each(function(i, el) {
14
- if ($(el).closest('.filter_form').length > 0) {
15
- $(el).select2({
16
- width: 'resolve'
17
- });
18
- } else {
8
+ $(document).on('has_many_add:after', setupSelect2);
9
+
10
+ function setupSelect2() {
11
+ $('.select2-tags').each(function(i, el) {
19
12
  $(el).select2({
20
- width: '80%'
13
+ width: '80%',
14
+ tags: $(el).data('collection')
21
15
  });
22
- }
23
- });
24
-
25
- $('.select2-ajax').each(function(i, el) {
26
- var url = $(el).data('url');
27
- var fields = $(el).data('fields');
28
- var displayName = $(el).data('display_name');
29
- var order = fields[0] + "_desc";
16
+ });
30
17
 
31
- $(el).select2({
32
- width: '80%',
33
- initSelection: function(element, callback) {
34
- var id = $(element).val();
35
- var text = $(element).data("selected") || "";
36
- callback({
37
- id: id,
38
- text: text
18
+ $('select:not(.default-select)').each(function(i, el) {
19
+ if ($(el).closest('.filter_form').length > 0) {
20
+ $(el).select2({
21
+ width: 'resolve'
39
22
  });
40
- },
41
- ajax: {
42
- url: url,
43
- dataType: 'json',
44
- delay: 250,
45
- data: function (term) {
46
- var query = {m: "or"};
47
- fields.forEach(function(field) {
48
- query[field + "_contains"] = term;
49
- });
23
+ } else {
24
+ $(el).select2({
25
+ width: '80%'
26
+ });
27
+ }
28
+ });
50
29
 
51
- return {
52
- order: order,
53
- q: query
54
- };
30
+ $('.select2-ajax').each(function(i, el) {
31
+ var url = $(el).data('url');
32
+ var fields = $(el).data('fields');
33
+ var displayName = $(el).data('display_name');
34
+ var order = fields[0] + "_desc";
35
+
36
+ $(el).select2({
37
+ width: '80%',
38
+ initSelection: function(element, callback) {
39
+ var id = $(element).val();
40
+ var text = $(element).data("selected") || "";
41
+ callback({
42
+ id: id,
43
+ text: text
44
+ });
55
45
  },
56
- results: function (data, page) {
57
- return {
58
- results: jQuery.map(data, function(resource) {
59
- return {
60
- id: resource.id,
61
- text: resource[displayName]
62
- }
63
- })
64
- };
46
+ ajax: {
47
+ url: url,
48
+ dataType: 'json',
49
+ delay: 250,
50
+ data: function (term) {
51
+ var query = {m: "or"};
52
+ fields.forEach(function(field) {
53
+ query[field + "_contains"] = term;
54
+ });
55
+
56
+ return {
57
+ order: order,
58
+ q: query
59
+ };
60
+ },
61
+ results: function (data, page) {
62
+ return {
63
+ results: jQuery.map(data, function(resource) {
64
+ return {
65
+ id: resource.id,
66
+ text: resource[displayName]
67
+ };
68
+ })
69
+ };
70
+ },
71
+ cache: true
65
72
  },
66
- cache: true
67
- },
68
- minimumInputLength: 1
73
+ minimumInputLength: 1
74
+ });
69
75
  });
70
- });
76
+ }
71
77
 
72
78
  });
@@ -1,3 +1,3 @@
1
1
  module ActiveadminAddons
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_addons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platanus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-30 00:00:00.000000000 Z
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -101,6 +101,8 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - MIT-LICENSE
105
+ - Rakefile
104
106
  - app/assets/images/fileicons/file_extension_3gp.png
105
107
  - app/assets/images/fileicons/file_extension_7z.png
106
108
  - app/assets/images/fileicons/file_extension_ace.png
@@ -209,6 +211,7 @@ files:
209
211
  - app/assets/stylesheets/activeadmin_addons/all.css.scss
210
212
  - app/inputs/search_select_input.rb
211
213
  - app/inputs/tags_input.rb
214
+ - lib/activeadmin_addons.rb
212
215
  - lib/activeadmin_addons/addons/bool_values.rb
213
216
  - lib/activeadmin_addons/addons/enum_tag.rb
214
217
  - lib/activeadmin_addons/addons/list.rb
@@ -220,10 +223,7 @@ files:
220
223
  - lib/activeadmin_addons/support/enumerize_formtastic_support.rb
221
224
  - lib/activeadmin_addons/support/set_datepicker.rb
222
225
  - lib/activeadmin_addons/version.rb
223
- - lib/activeadmin_addons.rb
224
226
  - lib/tasks/activeadmin_addons_tasks.rake
225
- - MIT-LICENSE
226
- - Rakefile
227
227
  homepage: https://github.com/platanus/activeadmin_addons
228
228
  licenses:
229
229
  - MIT
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  requirements: []
246
246
  rubyforge_project:
247
- rubygems_version: 2.0.14
247
+ rubygems_version: 2.4.8
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: Set of addons to help with the activeadmin ui