activeadmin-searchable_select 1.7.0 → 1.8.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
  SHA256:
3
- metadata.gz: afca3ffb2bd7868c51afc6e6793fc4b3080a1fdb0f92a248ccdbe264faa58597
4
- data.tar.gz: defeafa115233119aacc2bde15424810bdd1fd05187c2c48536879586b96b00b
3
+ metadata.gz: 7cfe9f36cf136d370ead8ce6227d00057850a5d4f6ee9520cbed52da1c15a3d8
4
+ data.tar.gz: d5043ace26e5abc0b5a4ee3c58b2fad8243b9cb8c78de93be0013f6c4116b163
5
5
  SHA512:
6
- metadata.gz: 527c21ae72869785419007a81436186684d589e87abc4aeb64213a8fe46af2ca1701e98296f8d2a9c64c756a9331a625aac166994591a57d1c43c70cf277ccb0
7
- data.tar.gz: 71f29f997879afec190f430697d57362dba21802e322b8045d20b247f3c1ef0df8ed8b88b0a84a4e43910dda1ef9221050e8843fac45133b3c9fd15defe028be
6
+ metadata.gz: 912517731c734da5286389411fc658c3de99d336b538b8f9c8e6b28640185bcd3b718d7220c3b91d4a1d70f398b0e43bfe606c61403cd66807d441f89eda668d
7
+ data.tar.gz: 4491ef833bf6b70a2b66008de0507b22ca05dd0d9ff620b76127ec284fd4961c8eb868856ff2f472001d85b904a1e0114509d996c013ff66a81a2f27c8592ee5
@@ -23,6 +23,8 @@ jobs:
23
23
  include:
24
24
  - ruby-version: '3.0'
25
25
  gemfile: gemfiles/rails_6.x_active_admin_2.x.gemfile
26
+ - ruby-version: '3.0'
27
+ gemfile: gemfiles/rails_6.x_active_admin_3.x.gemfile
26
28
 
27
29
  env:
28
30
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
data/Appraisals CHANGED
@@ -16,4 +16,9 @@ end
16
16
  appraise 'rails-6.x-active-admin-2.x' do
17
17
  gem 'rails', '~> 6.1'
18
18
  gem 'activeadmin', '~> 2.0'
19
- end
19
+ end
20
+
21
+ appraise 'rails-6.x-active-admin-3.x' do
22
+ gem 'rails', '~> 6.1'
23
+ gem 'activeadmin', '~> 3.0'
24
+ end
data/CHANGELOG.md CHANGED
@@ -1,17 +1,16 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 1.7.0
3
+ ### Version 1.8.0
4
4
 
5
- 2023-05-03
5
+ 2023-08-17
6
6
 
