Changeset 2276
- Timestamp:
- 01/12/2016 03:56:43 PM (9 years ago)
- 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 24 24 // Register our assets 25 25 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__ ), 28 28 array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ), 29 29 self::VERSION, … … 34 34 'wcp-attached-files', 35 35 plugins_url( 'javascript/attached-files.js', __DIR__ ), 36 array( ' wordcamp-budgets', 'backbone', 'wp-util' ),36 array( 'payment-requests', 'backbone', 'wp-util' ), 37 37 self::VERSION, 38 38 true … … 56 56 57 57 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' ); 59 59 wp_enqueue_style( 'wordcamp-budgets' ); 60 60 … … 65 65 66 66 wp_localize_script( 67 ' wordcamp-budgets',67 'payment-requests', 68 68 'wcpLocalizedStrings', // todo merge into wordcampBudgets var 69 69 array( -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js
r2272 r2276 4 4 * Model for an attached file 5 5 */ 6 $. wordcampBudgets.AttachedFile = Backbone.Model.extend( {6 $.paymentRequests.AttachedFile = Backbone.Model.extend( { 7 7 defaults: { 8 8 'ID': 0, … … 16 16 * Collection of attached files 17 17 */ 18 $. wordcampBudgets.AttachedFiles = Backbone.Collection.extend( {19 model: $. wordcampBudgets.AttachedFile18 $.paymentRequests.AttachedFiles = Backbone.Collection.extend( { 19 model: $.paymentRequests.AttachedFile 20 20 } ); 21 21 … … 23 23 * View for a single attached file 24 24 */ 25 $. wordcampBudgets.AttachedFileView = Backbone.View.extend( {25 $.paymentRequests.AttachedFileView = Backbone.View.extend( { 26 26 tagName: 'li', 27 27 template: wp.template( 'wcp-attached-file' ), … … 40 40 * View for a collection of attached files 41 41 */ 42 $. wordcampBudgets.AttachedFilesView = Backbone.View.extend( {42 $.paymentRequests.AttachedFilesView = Backbone.View.extend( { 43 43 el: $( '#wcp_files' ), 44 44 … … 46 46 _.bindAll( this, 'render', 'appendFile' ); 47 47 48 this.collection = new $. wordcampBudgets.AttachedFiles( wcpAttachedFiles );48 this.collection = new $.paymentRequests.AttachedFiles( wcpAttachedFiles ); 49 49 this.collection.bind( 'add', this.appendFile ); 50 50 … … 62 62 appendFile: function( file ) { 63 63 var noFilesUploaded = $( '.wcp_no_files_uploaded' ); 64 var attachedFileView = new $. wordcampBudgets.AttachedFileView( { model: file } );64 var attachedFileView = new $.paymentRequests.AttachedFileView( { model: file } ); 65 65 66 66 $( '.wcp_files_list' ).append( attachedFileView.render().el ); … … 79 79 * Files that are already attached to other posts are ignored. 80 80 * 81 * @param { wordcampBudgets.AttachedFile} file81 * @param {paymentRequests.AttachedFile} file 82 82 */ 83 83 attachExistingFile: function( file ) { … … 98 98 } ); 99 99 100 $. wordcampBudgets.attachedFilesView = new $.wordcampBudgets.AttachedFilesView();100 $.paymentRequests.attachedFilesView = new $.paymentRequests.AttachedFilesView(); 101 101 102 102 } ); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js
r2272 r2276 1 1 jQuery( document ).ready( function( $ ) { 2 2 3 $. wordcampBudgets = {3 $.paymentRequests = { 4 4 5 5 /** … … 7 7 */ 8 8 init: function () { 9 $. wordcampBudgets.registerEventHandlers();10 $. wordcampBudgets.setupDatePicker();9 $.paymentRequests.registerEventHandlers(); 10 $.paymentRequests.setupDatePicker(); 11 11 }, 12 12 … … 15 15 */ 16 16 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 ); 21 21 }, 22 22 … … 61 61 */ 62 62 showUploadModal : function( event ) { 63 if ( 'undefined' == typeof $. wordcampBudgets.fileUploadFrame ) {63 if ( 'undefined' == typeof $.paymentRequests.fileUploadFrame ) { 64 64 // Create the frame 65 $. wordcampBudgets.fileUploadFrame = wp.media( {65 $.paymentRequests.fileUploadFrame = wp.media( { 66 66 title: wcpLocalizedStrings.uploadModalTitle, 67 67 multiple: true, … … 72 72 73 73 // Add models to the collection for each selected attachment 74 $. wordcampBudgets.fileUploadFrame.on( 'select', $.wordcampBudgets.addSelectedFilesToCollection );74 $.paymentRequests.fileUploadFrame.on( 'select', $.paymentRequests.addSelectedFilesToCollection ); 75 75 } 76 76 77 $. wordcampBudgets.fileUploadFrame.open();77 $.paymentRequests.fileUploadFrame.open(); 78 78 return false; 79 79 }, … … 83 83 */ 84 84 addSelectedFilesToCollection : function() { 85 var attachments = $. wordcampBudgets.fileUploadFrame.state().get( 'selection' ).toJSON();85 var attachments = $.paymentRequests.fileUploadFrame.state().get( 'selection' ).toJSON(); 86 86 87 87 $.each( attachments, function( index, attachment ) { 88 var newFile = new $. wordcampBudgets.AttachedFile( {88 var newFile = new $.paymentRequests.AttachedFile( { 89 89 'ID': attachment.id, 90 90 'post_parent': attachment.uploadedTo, … … 93 93 } ); 94 94 95 $. wordcampBudgets.attachedFilesView.collection.add( newFile );95 $.paymentRequests.attachedFilesView.collection.add( newFile ); 96 96 } ); 97 97 }, … … 127 127 }; 128 128 129 $. wordcampBudgets.init();129 $.paymentRequests.init(); 130 130 } );
Note: See TracChangeset
for help on using the changeset viewer.