Making WordPress.org

Changeset 3105


Ignore:
Timestamp:
05/10/2016 04:12:06 PM (10 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Make fields optional when setting status to incomplete.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js

    r2819 r3105  
    2323                        needsIntermediaryBank.trigger( 'change' ); // Set the initial state
    2424
    25                         $( '#wcb-save-draft' ).click( app.makeFieldsOptionalForDrafts );
    26                 },
    27 
    28                 /**
    29                  * Make all required input field optional when saving a draft.
    30                  *
    31                  * Otherwise the user would have to potentially fill out dozens of fields when they're not ready to.
    32                  *
    33                  * @param {object} event
    34                  */
    35                 makeFieldsOptionalForDrafts : function( event ) {
     25                        $( '#wcb-save-draft' ).click( app.makeFieldsOptional      );
     26                        $( '#wcb-update'     ).click( app.maybeMakeFieldsOptional );
     27                },
     28
     29                /**
     30                 * Make all required fields optional under certain circumstances.
     31                 */
     32                maybeMakeFieldsOptional : function() {
     33                        var status = $( '#wcb_status' ).val();
     34
     35                        if ( 'draft' === status || 'wcb-incomplete' === status ) {
     36                                app.makeFieldsOptional();
     37
     38                                if ( 'wcb-incomplete' === status ) {
     39                                        $( '#wcp_mark_incomplete_notes' ).prop( 'required', true );
     40                                }
     41                        }
     42                },
     43
     44                /**
     45                 * Make all required input field optional.
     46                 *
     47                 * This is used when saving drafts, setting posts to the Incomplete status, etc. Otherwise the user would
     48                 * have to potentially fill out dozens of fields when they're not ready to.
     49                 *
     50                 * @param {object} event
     51                 */
     52                makeFieldsOptional : function( event ) {
    3653                        $( '#poststuff' ).find( ':input[required]' ).each( function( fieldIndex, inputField ) {
    3754                                $( inputField ).prop( 'required', false );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-status.php

    r2682 r3105  
    3939                                                <?php if ( current_user_can( 'manage_network' ) ) : ?>
    4040
    41                                                         <select name="post_status">
     41                                                        <select id="wcb_status" name="post_status">
    4242                                                                <?php foreach ( self::get_post_statuses() as $status ) : ?>
    4343                                                                        <?php $status = get_post_status_object( $status ); ?>
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/reimbursement-request/metabox-status.php

    r2646 r3105  
    4343                                                <?php if ( current_user_can( 'manage_network' ) ) : ?>
    4444
    45                                                         <select name="post_status">
     45                                                        <select id="wcb_status" name="post_status">
    4646                                                                <?php foreach ( get_post_statuses() as $status ) : ?>
    4747                                                                        <?php $status = get_post_status_object( $status ); ?>
Note: See TracChangeset for help on using the changeset viewer.