rails_admin_selectize 0.1.0 → 2.0.6

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: 8e1b9435aff8313e8ca0e535b052f4d7a24a7035dd88c47813840aa10635835c
4
- data.tar.gz: 10ba76fdcb5f76c14dd94ce594298f7eec1ecd1b8952db21b8604e230cc35e4c
3
+ metadata.gz: 3a12e447434109a1bd9aa025f5f2c9c35fedf0e733b3c50e4654acf14f5ad2c0
4
+ data.tar.gz: 0c2ad72b5dcb9564cecb24aac6b114182548ac798433223fca71e79eeb634790
5
5
  SHA512:
6
- metadata.gz: 1aed00a5a2bd045b4237f6d2e77797358d64089fcf2fe2d458be5d9065d67318df12beb43a66bcc5bd178e65c869e1392a002299060a432fce3ac8a46a095c47
7
- data.tar.gz: 76be6d08334f2f74f29281a2015116d6e3c1afce9b8feb90112d107ddd7ae761f166a9c3625e612b193e95cf461b360de7ac6ad876a3ddf860051a4dd1fccb24
6
+ metadata.gz: 12689a4ca04737ce5f9ca159440feb00dc923a9860bb3b7bbb2b5bf815b9398002514e347392b6aecd365baed9382a97ea2d3bb3883e899f776289594b3eccba
7
+ data.tar.gz: 2f7b2428d00b89c5188a26853397c1a5ea9931047dd2a498af17f28086e5970bcbf99b027955a4009ecd0371b03f7333b87e614b252d7b535a258a6772bcac36
@@ -0,0 +1,2 @@
1
+ //= require thecore_ui_commons/thecore
2
+ //= require selectize
@@ -0,0 +1,2 @@
1
+ @import 'selectize';
2
+ @import 'selectize.bootstrap3';
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  - selected_ids = (hdv = field.form_default_value).nil? ? selected_ids : hdv
32
- = form.select field.method_name, collection, { selected: selected_ids, object: form.object }, field.html_attributes.reverse_merge({data: { selectize: true, options: js_data.to_json }, multiple: true, style: 'width:25.5em', class: "form-control pull-left"})
32
+ = form.select field.method_name, collection, { selected: selected_ids, object: form.object }, field.html_attributes.reverse_merge({data: { selectize: true, options: js_data.to_json }, multiple: true, style: "max-width: max-content", class: "form-control pull-left"})
33
33
 
34
34
  - if authorized?(:new, config.abstract_model) && field.inline_add
35
35
  - path_hash = { model_name: config.abstract_model.to_param, modal: true }
@@ -38,7 +38,8 @@
38
38
 
39
39
  :javascript
40
40
  const selectizeField = $("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}")
41
- selectizeField.selectize(selectizeField.data('options'))
41
+ // selectizeField.selectize(selectizeField.data('options'))
42
+ selectizeField.selectize()
42
43
  if (selectizeField.parents("#modal").length) {
43
44
  selectizeField.siblings('.btn').remove();
44
45
  } else {
@@ -51,4 +52,5 @@
51
52
  selectized.refreshOptions(false);
52
53
  selectized.addItem(value);
53
54
  }});
55
+
54
56
  }
@@ -0,0 +1,9 @@
1
+ Rails.application.configure do
2
+ config.assets.paths << root.join("app", "assets", "stylesheets", "rails_admin_selectize")
3
+ config.assets.paths << root.join("app", "assets", "javascripts", "rails_admin_selectize")
4
+ # Pages under Rails Admin
5
+ config.assets.precompile += %w( rails_admin_selectize/thecore_rails_admin.css rails_admin_selectize/thecore_rails_admin.js )
6
+
7
+ config.after_initialize do
8
+ end
9
+ end
@@ -1,12 +1,10 @@
1
1
  require "rails_admin_selectize/engine"
2
-
3
- module RailsAdminSelectize
4
- # Your code goes here...
5
- end
6
-
7
2
  require 'selectize-rails'
8
3
  require 'rails_admin/config/fields/types/has_many_association'
9
4
 
5
+ module RailsAdminSelectize
6
+ end
7
+
10
8
  module RailsAdmin
11
9
  module Config
12
10
  module Fields
@@ -24,13 +22,13 @@ module RailsAdmin
24
22
  end
25
23
  end
26
24
 
27
- # RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
28
- # if properties[:name] == :selectize
29
- # fields << RailsAdmin::Config::Fields::Types::Selectize.new(parent, properties[:name], properties)
30
- # true
31
- # else
32
- # false
33
- # end
34
- # end
25
+ RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
26
+ if properties.name == :selectize
27
+ fields << RailsAdmin::Config::Fields::Types::Selectize.new(parent, properties[:name], properties)
28
+ true
29
+ else
30
+ false
31
+ end
32
+ end
35
33
 
36
34
 
@@ -1,4 +1,13 @@
1
1
  module RailsAdminSelectize
2
2
  class Engine < ::Rails::Engine
3
+ # appending migrations to the main app's ones
4
+ initializer 'rails_admin_selectize.append_migrations' do |app|
5
+ unless app.root.to_s.match root.to_s
6
+ config.paths["db/migrate"].expanded.each do |expanded_path|
7
+ app.config.paths["db/migrate"] << expanded_path
8
+ end
9
+ end
10
+ end
11
+
3
12
  end
4
13
  end
@@ -1,3 +1,4 @@
1
1
  module RailsAdminSelectize
2
- VERSION = '0.1.0'
2
+ # VERSION = "#{`git describe --tags $(git rev-list --tags --max-count=1)`}"
3
+ VERSION = "2.0.6"
3
4
  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: 0.1.0
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-22 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -62,7 +62,10 @@ files:
62
62
  - MIT-LICENSE
63
63
  - README.md
64
64
  - Rakefile
65
+ - app/assets/javascripts/rails_admin_selectize/index.js
66
+ - app/assets/stylesheets/rails_admin_selectize/index.scss
65
67
  - app/views/rails_admin/main/_form_selectize.html.haml
68
+ - config/initializers/rails_admin_selectize_app_configs.rb
66
69
  - lib/rails_admin_selectize.rb
67
70
  - lib/rails_admin_selectize/engine.rb
68
71
  - lib/rails_admin_selectize/version.rb
@@ -85,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
88
  - !ruby/object:Gem::Version
86
89
  version: '0'
87
90
  requirements: []
88
- rubygems_version: 3.0.6
91
+ rubygems_version: 3.0.3
89
92
  signing_key:
90
93
  specification_version: 4
91
94
  summary: Add Selectize as a field.