rails_admin_selectize 0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/rails_admin/main/_form_selectize.html.haml +2 -4
- data/lib/rails_admin_selectize.rb +13 -11
- data/lib/rails_admin_selectize/engine.rb +0 -9
- data/lib/rails_admin_selectize/version.rb +1 -1
- metadata +3 -6
- data/app/assets/javascripts/rails_admin_selectize/index.js +0 -2
- data/app/assets/stylesheets/rails_admin_selectize/index.scss +0 -2
- data/config/initializers/rails_admin_selectize_app_configs.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e1b9435aff8313e8ca0e535b052f4d7a24a7035dd88c47813840aa10635835c
|
4
|
+
data.tar.gz: 10ba76fdcb5f76c14dd94ce594298f7eec1ecd1b8952db21b8604e230cc35e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aed00a5a2bd045b4237f6d2e77797358d64089fcf2fe2d458be5d9065d67318df12beb43a66bcc5bd178e65c869e1392a002299060a432fce3ac8a46a095c47
|
7
|
+
data.tar.gz: 76be6d08334f2f74f29281a2015116d6e3c1afce9b8feb90112d107ddd7ae761f166a9c3625e612b193e95cf461b360de7ac6ad876a3ddf860051a4dd1fccb24
|
@@ -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: 'width:25.5em', 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,8 +38,7 @@
|
|
38
38
|
|
39
39
|
:javascript
|
40
40
|
const selectizeField = $("##{field.abstract_model.to_s.parameterize.underscore}_#{field.method_name}")
|
41
|
-
|
42
|
-
selectizeField.selectize()
|
41
|
+
selectizeField.selectize(selectizeField.data('options'))
|
43
42
|
if (selectizeField.parents("#modal").length) {
|
44
43
|
selectizeField.siblings('.btn').remove();
|
45
44
|
} else {
|
@@ -52,5 +51,4 @@
|
|
52
51
|
selectized.refreshOptions(false);
|
53
52
|
selectized.addItem(value);
|
54
53
|
}});
|
55
|
-
|
56
54
|
}
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require "rails_admin_selectize/engine"
|
2
|
-
require 'selectize-rails'
|
3
|
-
require 'rails_admin/config/fields/types/has_many_association'
|
4
2
|
|
5
|
-
module RailsAdminSelectize
|
3
|
+
module RailsAdminSelectize
|
4
|
+
# Your code goes here...
|
6
5
|
end
|
7
6
|
|
7
|
+
require 'selectize-rails'
|
8
|
+
require 'rails_admin/config/fields/types/has_many_association'
|
9
|
+
|
8
10
|
module RailsAdmin
|
9
11
|
module Config
|
10
12
|
module Fields
|
@@ -22,13 +24,13 @@ module RailsAdmin
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
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
|
33
35
|
|
34
36
|
|
@@ -1,13 +1,4 @@
|
|
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
|
-
|
12
3
|
end
|
13
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:
|
4
|
+
version: 0.1.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:
|
11
|
+
date: 2019-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -62,10 +62,7 @@ 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
|
67
65
|
- app/views/rails_admin/main/_form_selectize.html.haml
|
68
|
-
- config/initializers/rails_admin_selectize_app_configs.rb
|
69
66
|
- lib/rails_admin_selectize.rb
|
70
67
|
- lib/rails_admin_selectize/engine.rb
|
71
68
|
- lib/rails_admin_selectize/version.rb
|
@@ -88,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
85
|
- !ruby/object:Gem::Version
|
89
86
|
version: '0'
|
90
87
|
requirements: []
|
91
|
-
rubygems_version: 3.0.
|
88
|
+
rubygems_version: 3.0.6
|
92
89
|
signing_key:
|
93
90
|
specification_version: 4
|
94
91
|
summary: Add Selectize as a field.
|
@@ -1,9 +0,0 @@
|
|
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
|