7
- [Compare changes](https://github.com/codevise/activeadmin-searchable_select/compare/1-6-stable...v1.7.0)
7
+ [Compare changes](https://github.com/codevise/activeadmin-searchable_select/compare/1-7-stable...v1.8.0)
8
8
 
9
- - Fix pre-selected item when using belongs_to
10
- ([#43](https://github.com/codevise/activeadmin-searchable_select/pull/43),
11
- [#44](https://github.com/codevise/activeadmin-searchable_select/pull/44))
12
- - Improvement the examples in Readme for import npm assets
13
- ([#41](https://github.com/codevise/activeadmin-searchable_select/pull/41))
9
+ - Update webdrivers to fix specs for Chrome 115
10
+ ([#47](https://github.com/codevise/activeadmin-searchable_select/pull/47))
11
+ - Add support for Active Admin 3.0
12
+ ([#45](https://github.com/codevise/activeadmin-searchable_select/pull/45))
14
13
 
15
14
  See
16
- [1-6-stable branch](https://github.com/codevise/activeadmin-searchable_select/blob/1-6-stable/CHANGELOG.md)
15
+ [1-7-stable branch](https://github.com/codevise/activeadmin-searchable_select/blob/1-7-stable/CHANGELOG.md)
17
16
  for previous changes.
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/activeadmin-searchable_select.svg)](http://badge.fury.io/rb/activeadmin-searchable_select)
4
4
  [![NPM Version](https://badge.fury.io/js/@codevise%2Factiveadmin-searchable_select.svg)](https://badge.fury.io/js/@codevise%2Factiveadmin-searchable_select)
5
5
  [![npm](https://img.shields.io/npm/dm/@codevise/activeadmin-searchable_select)](https://www.npmjs.com/package/@codevise/activeadmin-searchable_select)
6
- [![Build Status](https://github.com/codevise/activeadmin-searchable_select.svg?branch=master)](https://github.com/codevise/activeadmin-searchable_select/actions)
6
+ [![Build Status](https://github.com/codevise/activeadmin-searchable_select/actions/workflows/tests.yml/badge.svg)](https://github.com/codevise/activeadmin-searchable_select/actions)
7
7
 
8
8
  Searchable select boxes (via [Select2](https://select2.org/)) for
9
9
  ActiveAdmin forms and filters. Extends the ActiveAdmin resource DSL to
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_development_dependency 'capybara', '~> 3.9'
28
28
  spec.add_development_dependency 'puma', '~> 5.0'
29
- spec.add_development_dependency 'selenium-webdriver', '~> 3.6'
30
- spec.add_development_dependency 'webdrivers', '~> 4.0'
29
+ spec.add_development_dependency 'selenium-webdriver', '~> 4.1'
30
+ spec.add_development_dependency 'webdrivers', '= 5.3.0'
31
31
 
32
32
  spec.add_development_dependency 'coffee-rails'
33
33
  spec.add_development_dependency 'rails'
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'semmy', '~> 1.0'
36
36
  spec.add_development_dependency 'sprockets', '~> 3.7'
37
37
 
38
- spec.add_runtime_dependency 'activeadmin', ['>= 1.x', '< 3']
38
+ spec.add_runtime_dependency 'activeadmin', ['>= 1.x', '< 4']
39
39
  spec.add_runtime_dependency 'jquery-rails', ['>= 3.0', '< 5']
40
40
  spec.add_runtime_dependency 'select2-rails', '~> 4.0'
41
41
  end
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sass-rails"
6
+ gem "rails", "~> 6.1"
7
+ gem "activeadmin", "~> 3.0"
8
+
9
+ gemspec path: "../"
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module SearchableSelect
3
- VERSION = '1.7.0'.freeze
3
+ VERSION = '1.8.0'.freeze
4
4
  end
5
5
  end
@@ -4,6 +4,10 @@ class User < ActiveRecord::Base; end
4
4
 
5
5
  class Category < ActiveRecord::Base
6
6
  belongs_to :created_by, class_name: 'User'
7
+
8
+ def self.ransackable_attributes(_auth_object = nil)
9
+ ['name']
10
+ end
7
11
  end
8
12
 
9
13
  class Post < ActiveRecord::Base
@@ -11,6 +15,10 @@ class Post < ActiveRecord::Base
11
15
  belongs_to :user
12
16
 
13
17
  scope(:published, -> { where(published: true) })
18
+
19
+ def self.ransackable_attributes(_auth_object = nil)
20
+ %w(category_id title)
21
+ end
14
22
  end
15
23
 
16
24
  module RGB
@@ -24,6 +32,10 @@ module Internal
24
32
  class TagName < ActiveRecord::Base
25
33
  self.table_name = :internal_tag_names
26
34
  belongs_to :color, class_name: 'RGB::Color', foreign_key: :color_id
35
+
36
+ def self.ransackable_attributes(_auth_object = nil)
37
+ ['color_id']
38
+ end
27
39
  end
28
40
  end
29
41
 
@@ -31,6 +43,10 @@ class OptionType < ActiveRecord::Base; end
31
43
 
32
44
  class OptionValue < ActiveRecord::Base
33
45
  belongs_to :option_type
46
+
47
+ def self.ransackable_attributes(_auth_object = nil)
48
+ ['value']
49
+ end
34
50
  end
35
51
 
36
52
  class Product < ActiveRecord::Base
@@ -0,0 +1,46 @@
1
+ (function() {
2
+ function initSearchableSelects(inputs, extra) {
3
+ inputs.each(function() {
4
+ var item = $(this);
5
+
6
+ // reading from data allows <input data-searchable_select='{"tags": ['some']}'>
7
+ // to be passed to select2
8
+ var options = $.extend(extra || {}, item.data('searchableSelect'));
9
+ var url = item.data('ajaxUrl');
10
+
11
+ if (url) {
12
+ $.extend(options, {
13
+ ajax: {
14
+ url: url,
15
+ dataType: 'json',
16
+
17
+ data: function (params) {
18
+ return {
19
+ term: params.term,
20
+ page: pageParamWithBaseZero(params)
21
+ };
22
+ }
23
+ }
24
+ });
25
+ }
26
+
27
+ item.select2(options);
28
+ });
29
+ }
30
+
31
+ function pageParamWithBaseZero(params) {
32
+ return params.page ? params.page - 1 : undefined;
33
+ }
34
+
35
+ $(document).on('has_many_add:after', '.has_many_container', function(e, fieldset) {
36
+ initSearchableSelects(fieldset.find('.searchable-select-input'));
37
+ });
38
+
39
+ $(document).on('page:load turbolinks:load', function() {
40
+ initSearchableSelects($(".searchable-select-input"), {placeholder: ""});
41
+ });
42
+
43
+ $(function() {
44
+ initSearchableSelects($(".searchable-select-input"));
45
+ });
46
+ }());
@@ -0,0 +1,2 @@
1
+ import 'select2';
2
+ import './searchable_select/init';
@@ -0,0 +1,5 @@
1
+ @import "select2";
2
+
3
+ .searchable_select.input .select2-container {
4
+ min-width: 30%;
5
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-searchable_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codevise Solutions Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-03 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,28 +148,28 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '3.6'
151
+ version: '4.1'
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '3.6'
158
+ version: '4.1'
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: webdrivers
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - "~>"
163
+ - - '='
164
164
  - !ruby/object:Gem::Version
165
- version: '4.0'
165
+ version: 5.3.0
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - "~>"
170
+ - - '='
171
171
  - !ruby/object:Gem::Version
172
- version: '4.0'
172
+ version: 5.3.0
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: coffee-rails
175
175
  requirement: !ruby/object:Gem::Requirement
@@ -249,7 +249,7 @@ dependencies:
249
249
  version: 1.x
250
250
  - - "<"
251
251
  - !ruby/object:Gem::Version
252
- version: '3'
252
+ version: '4'
253
253
  type: :runtime
254
254
  prerelease: false
255
255
  version_requirements: !ruby/object:Gem::Requirement
@@ -259,7 +259,7 @@ dependencies:
259
259
  version: 1.x
260
260
  - - "<"
261
261
  - !ruby/object:Gem::Version
262
- version: '3'
262
+ version: '4'
263
263
  - !ruby/object:Gem::Dependency
264
264
  name: jquery-rails
265
265
  requirement: !ruby/object:Gem::Requirement
@@ -321,6 +321,7 @@ files:
321
321
  - gemfiles/rails_5.x_active_admin_1.x.gemfile
322
322
  - gemfiles/rails_5.x_active_admin_2.x.gemfile
323
323
  - gemfiles/rails_6.x_active_admin_2.x.gemfile
324
+ - gemfiles/rails_6.x_active_admin_3.x.gemfile
324
325
  - lib/activeadmin-searchable_select.rb
325
326
  - lib/activeadmin/inputs/filters/searchable_select_input.rb
326
327
  - lib/activeadmin/inputs/searchable_select_input.rb
@@ -355,6 +356,9 @@ files:
355
356
  - spec/support/models.rb
356
357
  - spec/support/pluck_polyfill.rb
357
358
  - spec/support/reset_settings.rb
359
+ - src/searchable_select.js
360
+ - src/searchable_select.scss
361
+ - src/searchable_select/init.js
358
362
  homepage: https://github.com/codevise/activeadmin-searchable_select
359
363
  licenses:
360
364
  - MIT