mfairburn / activeadmin-select2 Goto Github PK
View Code? Open in Web Editor NEWActiveAdmin Select2 integration
License: MIT License
ActiveAdmin Select2 integration
License: MIT License
hi,
is it possible to add free tags ? https://select2.github.io/examples.html#tags
if yes how? cause I tried everything :/
thanks!
When using...
form do |f|
f.input :something, :as => :select2_multiple
end
...it returns a Formtastic::UnknownInputError with the error message: "Unable to find input class for select2_multiple." Using :select2 properly works, although (obviously) without the multiple option.
Hi Mark,
just wanted to let you know that I have created an Active Admin plugin called activeadmin-searchable_select
which is based on the code of this repository. I mainly needed a way to fetch options via ajax and define JSON endpoints to provide these options.
I originally intended to make the changes in the context of a PR for activeadmin-select2
, but diverged quite far from the original feature set during development. Also activeadmin-select2
provides additional features (multiple selects, tag selects) which I do not need at the moment and which would have been extra work to integrate with the new functionality.
I've included a link to this repository in the acknowledgements section of the readme and incorporated your copyright information into the license file. I removed your personal data from the gemspec since ownership of the new gem will be held by us. Please let me know if there is anything else you'd like me to change.
Thanks for your work on activeadmin-select2
.
Best regards
Tim
The gem worked perfectly when I did this:
f.input :students, as: :select2_multiple, collection: Student.all
But when I add the ajax call I need, it stops working and a normal select is there.
f.input :students, as: :select2_multiple, input_html: { class: "chosen activityStudents" }, collection: Student.all
I have rails 4.2 installed, using sass and coffee.
Need to mention, that on development it works fine.
Hi,
I've tried adding this gem to my Rails app but it seems to be breaking somewhere. It's a pity because it was a really simple gem to use previously.
Here's the output Passenger is giving me when I restart after installing the gem:
uninitialized constant ActiveAdmin::Inputs::FilterSelect2MultipleInput::FilterBase (NameError)
/Users/iamlamb/.rvm/gems/ruby-2.1.5/bundler/gems/activeadmin-select2-e2c2bd12cd4e/lib/activeadmin/inputs/filter_select2_multiple_input.rb:5:in <class:FilterSelect2MultipleInput>' /Users/iamlamb/.rvm/gems/ruby-2.1.5/bundler/gems/activeadmin-select2-e2c2bd12cd4e/lib/activeadmin/inputs/filter_select2_multiple_input.rb:3:in
module:Inputs'
/Users/iamlamb/.rvm/gems/ruby-2.1.5/bundler/gems/activeadmin-select2-e2c2bd12cd4e/lib/activeadmin/inputs/filter_select2_multiple_input.rb:2:in <module:ActiveAdmin>' /Users/iamlamb/.rvm/gems/ruby-2.1.5/bundler/gems/activeadmin-select2-e2c2bd12cd4e/lib/activeadmin/inputs/filter_select2_multiple_input.rb:1:in
<top (required)>'
/Users/iamlamb/.rvm/gems/ruby-2.1.5/bundler/gems/activeadmin-select2-e2c2bd12cd4e/lib/activeadmin/select2.rb:3:in <top (required)>' /Users/iamlamb/.rvm/gems/ruby-2.1.5/bundler/gems/activeadmin-select2-e2c2bd12cd4e/lib/activeadmin-select2.rb:1:in
<top (required)>'
/Users/iamlamb/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in require' /Users/iamlamb/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in
block (2 levels) in require'
/Users/iamlamb/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in each' /Users/iamlamb/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in
block in require'
/Users/iamlamb/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in each' /Users/iamlamb/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in
require'
/Users/iamlamb/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.7/lib/bundler.rb:133:in require' /Users/iamlamb/RubymineProjects/Simply Lee/config/application.rb:7:in
<top (required)>'
/Users/iamlamb/RubymineProjects/Simply Lee/config/environment.rb:2:in require' /Users/iamlamb/RubymineProjects/Simply Lee/config/environment.rb:2:in
<top (required)>'
config.ru:3:in require' config.ru:3:in
block in
instance_eval' /Users/iamlamb/.rvm/gems/ruby-2.1.5@global/gems/rack-1.5.2/lib/rack/builder.rb:55:in
initialize'new' config.ru:1:in
'eval' /usr/local/Cellar/passenger/4.0.53/libexec/helper-scripts/rack-preloader.rb:112:in
preload_app'<module:App>' /usr/local/Cellar/passenger/4.0.53/libexec/helper-scripts/rack-preloader.rb:29:in
module:PhusionPassenger'Thanks in advance
Using ActiveAdmin 1.0.0.pre1 and everything was working fine until I tried to add some multiple select filters. I'm filtering records based on country codes in the form of 2 letter alpha codes via the Countries gem. If I declare my filter as follows:
filter :country, as: :select, collection: Country.all
It produces the following source snippet and the filter works as expected a single country:
<div class="filter_form_field filter_select">
<label for="q_country" class="label">Country</label>
<select class="select2-input" id="q_country" name="q[country_in]">
<option value="AD">Andorra</option>
With a URI produced as follows:
http://localhost:3000/admin/mymodel?utf8=%E2%9C%93&q%5Bcountry_in%5D=CA&commit=Filter&order=id_desc
However if I try to get it working with multiple select via the following
filter :country, as: :select2_multiple, collection: Country.all
I end up with an oddly formatted list item in the filter panel and the following source snippet:
<li class="select2_multiple input required" id="q_country_input">
<label for="q_country" class="label">Country<abbr title="required">*</abbr></label>
<input name="q[country][]" type="hidden" value="" />
<select class="select2-input" multiple="multiple" id="q_country" name="q[country][]">
<option value=""></option>
<option value="AD">Andorra</option>
The filter does not work at all even for single value selections and I end up with URIs like the following:
http://localhost:3000/admin/mymodel?utf8=%E2%9C%93&q%5Bcountry%5D%5B%5D=CA&commit=Filter&order=id_desc
Any idea what is causing the huge difference between select2_multiple and the default select2 behaviour? I am using select2_multiple in my forms and it works fine.
When type in box search I want to override that event to ajax get new data then reload this select.
Is it possible?
Hello why select2 is forced an all the select fields of my admin page?
f.input :block_type, as: :select, :label => "Tipo Blocco", :collection => NewsItemBlock.block_types, input_html: {class: 'js-block-type-selector'}
I need this input to be a normal select, but the gem forces this to be a :select2 input.
as you can see in my uploaded image it is a typical select2 form, while i need a normal select.
please help me!
Its contents are by default:
#= require jquery
#= require ./jquery_ui
#= require jquery_ujs
#= require_self
#= require_tree ./lib
#= require_tree ./ext
#= require_tree ./initializers
window.ActiveAdmin = {}
And how does it need to change, to add your string?
#= require active_admin/select2
ActiveAdmin uses jQuery3. So $(document).on('ready', function) is removed.
You should init with $(document).ready() call.
See https://github.com/activeadmin/activeadmin/blob/5ae2e3db5bf69e94ea8c205b83f04799154ceee3/app/assets/javascripts/active_admin/initializers/datepicker.es6#L14-L16 for example
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.