How to install Selectize.js into my Rails app?
Asked Answered
S

2

1

I downloaded Selectize.js and I'm trying to install it into my Rails 4 app, but there are so many files and I'm so confused. Can anyone who has successfully installed Selectize into their app help me out with this? I'm trying to achieve an autosuggest input bar into which the user can input no more than 6 items from the database.

Here are the contents of my download (version 0.11.0): Sorry about the immense number of documents, but that's exactly why I'm so confused.

-brianreavis-selectize.js-v0.11.0-0-gf293d8b (folder)
  -brianreavis-selectize.js-f293d8b (folder)
    -dist (folder)
      -css (folder)
        -selectize.css
        -selectize.bootstrap2.css
        -selectize.boostrap3.css
        -selectize.default
        -selectize.legacy
      -js (folder)
        -standalone (folder)
          -selectize.js
          -selectize.min.js
        -selectize.js
        -selectize.min.js
      -less (folder)
        -plugins (folder)
          -drag_drop.less
          -dropdown_header.less
          -optgroup_columns.less
          -remove_button.less
        -selectize.bootstrap2.less
        -selectize.bootstrap3.less
        -selectize.default.less
        -selectize.legacy.less
        -selectize.less
    -docs (folder)
      -api.md
      -events.md
      -plugins.md
      -usage.md
    -src (folder)
      -contrib (folder)
        -highlight.js
        -microevent.js
      -less (folder)
        -.wrapper.css
        -selectize.bootstrap2.less
        -selectize.bootstrap2.less
        -selectize.default.less
        -selectize.legacy.less
        -selectize.less
      -plugins (folder)
        -drag_drop (folder)
          -plugin.js
          -plugin.less
        -drop_down_header (folder)
           -plugin.js
           -plugin.less
        -optgroup_columns (folder)
           -plugin.js
           -plugin.less
        -remove_button (folder)
           -plugin.js
           -plugin.less
        -restore_on_backspace (folder)
           -plugin.js
      -.wrapper.js
      -constants.js
      -defaults.js
      -selectize.js
      -selectize.jquery.js
      -utils.js
    -test (folder)
      -vendor (folder)
        -chai.js
        -mocha.css
        -mocha.js
        -syn.js
      -api.js
      -events.js
      -events_dom.js
      -index (Chrome Html Document)
      -interaction.js
      -setup.js
      -xss.js
    -.gitignore
    -.travis.yml
    -bower.json
    -Gruntfile.js
    -LICENSE
    -Makefile
    -package.json
    -selectize.jquery.json
    -testem.json
Scarificator answered 24/12, 2014 at 13:40 Comment(0)
D
1

Best way to include javascripts plugins to your rails app is to use gems, if it exist. Thankfully, there is one for selectize, selectize-rails.

Derayne answered 24/12, 2014 at 15:21 Comment(2)
Thank God!! I was looking everywhere for a selectize gem and didn't think there was one, thank you so much for finding that!Scarificator
"Best way to include javascripts plugins to your rails app is to use gems, if it exist." I beg to differ. If you do this, then you end up with a Gemfile full of gems whose only purpose is to download a JavaScript library for you. I much prefer to include the JavaScript files directly without involving a gem.Izanami
R
2

First thing you need to do is install the gem file. Add this line to your gemfile

 gem "selectize-rails"

now run the bundle from your commandline.

Next you need to tell your application to use selectize to do that add the below line to your application.js file

 //= require selectize

That was it.

Rigging answered 25/12, 2014 at 7:44 Comment(0)
D
1

Best way to include javascripts plugins to your rails app is to use gems, if it exist. Thankfully, there is one for selectize, selectize-rails.

Derayne answered 24/12, 2014 at 15:21 Comment(2)
Thank God!! I was looking everywhere for a selectize gem and didn't think there was one, thank you so much for finding that!Scarificator
"Best way to include javascripts plugins to your rails app is to use gems, if it exist." I beg to differ. If you do this, then you end up with a Gemfile full of gems whose only purpose is to download a JavaScript library for you. I much prefer to include the JavaScript files directly without involving a gem.Izanami

© 2022 - 2024 — McMap. All rights reserved.