Making WordPress.org

Changeset 2330


Ignore:
Timestamp:
01/19/2016 08:55:27 PM (10 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Set the initial state for the Payment Request category.

Previously, if the post was saved with an Other category, the extra description box would be hidden on new page loads, since the toggle callback was only triggered during changes.

File:
1 edited

Legend:

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

    r2329 r2330  
    2222         */
    2323        registerEventHandlers : function() {
     24            var paymentCategory = $( '#payment_category' );
     25           
    2426            $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( wcb.togglePaymentMethodFields );
    25             $( '#payment_category' ).change( app.toggleOtherCategoryDescription );
    26                 // todo this needs to fire onLoad too, otherwise the field is hidden
     27            paymentCategory.change( app.toggleOtherCategoryDescription );
     28            paymentCategory.trigger( 'change' );   // Set the initial state
    2729            $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( { title : wcpLocalizedStrings.uploadModalTitle }, wcb.showUploadModal );
    2830            $( '#wcp_mark_incomplete_checkbox' ).click( app.requireNotes );
Note: See TracChangeset for help on using the changeset viewer.