README.md in activeadmin_dynamic_fields-0.2.2 vs README.md in activeadmin_dynamic_fields-0.2.6
- old
+ new
@@ -7,11 +7,11 @@
- set conditional checks on fields
- trigger some actions on other fields
- inline field editing
- create links to load some content in a dialog
-The easiest way to show how this plugin works is looking the examples [below](#examples-of-dynamic-fields).
+The easiest way to show how this plugin works is looking the examples [below](#examples).
## Install
- Add to your Gemfile: `gem 'activeadmin_dynamic_fields'`
- Execute bundle
@@ -44,26 +44,26 @@
## Examples
### Dynamic fields examples
-- A checkbox that hides other fields if false (ex. model *Article*):
+- A checkbox that hides other fields if is checked (ex. model *Article*):
```rb
form do |f|
f.inputs 'Article' do
- f.input :published, input_html: { data: { if: 'not_checked', action: 'hide', target: '.grp1' } }
+ f.input :published, input_html: { data: { if: 'checked', action: 'hide', target: '.grp1' } }
f.input :online_date, wrapper_html: { class: 'grp1' }
- f.input :position, wrapper_html: { class: 'grp1' }
+ f.input :draft_notes, wrapper_html: { class: 'grp1' }
end
f.actions
end
```
-- Add 3 classes (*first*, *second*, *third*) if a checkbox is true:
+- Add 3 classes (*first*, *second*, *third*) if a checkbox is not checked:
-`f.input :published, input_html: { data: { if: 'checked', action: 'addClass first second third', target: '.grp1' } }`
+`f.input :published, input_html: { data: { if: 'not_checked', action: 'addClass first second third', target: '.grp1' } }`
- Set another field value if a string field is blank:
`f.input :title, input_html: { data: { if: 'blank', action: 'setValue 10', target: '#article_position' } }`
@@ -181,9 +181,11 @@
The link url is loaded via AJAX before opening the dialog.
## Do you like it? Star it!
If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
+
+Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source) that I made if you are curious.
## Contributors
- [Mattia Roccoberton](http://blocknot.es) - creator, maintainer