/** * application_notes metabox */ public static function application_notes($post) { job_application_notes($post); ?> <script type="text/javascript"> jQuery(function(){ jQuery('#job_application_notes') .on( 'click', '.job-application-note-add input.button', function() { var button = jQuery(this); var application_id = button.data('application_id'); var job_application = jQuery(this).closest('#job_application_notes'); var job_application_note = job_application.find('textarea'); var disabled_attr = jQuery(this).attr('disabled'); var job_application_notes_list = job_application.find('ul.job-application-notes-list'); if ( typeof disabled_attr !== 'undefined' && disabled_attr !== false ) { return false; } if ( ! job_application_note.val() ) { return false; } button.attr( 'disabled', 'disabled' ); var data = { action: 'add_job_application_note', note: job_application_note.val(), application_id: application_id, security: '<?php echo wp_create_nonce("job-application-notes"); ?> ' }; jQuery.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function( response ) { job_application_notes_list.append( response ); button.removeAttr( 'disabled' ); job_application_note.val( '' ); }); return false; }) .on( 'click', 'a.delete_note', function() { var answer = confirm( '<?php echo __('Are you sure you want to delete this? There is no undo.', 'wp-job-manager-applications'); ?> ' ); if ( answer ) { var button = jQuery(this); var note = jQuery(this).closest('li'); var note_id = note.attr('rel'); var data = { action: 'delete_job_application_note', note_id: note_id, security: '<?php echo wp_create_nonce("job-application-notes"); ?> ' }; jQuery.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function( response ) { note.fadeOut( 500, function() { note.remove(); }); }); } return false; }); }); </script> <?php }
<section class="job-application-content"> <?php job_application_meta($application); ?> <?php job_application_content($application); ?> </section> <section class="job-application-edit"> <?php job_application_edit($application); ?> </section> <section class="job-application-notes"> <?php job_application_notes($application); ?> </section> <footer> <?php job_application_footer($application); ?> </footer> </li> <?php } ?> </ul> <?php get_job_manager_template('pagination.php', array('max_num_pages' => $max_num_pages)); ?>