Making WordPress.org

Changeset 2276


Ignore:
Timestamp:
01/12/2016 03:56:43 PM (11 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Rename wordcamp-budgets script to payment-requests.

It only deals with payment requests, rather than having functionality common to all modules.

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

Legend:

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

    r2272 r2276  
    2424                // Register our assets
    2525                wp_register_script(
    26                         'wordcamp-budgets',
    27                         plugins_url( 'javascript/wordcamp-budgets.js', __DIR__ ),
     26                        'payment-requests',
     27                        plugins_url( 'javascript/payment-requests.js', __DIR__ ),
    2828                        array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ),
    2929                        self::VERSION,
     
    3434                        'wcp-attached-files',
    3535                        plugins_url( 'javascript/attached-files.js', __DIR__ ),
    36                         array( 'wordcamp-budgets', 'backbone', 'wp-util' ),
     36                        array( 'payment-requests', 'backbone', 'wp-util' ),
    3737                        self::VERSION,
    3838                        true
     
    5656
    5757                if ( in_array( $current_screen->id, array( 'edit-wcp_payment_request', 'wcp_payment_request' ) ) ) {
    58                         wp_enqueue_script( 'wordcamp-budgets' );
     58                        wp_enqueue_script( 'payment-requests' );
    5959                        wp_enqueue_style( 'wordcamp-budgets' );
    6060
     
    6565
    6666                        wp_localize_script(
    67                                 'wordcamp-budgets',
     67                                'payment-requests',
    6868                                'wcpLocalizedStrings',          // todo merge into wordcampBudgets var
    6969                                array(
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js

    r2272 r2276  
    44         * Model for an attached file
    55         */
    6         $.wordcampBudgets.AttachedFile = Backbone.Model.extend( {
     6        $.paymentRequests.AttachedFile = Backbone.Model.extend( {
    77                defaults: {
    88                        'ID':          0,
     
    1616         * Collection of attached files
    1717         */
    18         $.wordcampBudgets.AttachedFiles = Backbone.Collection.extend( {
    19                 model: $.wordcampBudgets.AttachedFile
     18        $.paymentRequests.AttachedFiles = Backbone.Collection.extend( {
     19                model: $.paymentRequests.AttachedFile
    2020        } );
    2121
     
    2323         * View for a single attached file
    2424         */
    25         $.wordcampBudgets.AttachedFileView = Backbone.View.extend( {
     25        $.paymentRequests.AttachedFileView = Backbone.View.extend( {
    2626                tagName: 'li',
    2727                template: wp.template( 'wcp-attached-file' ),
     
    4040         * View for a collection of attached files
    4141         */
    42         $.wordcampBudgets.AttachedFilesView = Backbone.View.extend( {
     42        $.paymentRequests.AttachedFilesView = Backbone.View.extend( {
    4343                el: $( '#wcp_files' ),
    4444
     
    4646                        _.bindAll( this, 'render', 'appendFile' );
    4747
    48                         this.collection = new $.wordcampBudgets.AttachedFiles( wcpAttachedFiles );
     48                        this.collection = new $.paymentRequests.AttachedFiles( wcpAttachedFiles );
    4949                        this.collection.bind( 'add', this.appendFile );
    5050
     
    6262                appendFile: function( file ) {
    6363                        var noFilesUploaded  = $( '.wcp_no_files_uploaded' );
    64                         var attachedFileView = new $.wordcampBudgets.AttachedFileView( { model: file } );
     64                        var attachedFileView = new $.paymentRequests.AttachedFileView( { model: file } );
    6565
    6666                        $( '.wcp_files_list' ).append( attachedFileView.render().el );
     
    7979                 * Files that are already attached to other posts are ignored.
    8080                 *
    81                  * @param {wordcampBudgets.AttachedFile} file
     81                 * @param {paymentRequests.AttachedFile} file
    8282                 */
    8383                attachExistingFile: function( file ) {
     
    9898        } );
    9999
    100         $.wordcampBudgets.attachedFilesView = new $.wordcampBudgets.AttachedFilesView();
     100        $.paymentRequests.attachedFilesView = new $.paymentRequests.AttachedFilesView();
    101101
    102102} );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js

    r2272 r2276  
    11jQuery( document ).ready( function( $ ) {
    22
    3         $.wordcampBudgets = {
     3        $.paymentRequests = {
    44
    55                /**
     
    77                 */
    88                init: function () {
    9                         $.wordcampBudgets.registerEventHandlers();
    10                         $.wordcampBudgets.setupDatePicker();
     9                        $.paymentRequests.registerEventHandlers();
     10                        $.paymentRequests.setupDatePicker();
    1111                },
    1212
     
    1515                 */
    1616                registerEventHandlers : function() {
    17                         $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.wordcampBudgets.togglePaymentMethodFields );
    18                         $( '#payment_category' ).change( $.wordcampBudgets.toggleOtherCategoryDescription );
    19                         $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.wordcampBudgets.showUploadModal );
    20                         $( '#wcp_mark_incomplete_checkbox' ).click( $.wordcampBudgets.requireNotes );
     17                        $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.paymentRequests.togglePaymentMethodFields );
     18                        $( '#payment_category' ).change( $.paymentRequests.toggleOtherCategoryDescription );
     19                        $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.paymentRequests.showUploadModal );
     20                        $( '#wcp_mark_incomplete_checkbox' ).click( $.paymentRequests.requireNotes );
    2121                },
    2222
     
    6161                 */
    6262                showUploadModal : function( event ) {
    63                         if ( 'undefined' == typeof $.wordcampBudgets.fileUploadFrame ) {
     63                        if ( 'undefined' == typeof $.paymentRequests.fileUploadFrame ) {
    6464                                // Create the frame
    65                                 $.wordcampBudgets.fileUploadFrame = wp.media( {
     65                                $.paymentRequests.fileUploadFrame = wp.media( {
    6666                                        title: wcpLocalizedStrings.uploadModalTitle,
    6767                                        multiple: true,
     
    7272
    7373                                // Add models to the collection for each selected attachment
    74                                 $.wordcampBudgets.fileUploadFrame.on( 'select', $.wordcampBudgets.addSelectedFilesToCollection );
     74                                $.paymentRequests.fileUploadFrame.on( 'select', $.paymentRequests.addSelectedFilesToCollection );
    7575                        }
    7676
    77                         $.wordcampBudgets.fileUploadFrame.open();
     77                        $.paymentRequests.fileUploadFrame.open();
    7878                        return false;
    7979                },
     
    8383                 */
    8484                addSelectedFilesToCollection : function() {
    85                         var attachments = $.wordcampBudgets.fileUploadFrame.state().get( 'selection' ).toJSON();
     85                        var attachments = $.paymentRequests.fileUploadFrame.state().get( 'selection' ).toJSON();
    8686
    8787                        $.each( attachments, function( index, attachment ) {
    88                                 var newFile = new $.wordcampBudgets.AttachedFile( {
     88                                var newFile = new $.paymentRequests.AttachedFile( {
    8989                                        'ID':          attachment.id,
    9090                                        'post_parent': attachment.uploadedTo,
     
    9393                                } );
    9494
    95                                 $.wordcampBudgets.attachedFilesView.collection.add( newFile );
     95                                $.paymentRequests.attachedFilesView.collection.add( newFile );
    9696                        } );
    9797                },
     
    127127        };
    128128
    129         $.wordcampBudgets.init();
     129        $.paymentRequests.init();
    130130} );
Note: See TracChangeset for help on using the changeset viewer.