Sha256: 61ac85c4f8c109e8ef3827fb255f1d05375381c279b0c1f4cb70b6a4c7c93262

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

# SimpleFormCustomInputs

![](screenshot.png)

## Availables inputs

- [x] Switch/Toggle with Switchery
- [x] Masked inputs
- [ ] Datepicker
- [ ] Datetimepicker

## Installation

Add the following gems to your application's Gemfile:

```ruby
gem 'simple_form'
gem 'simple_form_custom_inputs'

source 'https://rails-assets.org' do
  gem 'rails-assets-switchery'
  gem 'rails-assets-jquery.maskedinput'
end
```

And then execute:

```bash
$ bundle install
$ rails generate simple_form:install
```

## Usage

In app/assets/javascripts/application.js, you should add as follows:

```js
//= require ...
//= require switchery
//= require jquery.maskedinput
//= require simple_form_custom_inputs
//= require ...
```

Application.scss

```scss
@import "switchery";
```

Basic Example:

```erb
<%= simple_form_for :example do |f| %>
  ...
  <%= f.input :boolean, as: :switch %>
  ...
<% end %>

<%= simple_form_for :example do |f| %>
  ...
  <%= f.input :phone, as: :masked, input_html: {data: {pattern: '(99) 99999-9999'}} %>
  ...
<% end %>
```

Want some more customization on Switch?

```erb
<%= simple_form_for :example do |f| %>
  ...
  <%= f.input :boolean, as: :switch, input_html: {data: {color: '#FF0', secondary_color: '#0F0', jack_color: '#FFF', jack_secondary_color: '#000', size: 'small'}} %>
  ...
<% end %>
```

## Sample projects

For an example, take a look at the `example` folder in this repository.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_form_custom_inputs-0.0.2 README.md