rest_in_place_bootstrap_slider

An AJAX Inplace-Editor + Bootstrap-Slider for the Rails 3.1+ asset pipeline.

Requirements

The following gems are unique and hard dependencies that will be installed automatically:

For the styling of the slider you'll need to setup a proper twitter bootstrap environment. I recommend using the following gem:

Installation

Add this lines to your application's Gemfile:

gem 'rest_in_place_bootstrap_slider'    
gem 'bootstrap-sass' # or any other bootstrap gem

Example application.js.coffee:

//= require bootstrap
//= require rest_in_place_bootstrap_slider

Example application.css.scss:

/*
 *= require bootstrap
 *= require rest_in_place_bootstrap_slider
 */

Usage

The following example snippet provides an inline editor for a User#age attribute and a slider control. The User model must be exposed via RESTful JSON API (just like the one generated by rails g scaffold Users).

<p class="rest-in-place-slider">
  <strong>Age:</strong>
  <span class="rest-in-place"
        data-url="<%= url_for(@user) %>"
        data-object="user"
        data-attribute="age">
    <%= @user.age %>
  </span>
  <input class="slider"
         data-slider-id="user-<%= @user.id %>-age"
         type="text" data-slider-min="0"
         data-slider-max="199"
         data-slider-step="1"
         data-slider-value="<%= @user.age %>" />
</p>

The TestApp contains a full rails app with a working HTML example.

See rest_in_place and bootstrap-slider-rails for more detailed instructions about their APIs.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Copyright (c) 2014 Jens Bissinger. See MIT-LICENSE.