如何将Selectize.js安装到我的Rails应用程序中?

问题描述:

我下载了Selectize.js,并试图将其安装到我的Rails 4应用程序中,但是文件太多了,我很困惑.成功将Selectize安装到其应用程序中的任何人都可以帮助我解决这个问题吗?我正在尝试实现一个自动建议的输入栏,用户可以在其中输入最多不超过6个来自数据库的项目.

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.

以下是我下载的内容(版本0.11.0):很抱歉,文档数量巨大,但这正是我如此困惑的原因.

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

将javascripts插件包含到rails应用程序中的最佳方法是使用gems(如果存在).值得庆幸的是,有一个可供选择的 selectize-rails .

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.