diff options
| author | jpl | 2016-11-08 17:47:56 +0100 |
|---|---|---|
| committer | Thomas Haddad | 2016-11-08 18:15:12 +0100 |
| commit | 1da0bf0708eb981d6c17a76d3e49439580869602 (patch) | |
| tree | adbc91469e684c50076310e4fc94fd027cc5ad69 | |
| parent | c01ecd41cd89f3477ae5d7a27a66ffcfa2cc86a7 (diff) | |
| download | chouette-core-1da0bf0708eb981d6c17a76d3e49439580869602.tar.bz2 | |
add select2 with reactux
| -rw-r--r-- | app/assets/javascripts/es6_browserified/actions/index.js | 5 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/BSelect2.js | 96 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/Todo.js | 74 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/TodoList.js | 44 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/reducers/todos.js | 14 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/stop_points.js | 16 | ||||
| -rw-r--r-- | app/assets/stylesheets/application.sass.erb | 3 | ||||
| -rw-r--r-- | app/assets/stylesheets/vendor/select2-bootstrap.css | 721 | ||||
| -rw-r--r-- | app/assets/stylesheets/vendor/select2.css | 484 | ||||
| -rw-r--r-- | app/views/routes/_form.html.slim | 2 | ||||
| -rw-r--r-- | package.json | 1 |
11 files changed, 1388 insertions, 72 deletions
diff --git a/app/assets/javascripts/es6_browserified/actions/index.js b/app/assets/javascripts/es6_browserified/actions/index.js index c0f64005e..8967c0322 100644 --- a/app/assets/javascripts/es6_browserified/actions/index.js +++ b/app/assets/javascripts/es6_browserified/actions/index.js @@ -1,25 +1,21 @@ module.exports = { - addStop : () => { return { type: 'ADD_STOP' } }, - moveStopUp : (index) => { return { type: 'MOVE_STOP_UP', index } }, - moveStopDown : (index) => { return { type: 'MOVE_STOP_DOWN', index } }, - deleteStop: (index) => { return { type: 'DELETE_STOP', @@ -27,6 +23,7 @@ module.exports = { } }, updateInputValue: (index, text) => { + console.log('action',index, text) return { type : "UPDATE_INPUT_VALUE", index, diff --git a/app/assets/javascripts/es6_browserified/components/BSelect2.js b/app/assets/javascripts/es6_browserified/components/BSelect2.js new file mode 100644 index 000000000..7e4782563 --- /dev/null +++ b/app/assets/javascripts/es6_browserified/components/BSelect2.js @@ -0,0 +1,96 @@ +var React = require('react') +var PropTypes = require('react').PropTypes +var Select2 = require('react-select2') + +// get JSON full path +var origin = window.location.origin +var path = window.location.pathname.split('/', 3).join('/') + +class BSelect3 extends React.Component{ + constructor(props) { + super(props) + this.state = { + edit: false + } + } + onToggleEdit(e) { + e.preventDefault() + this.setState({edit: !this.state.edit}) + } + onChange(e) { + console.log(e.currentTarget.value, e.currentTarget.textContent) + this.props.onChange(this.props.index, {text: e.currentTarget.textContent, id: e.currentTarget.value}) + this.setState({edit: false}) + } + render() { + if(this.state.edit) + return ( + <div> + <BSelect2 {...this.props} onSelect={ this.onChange.bind(this) }/> + </div> + ) + else + return ( + <div> + <span + title="Cliquez pour changer l'arrêt" + style={{cursor: 'pointer', display: 'block'}} + onClick={this.onToggleEdit.bind(this)} + > + {this.props.value.text} + </span> + </div> + ) + } +} + +const BSelect2 = (props) => { + return ( + <Select2 + value={props.value.id} + onSelect={ props.onSelect } + options={{ + placeholder: 'Sélectionnez un arrêt existant...', + theme: 'bootstrap', + ajax: { + url: origin + path + '/autocomplete_stop_areas.json', + dataType: 'json', + delay: '500', + data: function(params) { + return { + q: params.term + }; + }, + processResults: function(data, params) { + return { + results: data.map( + item => Object.assign( + {}, + item, + { text: item.name + ", " + item.zip_code + " " + item.short_city_name } + ) + ) + }; + }, + cache: true + }, + minimumInputLength: 3, + templateResult: formatRepo + }} + /> + ) +} + +// to fix: this is for custom results return +const formatRepo = (props) => { + if(props.text) return props.text + // console.log(props) + // return ( + // <div> + // {props.short_name} + // <small><em>{props.zip_code} {props.short_city_name}</em></small> + // </div> + // ) +} + +module.exports = BSelect3 diff --git a/app/assets/javascripts/es6_browserified/components/Todo.js b/app/assets/javascripts/es6_browserified/components/Todo.js index aeee78295..0e74e728f 100644 --- a/app/assets/javascripts/es6_browserified/components/Todo.js +++ b/app/assets/javascripts/es6_browserified/components/Todo.js @@ -1,48 +1,52 @@ var React = require('react') var PropTypes = require('react').PropTypes +var BSelect2 = require('./BSelect2') const Container = {display: 'table', width: '100%'} const firstBlock = {display: 'table-cell', verticalAlign: 'middle'} const secondBlock = {display: 'table-cell', verticalAlign: 'middle', width: '150px', textAlign: 'right'} -const Todo = (props) => ( - <div className='list-group-item' style={Container}> - <div style={firstBlock}> - <div style={{display: 'inline-block', width: '9%'}}> - <span className='strong'>Id: {props.index}</span> - </div> - <div style={{display: 'inline-block', width: '91%'}}> - <input type='text' className='form-control' id={'route_stop_points_' + props.index} value={props.text} onChange={props.onChange}/> - </div> - </div> - - <div style={secondBlock}> - <div className='btn-group btn-group-sm'> - <div className='btn btn-default'> - <span className='fa fa-times'></span> - </div> - <div - className={'btn btn-primary' + (props.first ? ' disabled' : '')} - onClick={props.onMoveUpClick} - > - <span className='fa fa-arrow-up'></span> +const Todo = (props) => { + return ( + <div className='list-group-item' style={Container}> + <div style={firstBlock}> + <div style={{display: 'inline-block', width: '9%', verticalAlign: 'middle'}}> + <span className='strong'>#{props.index}</span> </div> - <div - className={'btn btn-primary' + (props.last ? ' disabled' : '')} - onClick={props.onMoveDownClick} - > - <span className='fa fa-arrow-down'></span> + + <div style={{display: 'inline-block', width: '91%', verticalAlign: 'middle'}}> + <BSelect2 id={'route_stop_points_' + props.id} value={props.value} onChange={props.onChange} index={props.index} defaultData={props.defaultData}/> </div> - <div - className='btn btn-danger' - onClick={props.onDeleteClick} - > - <span className='fa fa-trash'></span> + </div> + + <div style={secondBlock}> + <div className='btn-group btn-group-sm'> + <div className='btn btn-default'> + <span className='fa fa-times'></span> + </div> + <div + className={'btn btn-primary' + (props.first ? ' disabled' : '')} + onClick={props.onMoveUpClick} + > + <span className='fa fa-arrow-up'></span> + </div> + <div + className={'btn btn-primary' + (props.last ? ' disabled' : '')} + onClick={props.onMoveDownClick} + > + <span className='fa fa-arrow-down'></span> + </div> + <div + className='btn btn-danger' + onClick={props.onDeleteClick} + > + <span className='fa fa-trash'></span> + </div> </div> </div> </div> - </div> -) + ) +} Todo.propTypes = { onDeleteClick: PropTypes.func.isRequired, @@ -50,7 +54,9 @@ Todo.propTypes = { onMoveDownClick: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired, first: PropTypes.bool, - last: PropTypes.bool + last: PropTypes.bool, + index: PropTypes.number, + defaultData: PropTypes.array } module.exports = Todo diff --git a/app/assets/javascripts/es6_browserified/components/TodoList.js b/app/assets/javascripts/es6_browserified/components/TodoList.js index 768c691bb..367cfc256 100644 --- a/app/assets/javascripts/es6_browserified/components/TodoList.js +++ b/app/assets/javascripts/es6_browserified/components/TodoList.js @@ -2,27 +2,33 @@ var React = require('react') var PropTypes = require('react').PropTypes var Todo = require('./Todo') -const TodoList = ({ todos, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange }) => ( - <div className='list-group'> - {todos.map((todo, index) => - <Todo - key={'item-' + index} - {...todo} - onDeleteClick={() => onDeleteClick(index)} - onMoveUpClick={() => onMoveUpClick(index)} - onMoveDownClick={() => onMoveDownClick(index)} - onChange={(event) => onChange(index, event.currentTarget.value)} - first={ index === 0 } - last={ index === (todos.length - 1) } - /> - )} - </div> -) +const TodoList = ({ todos, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange }) => { + console.log(todos) + return ( + <div className='list-group'> + {todos.map((todo, index) => + <Todo + key={'item-' + index} + onDeleteClick={() => onDeleteClick(index)} + onMoveUpClick={() => { + console.log(index, todos) + onMoveUpClick(index)} + } + onMoveDownClick={() => onMoveDownClick(index)} + onChange={ onChange } + first={ index === 0 } + last={ index === (todos.length - 1) } + index={ index } + defaultData={ todos } + value={ todo } + /> + )} + </div> + ) +} TodoList.propTypes = { - todos: PropTypes.arrayOf(PropTypes.shape({ - index: PropTypes.number.isRequired, - }).isRequired).isRequired, + todos: PropTypes.array.isRequired, onDeleteClick: PropTypes.func.isRequired, onMoveUpClick: PropTypes.func.isRequired, onMoveDownClick: PropTypes.func.isRequired diff --git a/app/assets/javascripts/es6_browserified/reducers/todos.js b/app/assets/javascripts/es6_browserified/reducers/todos.js index d5a02f40a..bf64632bd 100644 --- a/app/assets/javascripts/es6_browserified/reducers/todos.js +++ b/app/assets/javascripts/es6_browserified/reducers/todos.js @@ -6,6 +6,7 @@ const todo = (state = {}, action, length) => { index: length } case 'UPDATE_INPUT_VALUE': + console.log('reducer', action) if (state.index !== action.index) { return state } @@ -13,7 +14,7 @@ const todo = (state = {}, action, length) => { return Object.assign( {}, state, - {text: action.text} + {text: action.text.text, id: action.text.id} ) default: return state @@ -28,8 +29,6 @@ const todos = (state = [], action) => { todo(undefined, action, state.length) ] case 'MOVE_STOP_UP': - state[action.index].index = state[action.index - 1].index - state[action.index - 1].index = state[action.index].index + 1 return [ ...state.slice(0, action.index - 1), state[action.index], @@ -37,8 +36,6 @@ const todos = (state = [], action) => { ...state.slice(action.index + 1) ] case 'MOVE_STOP_DOWN': - state[action.index + 1].index = state[action.index].index - state[action.index].index = state[action.index + 1].index + 1 return [ ...state.slice(0, action.index), state[action.index + 1], @@ -54,9 +51,10 @@ const todos = (state = [], action) => { }) ] case 'UPDATE_INPUT_VALUE': - return state.map(t => - todo(t, action) - ) + return state.map((t, i) => (i === action.index) ? action.text : t) + // return state.map(t => + // todo(t, action) + // ) default: return state } diff --git a/app/assets/javascripts/es6_browserified/stop_points.js b/app/assets/javascripts/es6_browserified/stop_points.js index 41c99c90f..9c0195f2b 100644 --- a/app/assets/javascripts/es6_browserified/stop_points.js +++ b/app/assets/javascripts/es6_browserified/stop_points.js @@ -13,14 +13,20 @@ const getInitialState = () => { let state = [] let datas = JSON.parse(decodeURIComponent(window.itinerary_stop)) for (let [index, value] of datas.entries()){ + + let fancyText = value.name + if(value.zip_code && value.city_name) + fancyText += ", " + value.zip_code + " " + value.city_name + state.push({ - index: index, - text: value.name, + id: value.id, + name: value.name, city_name: value.city_name, - zip_code: value.zip_code + zip_code: value.zip_code, + text: fancyText }) } - console.log(state) + // console.log(state) return state } @@ -32,7 +38,7 @@ let store = createStore( // applyMiddleware(thunkMiddleware, promise, loggerMiddleware) ) -console.log(store.getState()) +// console.log(store.getState()) render( <Provider store={store}> diff --git a/app/assets/stylesheets/application.sass.erb b/app/assets/stylesheets/application.sass.erb index 53b767384..c59a07d94 100644 --- a/app/assets/stylesheets/application.sass.erb +++ b/app/assets/stylesheets/application.sass.erb @@ -42,6 +42,9 @@ $body-bg: #eee @import 'vendor/typeahead' @import 'vendor/bootstrap_changes' @import 'vendor/simple_form' +// Select2 +@import 'vendor/select2' +@import 'vendor/select2-bootstrap' // Main css @import 'main/*' diff --git a/app/assets/stylesheets/vendor/select2-bootstrap.css b/app/assets/stylesheets/vendor/select2-bootstrap.css new file mode 100644 index 000000000..65f772696 --- /dev/null +++ b/app/assets/stylesheets/vendor/select2-bootstrap.css @@ -0,0 +1,721 @@ +/*! + * Select2 Bootstrap Theme v0.1.0-beta.9 (https://select2.github.io/select2-bootstrap-theme) + * Copyright 2015-2016 Florian Kissling and contributors (https://github.com/select2/select2-bootstrap-theme/graphs/contributors) + * Licensed under MIT (https://github.com/select2/select2-bootstrap-theme/blob/master/LICENSE) + */ + +.select2-container--bootstrap { + display: block; + width: 100% !important + /*------------------------------------* #COMMON STYLES + \*------------------------------------*/ + /** + * Search field in the Select2 dropdown. + */ + /** + * No outline for all search fields - in the dropdown + * and inline in multi Select2s. + */ + /** + * Adjust Select2's choices hover and selected styles to match + * Bootstrap 3's default dropdown styles. + * + * @see http://getbootstrap.com/components/#dropdowns + */ + /** + * Clear the selection. + */ + /** + * Address disabled Select2 styles. + * + * @see https://select2.github.io/examples.html#disabled + * @see http://getbootstrap.com/css/#forms-control-disabled + */ + /*------------------------------------* #DROPDOWN + \*------------------------------------*/ + /** + * Dropdown border color and box-shadow. + */ + /** + * Limit the dropdown height. + */ + /*------------------------------------* #SINGLE SELECT2 + \*------------------------------------*/ + /*------------------------------------* #MULTIPLE SELECT2 + \*------------------------------------*/ + /** + * Address Bootstrap control sizing classes + * + * 1. Reset Bootstrap defaults. + * 2. Adjust the dropdown arrow button icon position. + * + * @see http://getbootstrap.com/css/#forms-control-sizes + */ + /* 1 */ + /*------------------------------------* #RTL SUPPORT + \*------------------------------------*/ +} + +.select2-container--bootstrap .select2-selection { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + background-color: #fff; + border: 1px solid #ccc; + border-radius: 4px; + color: #555555; + font-size: 14px; + outline: 0; +} + +.select2-container--bootstrap .select2-selection.form-control { + border-radius: 4px; +} + +.select2-container--bootstrap .select2-search--dropdown .select2-search__field { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + background-color: #fff; + border: 1px solid #ccc; + border-radius: 4px; + color: #555555; + font-size: 14px; +} + +.select2-container--bootstrap .select2-search__field { + outline: 0; + /* Firefox 18- */ + /** + * Firefox 19+ + * + * @see http://stackoverflow.com/questions/24236240/color-for-styled-placeholder-text-is-muted-in-firefox + */ +} + +.select2-container--bootstrap .select2-search__field::-webkit-input-placeholder { + color: #999; +} + +.select2-container--bootstrap .select2-search__field:-moz-placeholder { + color: #999; +} + +.select2-container--bootstrap .select2-search__field::-moz-placeholder { + color: #999; + opacity: 1; +} + +.select2-container--bootstrap .select2-search__field:-ms-input-placeholder { + color: #999; +} + +.select2-container--bootstrap .select2-results__option { + padding: 6px 12px; + /** + * Disabled results. + * + * @see https://select2.github.io/examples.html#disabled-results + */ + /** + * Hover state. + */ + /** + * Selected state. + */ +} + +.select2-container--bootstrap .select2-results__option[role=group] { + padding: 0; +} + +.select2-container--bootstrap .select2-results__option[aria-disabled=true] { + color: #777777; + cursor: not-allowed; +} + +.select2-container--bootstrap .select2-results__option[aria-selected=true] { + background-color: #f5f5f5; + color: #262626; +} + +.select2-container--bootstrap .select2-results__option--highlighted[aria-selected] { + background-color: #337ab7; + color: #fff; +} + +.select2-container--bootstrap .select2-results__option .select2-results__option { + padding: 6px 12px; +} + +.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__group { + padding-left: 0; +} + +.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option { + margin-left: -12px; + padding-left: 24px; +} + +.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -24px; + padding-left: 36px; +} + +.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -36px; + padding-left: 48px; +} + +.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -48px; + padding-left: 60px; +} + +.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -60px; + padding-left: 72px; +} + +.select2-container--bootstrap .select2-results__group { + color: #777777; + display: block; + padding: 6px 12px; + font-size: 12px; + line-height: 1.42857143; + white-space: nowrap; +} + +.select2-container--bootstrap.select2-container--focus .select2-selection, .select2-container--bootstrap.select2-container--open .select2-selection { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + -o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + -webkit-transition: border-color ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s; + transition: border-color ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s; + transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s; + border-color: #66afe9; +} + +.select2-container--bootstrap.select2-container--open { + /** + * Make the dropdown arrow point up while the dropdown is visible. + */ + /** + * Handle border radii of the container when the dropdown is showing. + */ +} + +.select2-container--bootstrap.select2-container--open .select2-selection .select2-selection__arrow b { + border-color: transparent transparent #999 transparent; + border-width: 0 4px 4px 4px; +} + +.select2-container--bootstrap.select2-container--open.select2-container--below .select2-selection { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + border-bottom-color: transparent; +} + +.select2-container--bootstrap.select2-container--open.select2-container--above .select2-selection { + border-top-right-radius: 0; + border-top-left-radius: 0; + border-top-color: transparent; +} + +.select2-container--bootstrap .select2-selection__clear { + color: #999; + cursor: pointer; + float: right; + font-weight: bold; + margin-right: 10px; +} + +.select2-container--bootstrap .select2-selection__clear:hover { + color: #333; +} + +.select2-container--bootstrap.select2-container--disabled .select2-selection { + border-color: #ccc; + -webkit-box-shadow: none; + box-shadow: none; +} + +.select2-container--bootstrap.select2-container--disabled .select2-selection, +.select2-container--bootstrap.select2-container--disabled .select2-search__field { + cursor: not-allowed; +} + +.select2-container--bootstrap.select2-container--disabled .select2-selection, +.select2-container--bootstrap.select2-container--disabled .select2-selection--multiple .select2-selection__choice { + background-color: #eeeeee; +} + +.select2-container--bootstrap.select2-container--disabled .select2-selection__clear, +.select2-container--bootstrap.select2-container--disabled .select2-selection--multiple .select2-selection__choice__remove { + display: none; +} + +.select2-container--bootstrap .select2-dropdown { + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + border-color: #66afe9; + overflow-x: hidden; + margin-top: -1px; +} + +.select2-container--bootstrap .select2-dropdown--above { + -webkit-box-shadow: 0px -6px 12px rgba(0, 0, 0, 0.175); + box-shadow: 0px -6px 12px rgba(0, 0, 0, 0.175); + margin-top: 1px; +} + +.select2-container--bootstrap .select2-results > .select2-results__options { + max-height: 200px; + overflow-y: auto; +} + +.select2-container--bootstrap .select2-selection--single { + height: 34px; + line-height: 1.42857143; + padding: 6px 24px 6px 12px; + /** + * Adjust the single Select2's dropdown arrow button appearance. + */ +} + +.select2-container--bootstrap .select2-selection--single .select2-selection__arrow { + position: absolute; + bottom: 0; + right: 12px; + top: 0; + width: 4px; +} + +.select2-container--bootstrap .select2-selection--single .select2-selection__arrow b { + border-color: #999 transparent transparent transparent; + border-style: solid; + border-width: 4px 4px 0 4px; + height: 0; + left: 0; + margin-left: -4px; + margin-top: -2px; + position: absolute; + top: 50%; + width: 0; +} + +.select2-container--bootstrap .select2-selection--single .select2-selection__rendered { + color: #555555; + padding: 0; +} + +.select2-container--bootstrap .select2-selection--single .select2-selection__placeholder { + color: #999; +} + +.select2-container--bootstrap .select2-selection--multiple { + min-height: 34px; + padding: 0; + height: auto; + /** + * Make Multi Select2's choices match Bootstrap 3's default button styles. + */ + /** + * Minus 2px borders. + */ + /** + * Clear the selection. + */ +} + +.select2-container--bootstrap .select2-selection--multiple .select2-selection__rendered { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: block; + line-height: 1.42857143; + list-style: none; + margin: 0; + overflow: hidden; + padding: 0; + width: 100%; + text-overflow: ellipsis; + white-space: nowrap; +} + +.select2-container--bootstrap .select2-selection--multiple .select2-selection__placeholder { + color: #999; + float: left; + margin-top: 5px; +} + +.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice { + color: #555555; + background: #fff; + border: 1px solid #ccc; + border-radius: 4px; + cursor: default; + float: left; + margin: 5px 0 0 6px; + padding: 0 6px; +} + +.select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field { + background: transparent; + padding: 0 12px; + height: 32px; + line-height: 1.42857143; + margin-top: 0; + min-width: 5em; +} + +.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove { + color: #999; + cursor: pointer; + display: inline-block; + font-weight: bold; + margin-right: 3px; +} + +.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove:hover { + color: #333; +} + +.select2-container--bootstrap .select2-selection--multiple .select2-selection__clear { + margin-top: 6px; +} + +.select2-container--bootstrap .select2-selection--single.input-sm, +.input-group-sm .select2-container--bootstrap .select2-selection--single, +.form-group-sm .select2-container--bootstrap .select2-selection--single { + border-radius: 3px; + font-size: 12px; + height: 30px; + line-height: 1.5; + padding: 5px 22px 5px 10px; + /* 2 */ +} + +.select2-container--bootstrap .select2-selection--single.input-sm .select2-selection__arrow b, +.input-group-sm .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b, +.form-group-sm .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b { + margin-left: -5px; +} + +.select2-container--bootstrap .select2-selection--multiple.input-sm, +.input-group-sm .select2-container--bootstrap .select2-selection--multiple, +.form-group-sm .select2-container--bootstrap .select2-selection--multiple { + min-height: 30px; + border-radius: 3px; +} + +.select2-container--bootstrap .select2-selection--multiple.input-sm .select2-selection__choice, +.input-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice, +.form-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice { + font-size: 12px; + line-height: 1.5; + margin: 4px 0 0 5px; + padding: 0 5px; +} + +.select2-container--bootstrap .select2-selection--multiple.input-sm .select2-search--inline .select2-search__field, +.input-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field, +.form-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field { + padding: 0 10px; + font-size: 12px; + height: 28px; + line-height: 1.5; +} + +.select2-container--bootstrap .select2-selection--multiple.input-sm .select2-selection__clear, +.input-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear, +.form-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear { + margin-top: 5px; +} + +.select2-container--bootstrap .select2-selection--single.input-lg, +.input-group-lg .select2-container--bootstrap .select2-selection--single, +.form-group-lg .select2-container--bootstrap .select2-selection--single { + border-radius: 6px; + font-size: 18px; + height: 46px; + line-height: 1.3333333; + padding: 10px 31px 10px 16px; + /* 1 */ +} + +.select2-container--bootstrap .select2-selection--single.input-lg .select2-selection__arrow, +.input-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow, +.form-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow { + width: 5px; +} + +.select2-container--bootstrap .select2-selection--single.input-lg .select2-selection__arrow b, +.input-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b, +.form-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b { + border-width: 5px 5px 0 5px; + margin-left: -5px; + margin-left: -10px; + margin-top: -2.5px; +} + +.select2-container--bootstrap .select2-selection--multiple.input-lg, +.input-group-lg .select2-container--bootstrap .select2-selection--multiple, +.form-group-lg .select2-container--bootstrap .select2-selection--multiple { + min-height: 46px; + border-radius: 6px; +} + +.select2-container--bootstrap .select2-selection--multiple.input-lg .select2-selection__choice, +.input-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice, +.form-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice { + font-size: 18px; + line-height: 1.3333333; + border-radius: 4px; + margin: 9px 0 0 8px; + padding: 0 10px; +} + +.select2-container--bootstrap .select2-selection--multiple.input-lg .select2-search--inline .select2-search__field, +.input-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field, +.form-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field { + padding: 0 16px; + font-size: 18px; + height: 44px; + line-height: 1.3333333; +} + +.select2-container--bootstrap .select2-selection--multiple.input-lg .select2-selection__clear, +.input-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear, +.form-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear { + margin-top: 10px; +} + +.select2-container--bootstrap .select2-selection.input-lg.select2-container--open .select2-selection--single { + /** + * Make the dropdown arrow point up while the dropdown is visible. + */ +} + +.select2-container--bootstrap .select2-selection.input-lg.select2-container--open .select2-selection--single .select2-selection__arrow b { + border-color: transparent transparent #999 transparent; + border-width: 0 5px 5px 5px; +} + +.input-group-lg .select2-container--bootstrap .select2-selection.select2-container--open .select2-selection--single { + /** + * Make the dropdown arrow point up while the dropdown is visible. + */ +} + +.input-group-lg .select2-container--bootstrap .select2-selection.select2-container--open .select2-selection--single .select2-selection__arrow b { + border-color: transparent transparent #999 transparent; + border-width: 0 5px 5px 5px; +} + +.select2-container--bootstrap[dir="rtl"] { + /** + * Single Select2 + * + * 1. Makes sure that .select2-selection__placeholder is positioned + * correctly. + */ + /** + * Multiple Select2 + */ +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--single { + padding-left: 24px; + padding-right: 12px; +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--single .select2-selection__rendered { + padding-right: 0; + padding-left: 0; + text-align: right; + /* 1 */ +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--single .select2-selection__clear { + float: left; +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--single .select2-selection__arrow { + left: 12px; + right: auto; +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--single .select2-selection__arrow b { + margin-left: 0; +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--multiple .select2-selection__choice, +.select2-container--bootstrap[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder { + float: right; +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--multiple .select2-selection__choice { + margin-left: 0; + margin-right: 6px; +} + +.select2-container--bootstrap[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { + margin-left: 2px; + margin-right: auto; +} + +/*------------------------------------* #ADDITIONAL GOODIES +\*------------------------------------*/ +/** + * Address Bootstrap's validation states + * + * If a Select2 widget parent has one of Bootstrap's validation state modifier + * classes, adjust Select2's border colors and focus states accordingly. + * You may apply said classes to the Select2 dropdown (body > .select2-container) + * via JavaScript match Bootstraps' to make its styles match. + * + * @see http://getbootstrap.com/css/#forms-control-validation + */ +.has-warning .select2-dropdown, +.has-warning .select2-selection { + border-color: #8a6d3b; +} + +.has-warning .select2-container--focus .select2-selection, +.has-warning .select2-container--open .select2-selection { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; + border-color: #66512c; +} + +.has-warning.select2-drop-active { + border-color: #66512c; +} + +.has-warning.select2-drop-active.select2-drop.select2-drop-above { + border-top-color: #66512c; +} + +.has-error .select2-dropdown, +.has-error .select2-selection { + border-color: #a94442; +} + +.has-error .select2-container--focus .select2-selection, +.has-error .select2-container--open .select2-selection { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; + border-color: #843534; +} + +.has-error.select2-drop-active { + border-color: #843534; +} + +.has-error.select2-drop-active.select2-drop.select2-drop-above { + border-top-color: #843534; +} + +.has-success .select2-dropdown, +.has-success .select2-selection { + border-color: #3c763d; +} + +.has-success .select2-container--focus .select2-selection, +.has-success .select2-container--open .select2-selection { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; + border-color: #2b542c; +} + +.has-success.select2-drop-active { + border-color: #2b542c; +} + +.has-success.select2-drop-active.select2-drop.select2-drop-above { + border-top-color: #2b542c; +} + +/** + * Select2 widgets in Bootstrap Input Groups + * + * When Select2 widgets are combined with other elements using Bootstraps + * "Input Group" component, we don't want specific edges of the Select2 + * container to have a border-radius. + * + * Use .select2-bootstrap-prepend and .select2-bootstrap-append on + * a Bootstrap 3 .input-group to let the contained Select2 widget know which + * edges should not be rounded as they are directly followed by another element. + * + * @see http://getbootstrap.com/components/#input-groups + */ +/** + * Mimick Bootstraps .input-group .form-control styles. + * + * @see https://github.com/twbs/bootstrap/blob/master/less/input-groups.less + */ +.input-group .select2-container--bootstrap { + display: table; + table-layout: fixed; + position: relative; + z-index: 2; + float: left; + width: 100%; + margin-bottom: 0; + /** + * Adjust z-index like Bootstrap does to show the focus-box-shadow + * above appended buttons in .input-group and .form-group. + */ +} + +.input-group .select2-container--bootstrap.select2-container--open, .input-group .select2-container--bootstrap.select2-container--focus { + z-index: 3; +} + +.input-group.select2-bootstrap-prepend .select2-container--bootstrap .select2-selection { + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} + +.input-group.select2-bootstrap-append .select2-container--bootstrap .select2-selection { + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} + +/** + * Adjust alignment of Bootstrap buttons in Bootstrap Input Groups to address + * Multi Select2's height which - depending on how many elements have been selected - + * may grow taller than its initial size. + * + * @see http://getbootstrap.com/components/#input-groups + */ +.select2-bootstrap-append .select2-container--bootstrap, +.select2-bootstrap-append .input-group-btn, +.select2-bootstrap-append .input-group-btn .btn, +.select2-bootstrap-prepend .select2-container--bootstrap, +.select2-bootstrap-prepend .input-group-btn, +.select2-bootstrap-prepend .input-group-btn .btn { + vertical-align: top; +} + +/** + * Temporary fix for https://github.com/select2/select2-bootstrap-theme/issues/9 + * + * Provides `!important` for certain properties of the class applied to the + * original `<select>` element to hide it. + * + * @see https://github.com/select2/select2/pull/3301 + * @see https://github.com/fk/select2/commit/31830c7b32cb3d8e1b12d5b434dee40a6e753ada + */ +.form-control.select2-hidden-accessible { + position: absolute !important; + width: 1px !important; +} + +/** + * Display override for inline forms + */ +.form-inline .select2-container--bootstrap { + display: inline-block; +} diff --git a/app/assets/stylesheets/vendor/select2.css b/app/assets/stylesheets/vendor/select2.css new file mode 100644 index 000000000..447b2b86c --- /dev/null +++ b/app/assets/stylesheets/vendor/select2.css @@ -0,0 +1,484 @@ +.select2-container { + box-sizing: border-box; + display: inline-block; + margin: 0; + position: relative; + vertical-align: middle; } + .select2-container .select2-selection--single { + box-sizing: border-box; + cursor: pointer; + display: block; + height: 28px; + user-select: none; + -webkit-user-select: none; } + .select2-container .select2-selection--single .select2-selection__rendered { + display: block; + padding-left: 8px; + padding-right: 20px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } + .select2-container .select2-selection--single .select2-selection__clear { + position: relative; } + .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered { + padding-right: 8px; + padding-left: 20px; } + .select2-container .select2-selection--multiple { + box-sizing: border-box; + cursor: pointer; + display: block; + min-height: 32px; + user-select: none; + -webkit-user-select: none; } + .select2-container .select2-selection--multiple .select2-selection__rendered { + display: inline-block; + overflow: hidden; + padding-left: 8px; + text-overflow: ellipsis; + white-space: nowrap; } + .select2-container .select2-search--inline { + float: left; } + .select2-container .select2-search--inline .select2-search__field { + box-sizing: border-box; + border: none; + font-size: 100%; + margin-top: 5px; + padding: 0; } + .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button { + -webkit-appearance: none; } + +.select2-dropdown { + background-color: white; + border: 1px solid #aaa; + border-radius: 4px; + box-sizing: border-box; + display: block; + position: absolute; + left: -100000px; + width: 100%; + z-index: 1051; } + +.select2-results { + display: block; } + +.select2-results__options { + list-style: none; + margin: 0; + padding: 0; } + +.select2-results__option { + padding: 6px; + user-select: none; + -webkit-user-select: none; } + .select2-results__option[aria-selected] { + cursor: pointer; } + +.select2-container--open .select2-dropdown { + left: 0; } + +.select2-container--open .select2-dropdown--above { + border-bottom: none; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } + +.select2-container--open .select2-dropdown--below { + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; } + +.select2-search--dropdown { + display: block; + padding: 4px; } + .select2-search--dropdown .select2-search__field { + padding: 4px; + width: 100%; + box-sizing: border-box; } + .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button { + -webkit-appearance: none; } + .select2-search--dropdown.select2-search--hide { + display: none; } + +.select2-close-mask { + border: 0; + margin: 0; + padding: 0; + display: block; + position: fixed; + left: 0; + top: 0; + min-height: 100%; + min-width: 100%; + height: auto; + width: auto; + opacity: 0; + z-index: 99; + background-color: #fff; + filter: alpha(opacity=0); } + +.select2-hidden-accessible { + border: 0 !important; + clip: rect(0 0 0 0) !important; + height: 1px !important; + margin: -1px !important; + overflow: hidden !important; + padding: 0 !important; + position: absolute !important; + width: 1px !important; } + +.select2-container--default .select2-selection--single { + background-color: #fff; + border: 1px solid #aaa; + border-radius: 4px; } + .select2-container--default .select2-selection--single .select2-selection__rendered { + color: #444; + line-height: 28px; } + .select2-container--default .select2-selection--single .select2-selection__clear { + cursor: pointer; + float: right; + font-weight: bold; } + .select2-container--default .select2-selection--single .select2-selection__placeholder { + color: #999; } + .select2-container--default .select2-selection--single .select2-selection__arrow { + height: 26px; + position: absolute; + top: 1px; + right: 1px; + width: 20px; } + .select2-container--default .select2-selection--single .select2-selection__arrow b { + border-color: #888 transparent transparent transparent; + border-style: solid; + border-width: 5px 4px 0 4px; + height: 0; + left: 50%; + margin-left: -4px; + margin-top: -2px; + position: absolute; + top: 50%; + width: 0; } + +.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear { + float: left; } + +.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow { + left: 1px; + right: auto; } + +.select2-container--default.select2-container--disabled .select2-selection--single { + background-color: #eee; + cursor: default; } + .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear { + display: none; } + +.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { + border-color: transparent transparent #888 transparent; + border-width: 0 4px 5px 4px; } + +.select2-container--default .select2-selection--multiple { + background-color: white; + border: 1px solid #aaa; + border-radius: 4px; + cursor: text; } + .select2-container--default .select2-selection--multiple .select2-selection__rendered { + box-sizing: border-box; + list-style: none; + margin: 0; + padding: 0 5px; + width: 100%; } + .select2-container--default .select2-selection--multiple .select2-selection__rendered li { + list-style: none; } + .select2-container--default .select2-selection--multiple .select2-selection__placeholder { + color: #999; + margin-top: 5px; + float: left; } + .select2-container--default .select2-selection--multiple .select2-selection__clear { + cursor: pointer; + float: right; + font-weight: bold; + margin-top: 5px; + margin-right: 10px; } + .select2-container--default .select2-selection--multiple .select2-selection__choice { + background-color: #e4e4e4; + border: 1px solid #aaa; + border-radius: 4px; + cursor: default; + float: left; + margin-right: 5px; + margin-top: 5px; + padding: 0 5px; } + .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { + color: #999; + cursor: pointer; + display: inline-block; + font-weight: bold; + margin-right: 2px; } + .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { + color: #333; } + +.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline { + float: right; } + +.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice { + margin-left: 5px; + margin-right: auto; } + +.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { + margin-left: 2px; + margin-right: auto; } + +.select2-container--default.select2-container--focus .select2-selection--multiple { + border: solid black 1px; + outline: 0; } + +.select2-container--default.select2-container--disabled .select2-selection--multiple { + background-color: #eee; + cursor: default; } + +.select2-container--default.select2-container--disabled .select2-selection__choice__remove { + display: none; } + +.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple { + border-top-left-radius: 0; + border-top-right-radius: 0; } + +.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } + +.select2-container--default .select2-search--dropdown .select2-search__field { + border: 1px solid #aaa; } + +.select2-container--default .select2-search--inline .select2-search__field { + background: transparent; + border: none; + outline: 0; + box-shadow: none; + -webkit-appearance: textfield; } + +.select2-container--default .select2-results > .select2-results__options { + max-height: 200px; + overflow-y: auto; } + +.select2-container--default .select2-results__option[role=group] { + padding: 0; } + +.select2-container--default .select2-results__option[aria-disabled=true] { + color: #999; } + +.select2-container--default .select2-results__option[aria-selected=true] { + background-color: #ddd; } + +.select2-container--default .select2-results__option .select2-results__option { + padding-left: 1em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__group { + padding-left: 0; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option { + margin-left: -1em; + padding-left: 2em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -2em; + padding-left: 3em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -3em; + padding-left: 4em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -4em; + padding-left: 5em; } + .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { + margin-left: -5em; + padding-left: 6em; } + +.select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: #5897fb; + color: white; } + +.select2-container--default .select2-results__group { + cursor: default; + display: block; + padding: 6px; } + +.select2-container--classic .select2-selection--single { + background-color: #f7f7f7; + border: 1px solid #aaa; + border-radius: 4px; + outline: 0; + background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%); + background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%); + background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); } + .select2-container--classic .select2-selection--single:focus { + border: 1px solid #5897fb; } + .select2-container--classic .select2-selection--single .select2-selection__rendered { + color: #444; + line-height: 28px; } + .select2-container--classic .select2-selection--single .select2-selection__clear { + cursor: pointer; + float: right; + font-weight: bold; + margin-right: 10px; } + .select2-container--classic .select2-selection--single .select2-selection__placeholder { + color: #999; } + .select2-container--classic .select2-selection--single .select2-selection__arrow { + background-color: #ddd; + border: none; + border-left: 1px solid #aaa; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + height: 26px; + position: absolute; + top: 1px; + right: 1px; + width: 20px; + background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%); + background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%); + background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); } + .select2-container--classic .select2-selection--single .select2-selection__arrow b { + border-color: #888 transparent transparent transparent; + border-style: solid; + border-width: 5px 4px 0 4px; + height: 0; + left: 50%; + margin-left: -4px; + margin-top: -2px; + position: absolute; + top: 50%; + width: 0; } + +.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear { + float: left; } + +.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow { + border: none; + border-right: 1px solid #aaa; + border-radius: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + left: 1px; + right: auto; } + +.select2-container--classic.select2-container--open .select2-selection--single { + border: 1px solid #5897fb; } + .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow { + background: transparent; + border: none; } + .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b { + border-color: transparent transparent #888 transparent; + border-width: 0 4px 5px 4px; } + +.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single { + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; + background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%); + background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%); + background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); } + +.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single { + border-bottom: none; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%); + background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%); + background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); } + +.select2-container--classic .select2-selection--multiple { + background-color: white; + border: 1px solid #aaa; + border-radius: 4px; + cursor: text; + outline: 0; } + .select2-container--classic .select2-selection--multiple:focus { + border: 1px solid #5897fb; } + .select2-container--classic .select2-selection--multiple .select2-selection__rendered { + list-style: none; + margin: 0; + padding: 0 5px; } + .select2-container--classic .select2-selection--multiple .select2-selection__clear { + display: none; } + .select2-container--classic .select2-selection--multiple .select2-selection__choice { + background-color: #e4e4e4; + border: 1px solid #aaa; + border-radius: 4px; + cursor: default; + float: left; + margin-right: 5px; + margin-top: 5px; + padding: 0 5px; } + .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove { + color: #888; + cursor: pointer; + display: inline-block; + font-weight: bold; + margin-right: 2px; } + .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover { + color: #555; } + +.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice { + float: right; } + +.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice { + margin-left: 5px; + margin-right: auto; } + +.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { + margin-left: 2px; + margin-right: auto; } + +.select2-container--classic.select2-container--open .select2-selection--multiple { + border: 1px solid #5897fb; } + +.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple { + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; } + +.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple { + border-bottom: none; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } + +.select2-container--classic .select2-search--dropdown .select2-search__field { + border: 1px solid #aaa; + outline: 0; } + +.select2-container--classic .select2-search--inline .select2-search__field { + outline: 0; + box-shadow: none; } + +.select2-container--classic .select2-dropdown { + background-color: white; + border: 1px solid transparent; } + +.select2-container--classic .select2-dropdown--above { + border-bottom: none; } + +.select2-container--classic .select2-dropdown--below { + border-top: none; } + +.select2-container--classic .select2-results > .select2-results__options { + max-height: 200px; + overflow-y: auto; } + +.select2-container--classic .select2-results__option[role=group] { + padding: 0; } + +.select2-container--classic .select2-results__option[aria-disabled=true] { + color: grey; } + +.select2-container--classic .select2-results__option--highlighted[aria-selected] { + background-color: #3875d7; + color: white; } + +.select2-container--classic .select2-results__group { + cursor: default; + display: block; + padding: 6px; } + +.select2-container--classic.select2-container--open .select2-dropdown { + border-color: #5897fb; } diff --git a/app/views/routes/_form.html.slim b/app/views/routes/_form.html.slim index 2b1fe0687..cb22e3a70 100644 --- a/app/views/routes/_form.html.slim +++ b/app/views/routes/_form.html.slim @@ -24,7 +24,6 @@ .row style="margin-top:20px" .col-lg-12.col-md-12.col-sm-12.col-xs-12 #stop_points - / #stop_points / div.clearfix style="margin-bottom:5px" / label style="margin:0" Arrêts / .btn.btn-primary.btn-xs.pull-right data-event="add_stop_point" @@ -46,7 +45,6 @@ = link_to 'Annuler', :back, class: 'btn btn-link' = f.button :submit, class: 'btn btn-danger' - // Get JSON data for route stop points = javascript_tag do | window.itinerary_stop = "#{URI.escape(@route.stop_areas.all.to_json)}" diff --git a/package.json b/package.json index 4ef792f7e..99c7916c1 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "react": "^15.3.2", "react-dom": "^15.3.2", "react-redux": "^4.4.5", + "react-select2": "^4.0.2", "redux": "^3.6.0" }, "license": "MIT", |
