Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zokioki/flatpickr-rails
This gem packages flatpickr's assets for drop-in use in Rails applications.
https://github.com/zokioki/flatpickr-rails
datepicker rails timepicker
Last synced: 15 days ago
JSON representation
This gem packages flatpickr's assets for drop-in use in Rails applications.
- Host: GitHub
- URL: https://github.com/zokioki/flatpickr-rails
- Owner: zokioki
- License: mit
- Created: 2016-11-27T01:27:18.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-19T07:55:57.000Z (about 1 year ago)
- Last Synced: 2024-12-17T04:56:54.627Z (17 days ago)
- Topics: datepicker, rails, timepicker
- Language: Ruby
- Homepage:
- Size: 593 KB
- Stars: 38
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# flatpickr
[![Gem Version](https://badge.fury.io/rb/flatpickr.svg)](https://badge.fury.io/rb/flatpickr)
[Flatpickr](https://github.com/flatpickr/flatpickr) is a lightweight and powerful datetimepicker with no dependencies. This gem packages flatpickr's assets for drop-in use in Rails applications.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'flatpickr'
```And then execute:
```bash
$ bundle
```In your application.css, add the following:
```
*= require flatpickr/* Optionally, you can include any of the flatpickr themes by adding in their styles, like so: */
*= require flatpickr/themes/dark
```And in your application.js:
```js
//= require flatpickrdocument.addEventListener('DOMContentLoaded', function() {
flatpickr('.your-selector');
})
```#### Using Plugins
Flatpickr provides plugins which expand the library's functionality. To include the `confirmDate` plugin, for example, you must require the necessary assets and specify the plugin during initialization:
In your application.css:
```
*= require flatpickr
*= require flatpickr/plugins/confirmDate/confirmDate
```In application.js:
```js
//= require flatpickr
//= require flatpickr/plugins/confirmDate/confirmDatedocument.addEventListener('DOMContentLoaded', function() {
flatpickr('.your-selector', {
enableTime: true,
plugins: [
new confirmDatePlugin({})
]
})
})
```See [flatpickr's official docs](https://flatpickr.js.org/) for more configuration and usage details.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).