No commit activity in last 3 years
No release in over 3 years
Provides date, currency and date_time inputs for SimpleForm and Bootstrap
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

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