Skip to content

date, currency and date_time inputs for SimpleForm and Bootstrap

License

Notifications You must be signed in to change notification settings

BrandyMint/simple_form_bootstrap_inputs

Repository files navigation

SimpleFormBootstrapInputs

Установка

gem 'simple_form_bootstrap_inputs', github: 'BrandyMint/simple_form_bootstrap_inputs'
$ bundle

Необходим bootstrap и bootstrap-datetimepicker
В application.js:
//= require bootstrap
//= require bootstrap-datetimepicker

document.addEventListener("turbolinks:load", function() {
  $('div.datetimepicker').datetimepicker({ locale: 'ru', format: 'DD-MM-YYYY' });
});

Использование

Пример

= 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
datetime - дата и время в формате: 'YYYY-MM-DD' + ' ' + 'HH:mm'
datetime
currency:
у model должны быть 2 аттрибута, например - value и value_currency - string
currency

About

date, currency and date_time inputs for SimpleForm and Bootstrap

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published