README.md in materialize-form-1.0.3 vs README.md in materialize-form-1.0.4
- old
+ new
@@ -5,52 +5,54 @@
There is an example application available on Heroku that demonstrate various features of Materialize::Form. You can view here: http://materialize-form.herokuapp.com/. To see the [Source Code](https://github.com/jamesfwz/materialize-form-example)
Haven't install [SimpleForm](https://github.com/plataformatec/simple_form) and [MaterializeCSS](http://materializecss.com/)? Please follow this instruction:
Add this line to your application's Gemfile:
-``` ruby
+
+```
gem 'simple_form'
gem 'materialize-sass'
```
-```console
+
+```
$ bundle install
rails generate simple_form:install
```
+
Import Materialize styles in app/assets/stylesheets/application.scss:
-```scss
+
+```
@import "materialize";
```
+
**NOTE:** If you have just generated a new Rails application, it may come with a `.css` file instead. If this file exists, it will be served instead of Sass, so remove it.
-```console
+```
$ rm app/assets/stylesheets/application.css
```
## Installation
### Step 1:
Add this line to your application's Gemfile:
-```ruby
+```
gem 'materialize-form'
```
### Step 2:
Run the bundler and restart your server to make the files available through the pipeline and run the generator
-```console
+```
$ bundle install
$ rails generate simple_form:materialize:install
```
### Step 3:
Import Materialize Form javascript in `app/assets/javascripts/application.js`:
-```js
-//= require materialize-form
-$(document).ready(function() {
- window.materializeForm.init()
-});
```
+//= require materialize-form
+```
## Usage
### Assume you are using SLIM
To start using Materialize Form you just have to use the helper it provides:
@@ -113,10 +115,10 @@
## Working with [Nested Form](https://github.com/ryanb/nested_form)
In `app/assets/javascripts/application.js`:
-```js
+```
$(document).on('nested:fieldAdded', function(event){
window.materializeForm.init()
})
```