This repository was archived by the owner on Aug 10, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed
Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,14 @@ Integrating Bootstrap-looking form controls with Simple Form.
44
55## Installation
66
7- 1 . Add to your application's Gemfile: ` gem 'simple_form-bootstrap' `
7+ 1 . Add to your application's Gemfile: ` gem 'simple_form-bootstrap' ` . The following types of
8+ input controls are supported, so long they are properly installed in your application. Ensure
9+ that the control is included in your ` application.js ` _ before_ the Simple Form-Bootstrap
10+ JavaScript.
811
912 a. If you want to use Date/Time pickers, install the ` bootstrap3-datetimepicker-rails ` gem.
10- Ensure that the picker is initialised in the JavaScript _ before _ the Simple Form-Bootstrap
11- JavaScript .
13+ b. If you want to use the nicely styled Bootstrap Select picker, install the
14+ ` bootstrap-select-rails ` gem .
1215
1316 2 . Add to your application's javascript: ` //= require simple_form-bootstrap `
1417 3 . Create a new initializer:
Original file line number Diff line number Diff line change 66 // Enable our date/time pickers
77 var datePickers = $ ( 'input.bootstrap-datepicker' , node ) ;
88 datePickers . datetimepicker ( ) ;
9+
10+ // Enable our styled Bootstrap select controls, except Twitter Typeahead controls.
11+ var selects = $ ( 'select.form-control:not(.typeahead)' , node ) ;
12+ selects . selectpicker ( ) ;
913 }
1014
1115 $ ( document ) . on ( 'ready' , function ( e ) {
1216 initializeComponents ( document ) ;
13- } )
17+ } ) ;
1418 $ ( document ) . on ( 'DOMNodeInserted' , function ( e ) {
1519 initializeComponents ( e . target ) ;
1620 } ) ;
Original file line number Diff line number Diff line change 1+ // Hijacks the default Bootstrap date-time picker to always format dates in the specified format
2+ // through the use of a hidden field.
3+ ( function ( $ ) {
4+ 'use strict' ;
5+ if ( $ . fn . selectpicker ) {
6+ return ;
7+ }
8+
9+ $ . fn . selectpicker = function ( arg ) {
10+ return methods . initialise . call ( this , arg ) ;
11+ } ;
12+ } ( jQuery ) ) ;
You can’t perform that action at this time.
0 commit comments