rails_admin_selectize 2.0.6 → 3.0.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: 3a12e447434109a1bd9aa025f5f2c9c35fedf0e733b3c50e4654acf14f5ad2c0
4
- data.tar.gz: 0c2ad72b5dcb9564cecb24aac6b114182548ac798433223fca71e79eeb634790
3
+ metadata.gz: b06300d54f6535e2bdfdbfb4c1c683b0ec4441550a0c48cced041c75728c202f
4
+ data.tar.gz: 77dfcb0bcd89f35ccd0ffeeb7a963bfb0aa163df1b125db203f6569a0d7e6bf2
5
5
  SHA512:
6
- metadata.gz: 12689a4ca04737ce5f9ca159440feb00dc923a9860bb3b7bbb2b5bf815b9398002514e347392b6aecd365baed9382a97ea2d3bb3883e899f776289594b3eccba
7
- data.tar.gz: 2f7b2428d00b89c5188a26853397c1a5ea9931047dd2a498af17f28086e5970bcbf99b027955a4009ecd0371b03f7333b87e614b252d7b535a258a6772bcac36
6
+ metadata.gz: bfcd688d90b6492405f04bac7f6024b220eb7ecd4462642d4f3f2ce320d2fd6bde16ba77afdea0329f3456c465ecd1660d7772b1ed1be8d5d663431b18b92927
7
+ data.tar.gz: 37236deeffa21fe386a3bb9e3461df4a2c8d3cedc50512866bdb1bdb02ace02ae110eb6d8e866d4f1d59caa5b967e1ed4ddbf0859149259615609d368caa26b9
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # RailsAdminSelectize
2
- The default multiselect widget for create and edit forms in [Rails Admin](https://github.com/sferik/rails_admin) is useful, for sure, but some of my custerms find it a bit unpleasant to the eyes. Chatting around with some of them I found they expected, for multi select an approach similar to the normal select, a more streamlined and small element in the page.
2
+ The default multiselect widget for create and edit forms in [Rails Admin](https://github.com/sferik/rails_admin) is useful, for sure, but some of my customers find it a bit unpleasant to the eyes. Chatting around with some of them I found they expected, for multi select an approach similar to the normal select, a more streamlined and small element in the page.
3
3
  Since I used, some time ago, the [selectize.js](https://selectize.github.io/selectize.js/) library, and found it to be full with options and beautiful, I started to look around and find a selectize custom field for Rails Admin, what I found is this [rails_admin_selectize](https://github.com/glyph-fr/rails_admin_selectize), but soon I noticed it was completely abandoned and targeted at very old versions of rails admin, not working in newer versions by just changing the dependency, so I decided to start from scratch and integrate the selectize into the Rails Admin environment one step at a time.
4
4
 
5
5
  This Rails Admin Custom Field is not a fully custimizable selectize implementation, rathere a really straight forward one, aimed at using a selectize Field the KISSier way. I will maintain this and probably add some of the configurations from time to time, when needs arises in one of my future commissions, the code is kept KISS as more as I can, open to further implementations.
@@ -37,17 +37,16 @@
37
37
  = link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', data: { link: new_path(path_hash) }, class: "create btn btn-info", style: 'margin-left:10px'
38
38
 
39
39
  :javascript
40
- const selectizeField = $("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}")
41
40
  // selectizeField.selectize(selectizeField.data('options'))
42
- selectizeField.selectize()
43
- if (selectizeField.parents("#modal").length) {
44
- selectizeField.siblings('.btn').remove();
41
+ $("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}").selectize()
42
+ if ($("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}").parents("#modal").length) {
43
+ $("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}").siblings('.btn').remove();
45
44
  } else {
46
- selectizeField.parents('.control-group').first().remoteForm({success: function(e) {
45
+ $("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}").parents('.control-group').first().remoteForm({success: function(e) {
47
46
  const lastOption = $(this).find("select option").last().first();
48
47
  const value = lastOption.val();
49
48
  const text = lastOption.text()
50
- const selectized = selectizeField[0].selectize;
49
+ const selectized = $("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}")[0].selectize;
51
50
  selectized.addOption({ text: text, value: value });
52
51
  selectized.refreshOptions(false);
53
52
  selectized.addItem(value);
@@ -1,4 +1,3 @@
1
1
  module RailsAdminSelectize
2
- # VERSION = "#{`git describe --tags $(git rev-list --tags --max-count=1)`}"
3
- VERSION = "2.0.6"
2
+ VERSION = "#{`git describe --tags $(git rev-list --tags --max-count=1)`.chomp}"
4
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_selectize
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2022-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: selectize-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.0.3
91
+ rubygems_version: 3.0.3.1
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Add Selectize as a field.