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 +4 -4
- data/app/assets/javascripts/rails_admin_selectize/index.js +2 -0
- data/app/assets/stylesheets/rails_admin_selectize/index.scss +2 -0
- data/app/views/rails_admin/main/_form_selectize.html.haml +4 -2
- data/config/initializers/rails_admin_selectize_app_configs.rb +9 -0
- data/lib/rails_admin_selectize.rb +11 -13
- data/lib/rails_admin_selectize/engine.rb +9 -0
- data/lib/rails_admin_selectize/version.rb +2 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a12e447434109a1bd9aa025f5f2c9c35fedf0e733b3c50e4654acf14f5ad2c0
|
4
|
+
data.tar.gz: 0c2ad72b5dcb9564cecb24aac6b114182548ac798433223fca71e79eeb634790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12689a4ca04737ce5f9ca159440feb00dc923a9860bb3b7bbb2b5bf815b9398002514e347392b6aecd365baed9382a97ea2d3bb3883e899f776289594b3eccba
|
7
|
+
data.tar.gz: 2f7b2428d00b89c5188a26853397c1a5ea9931047dd2a498af17f28086e5970bcbf99b027955a4009ecd0371b03f7333b87e614b252d7b535a258a6772bcac36
|
@@ -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:
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
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.
|
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:
|
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.
|
91
|
+
rubygems_version: 3.0.3
|
89
92
|
signing_key:
|
90
93
|
specification_version: 4
|
91
94
|
summary: Add Selectize as a field.
|