Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandymint/simple_form_bootstrap_inputs
date, currency and date_time inputs for SimpleForm and Bootstrap
https://github.com/brandymint/simple_form_bootstrap_inputs
bootstrap3 gem ruby ruby-gem simpleform
Last synced: 28 days ago
JSON representation
date, currency and date_time inputs for SimpleForm and Bootstrap
- Host: GitHub
- URL: https://github.com/brandymint/simple_form_bootstrap_inputs
- Owner: BrandyMint
- License: mit
- Created: 2018-11-27T13:56:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-10T10:45:15.000Z (almost 6 years ago)
- Last Synced: 2024-09-28T16:20:52.751Z (about 1 month ago)
- Topics: bootstrap3, gem, ruby, ruby-gem, simpleform
- Language: Ruby
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# SimpleFormBootstrapInputs
## Установка
```ruby
gem 'simple_form_bootstrap_inputs', github: 'BrandyMint/simple_form_bootstrap_inputs'
``````bash
$ bundle
```Необходим bootstrap и bootstrap-datetimepicker\
В application.js:\
//= require bootstrap\
//= require bootstrap-datetimepicker
```javascript
document.addEventListener("turbolinks:load", function() {
$('div.datetimepicker').datetimepicker({ locale: 'ru', format: 'DD-MM-YYYY' });
});
```## Использование
Пример
```ruby
= simple_form_for model do |f|
= f.input :date, as: 'simple_form_bootstrap_inputs/date_picker'
= f.input :currency, as: 'simple_form_bootstrap_inputs/currency'
= f.input :datetime, as: 'simple_form_bootstrap_inputs/datetime_picker'
...
```
date - дата по умолчанию в формате: 'YYYY-MM-DD'\
![date](/doc/date.png)\
datetime - дата и время в формате: 'YYYY-MM-DD' + ' ' + 'HH:mm'\
![datetime](/doc/datetime.png)\
currency:\
у model должны быть 2 аттрибута, например - value и value_currency - string\
![currency](/doc/currency.png)