67
67
` f.input :title, input_html: { 'data-function': 'title_empty', 'data-then': 'slide', 'data-target': '#article_description_input' } `
68
68
69
69
``` js
70
- function title_empty ( el ) {
71
- return ( $ (' #article_title' ).val ().trim () === ' ' );
70
+ function title_empty (el ) {
71
+ return ($ (' #article_title' ).val ().trim () === ' ' );
72
72
}
73
73
```
74
74
@@ -77,10 +77,10 @@ function title_empty( el ) {
77
77
` f.input :published, input_html: { data: { if: 'checked', then: 'callback set_title', args: '["Unpublished !"]' } } `
78
78
79
79
``` js
80
- function set_title ( args ) {
81
- if ( $ (' #article_title' ).val ().trim () === ' ' ) {
82
- $ (' #article_title' ).val ( args[0 ] );
83
- $ (' #article_title' ).trigger ( ' change' );
80
+ function set_title (args ) {
81
+ if ($ (' #article_title' ).val ().trim () === ' ' ) {
82
+ $ (' #article_title' ).val (args[0 ]);
83
+ $ (' #article_title' ).trigger (' change' );
84
84
}
85
85
}
86
86
```
@@ -90,10 +90,10 @@ function set_title( args ) {
90
90
` f2.input :category, as: :select, collection: [ [ 'Cat 1', 'cat1' ], [ 'Cat 2', 'cat2' ], [ 'Cat 3', 'cat3' ] ], input_html: { 'data-function': 'on_change_category' } `
91
91
92
92
``` js
93
- function on_change_category ( el ) {
94
- var target = el .closest ( ' fieldset' ).find ( ' .pub' );
95
- target .prop ( ' checked' , ( el .val () == ' cat2' ) );
96
- target .trigger ( ' change' );
93
+ function on_change_category (el ) {
94
+ var target = el .closest (' fieldset' ).find (' .pub' );
95
+ target .prop (' checked' , (el .val () == ' cat2' );
96
+ target .trigger (' change' );
97
97
}
98
98
` ` `
99
99
0 commit comments