rails_admin_selectize 2.0.6 → 2.0.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
  SHA256:
3
- metadata.gz: 3a12e447434109a1bd9aa025f5f2c9c35fedf0e733b3c50e4654acf14f5ad2c0
4
- data.tar.gz: 0c2ad72b5dcb9564cecb24aac6b114182548ac798433223fca71e79eeb634790
3
+ metadata.gz: c576aa5f3af5bc00a2e99d522848cf6eaea570cd2f1f3cd2b7778a8836133139
4
+ data.tar.gz: 0021a95e6c73eef152d8a1c73936efd35dfda8ea4a12596b3fd6cd63759929c8
5
5
  SHA512:
6
- metadata.gz: 12689a4ca04737ce5f9ca159440feb00dc923a9860bb3b7bbb2b5bf815b9398002514e347392b6aecd365baed9382a97ea2d3bb3883e899f776289594b3eccba
7
- data.tar.gz: 2f7b2428d00b89c5188a26853397c1a5ea9931047dd2a498af17f28086e5970bcbf99b027955a4009ecd0371b03f7333b87e614b252d7b535a258a6772bcac36
6
+ metadata.gz: e35a56e6d9fbe246b3a4f893af721b2eb099541f19fa3c6d2a0226c15fe8b1fd106a8e38ba239fd0ce2e668c6933a91b03f19d969c3c62f6ca9d9f8c6f143448
7
+ data.tar.gz: f619746152041134957552b1b51a94bfc816d332a900bdb998e1d2b4d3c6bebaa25b6bfa741d2791c5c8f8aab40528fe5c1f7cc20a4dda37c2228b69b3489704
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)`}"
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: 2.0.7
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: 2021-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails