6767` f.input :title, input_html: { 'data-function': 'title_empty', 'data-then': 'slide', 'data-target': '#article_description_input' } `
6868
6969``` js
70- function title_empty ( el ) {
71- return ( $ (' #article_title' ).val ().trim () === ' ' );
70+ function title_empty (el ) {
71+ return ($ (' #article_title' ).val ().trim () === ' ' );
7272}
7373```
7474
@@ -77,10 +77,10 @@ function title_empty( el ) {
7777` f.input :published, input_html: { data: { if: 'checked', then: 'callback set_title', args: '["Unpublished !"]' } } `
7878
7979``` 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' );
8484 }
8585}
8686```
@@ -90,10 +90,10 @@ function set_title( args ) {
9090` f2.input :category, as: :select, collection: [ [ 'Cat 1', 'cat1' ], [ 'Cat 2', 'cat2' ], [ 'Cat 3', 'cat3' ] ], input_html: { 'data-function': 'on_change_category' } `
9191
9292``` 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' );
9797}
9898` ` `
9999
0 commit comments