<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[2327] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments: WordCamp Budgets: Centralize common JavaScript functions.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/2327">2327</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/2327","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-01-19 20:44:53 +0000 (Tue, 19 Jan 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordCamp Budgets: Centralize common JavaScript functions.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludespaymentrequestphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludessponsorinvoicephp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludeswordcampbudgetsphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptattachedfilesjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptsponsorinvoicesjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/sponsor-invoices.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestinputfilesphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptwordcampbudgetsjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludespaymentrequestphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php    2016-01-19 17:41:52 UTC (rev 2326)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php      2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -181,19 +181,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                wp_register_script(
</span><span class="cx" style="display: block; padding: 0 10px">                        'payment-requests',
</span><span class="cx" style="display: block; padding: 0 10px">                        plugins_url( 'javascript/payment-requests.js', __DIR__ ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( 'wordcamp-budgets', 'wcb-attached-files', 'jquery' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         WordCamp_Budgets::VERSION,
</span><span class="cx" style="display: block; padding: 0 10px">                        true
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                wp_register_script(
-                       'wcp-attached-files',
-                       plugins_url( 'javascript/attached-files.js', __DIR__ ),
-                       array( 'payment-requests', 'backbone', 'wp-util' ),
-                       WordCamp_Budgets::VERSION,
-                       true
-               );
-
</del><span class="cx" style="display: block; padding: 0 10px">                 // Enqueue our assets if they're needed on the current screen
</span><span class="cx" style="display: block; padding: 0 10px">                $current_screen = get_current_screen();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -205,15 +197,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( isset( $post->ID ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_enqueue_media( array( 'post' => $post->ID ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        wp_enqueue_script( 'wcp-attached-files' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_enqueue_script( 'wcb-attached-files' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                wp_localize_script(
</span><span class="cx" style="display: block; padding: 0 10px">                        'payment-requests',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'wcpLocalizedStrings',          // todo merge into paymentRequests var
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'wcpLocalizedStrings',          // todo merge into WordCampBudgets var
</ins><span class="cx" style="display: block; padding: 0 10px">                         array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'uploadModalTitle'  => __( 'Attach Supporting Documentation', 'wordcamporg' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'uploadModalButton' => __( 'Attach Files', 'wordcamporg' ),
</del><span class="cx" style="display: block; padding: 0 10px">                         )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludessponsorinvoicephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php    2016-01-19 17:41:52 UTC (rev 2326)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php      2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -146,7 +146,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        wp_register_script(
</span><span class="cx" style="display: block; padding: 0 10px">                'sponsor-invoices',
</span><span class="cx" style="display: block; padding: 0 10px">                plugins_url( 'javascript/sponsor-invoices.js', __DIR__ ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                array( 'jquery', 'jquery-ui-datepicker', 'underscore', 'wp-util' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         array( 'wordcamp-budgets', 'jquery', 'underscore', 'wp-util' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 \WordCamp_Budgets::VERSION,
</span><span class="cx" style="display: block; padding: 0 10px">                true
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludeswordcampbudgetsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php   2016-01-19 17:41:52 UTC (rev 2326)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php     2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,8 +37,32 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * Enqueue scripts and stylesheets common to all modules
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function enqueue_common_assets() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // todo setup grunt to concat/minify js and css?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // todo setup grunt to concat/minify js
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                wp_enqueue_script(
+                       'wordcamp-budgets',
+                       plugins_url( 'javascript/wordcamp-budgets.js', __DIR__ ),
+                       array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ),
+                       self::VERSION,
+                       true
+               );
+
+               wp_register_script(
+                       'wcb-attached-files',
+                       plugins_url( 'javascript/attached-files.js', __DIR__ ),
+                       array( 'wordcamp-budgets', 'backbone', 'wp-util' ),
+                       WordCamp_Budgets::VERSION,
+                       true
+               );
+
+               wp_localize_script(
+                       'wordcamp-budgets',
+                       'wcbLocalizedStrings',          // todo merge into WordCampBudgets var
+                       array(
+                               'uploadModalButton' => __( 'Attach Files', 'wordcamporg' ),
+                       )
+               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 // Let's still include our .css file even if these are unavailable.
</span><span class="cx" style="display: block; padding: 0 10px">                $soft_deps = array( 'jquery-ui', 'wp-datepicker-skins' );
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( $soft_deps as $key => $handle )
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptattachedfilesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js    2016-01-19 17:41:52 UTC (rev 2326)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js      2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,9 +1,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> jQuery( document ).ready( function( $ ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        // todo strict mode
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        var app = window.WordCampBudgets;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /*
</span><span class="cx" style="display: block; padding: 0 10px">         * Model for an attached file
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.paymentRequests.AttachedFile = Backbone.Model.extend( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ app.AttachedFile = Backbone.Model.extend( {
</ins><span class="cx" style="display: block; padding: 0 10px">                 defaults: {
</span><span class="cx" style="display: block; padding: 0 10px">                        'ID':          0,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_parent': 0,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,14 +18,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /*
</span><span class="cx" style="display: block; padding: 0 10px">         * Collection of attached files
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.paymentRequests.AttachedFiles = Backbone.Collection.extend( {
-               model: $.paymentRequests.AttachedFile
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ app.AttachedFiles = Backbone.Collection.extend( {
+               model: app.AttachedFile
</ins><span class="cx" style="display: block; padding: 0 10px">         } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /*
</span><span class="cx" style="display: block; padding: 0 10px">         * View for a single attached file
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.paymentRequests.AttachedFileView = Backbone.View.extend( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ app.AttachedFileView = Backbone.View.extend( {
</ins><span class="cx" style="display: block; padding: 0 10px">                 tagName: 'li',
</span><span class="cx" style="display: block; padding: 0 10px">                template: wp.template( 'wcp-attached-file' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,13 +42,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /*
</span><span class="cx" style="display: block; padding: 0 10px">         * View for a collection of attached files
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.paymentRequests.AttachedFilesView = Backbone.View.extend( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ app.AttachedFilesView = Backbone.View.extend( {
</ins><span class="cx" style="display: block; padding: 0 10px">                 el: $( '#wcp_files' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                initialize: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        _.bindAll( this, 'render', 'appendFile' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        this.collection = new $.paymentRequests.AttachedFiles( wcpAttachedFiles );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 this.collection = new app.AttachedFiles( wcbAttachedFiles );
</ins><span class="cx" style="display: block; padding: 0 10px">                         this.collection.bind( 'add', this.appendFile );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        this.render();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,7 +64,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                appendFile: function( file ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var noFilesUploaded  = $( '.wcp_no_files_uploaded' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var attachedFileView = new $.paymentRequests.AttachedFileView( { model: file } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var attachedFileView = new app.AttachedFileView( { model: file } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $( '.wcp_files_list' ).append( attachedFileView.render().el );
</span><span class="cx" style="display: block; padding: 0 10px">                        noFilesUploaded.removeClass( 'active' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,7 +81,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * Files that are already attached to other posts are ignored.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param {paymentRequests.AttachedFile} file
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param {app.AttachedFile} file
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                attachExistingFile: function( file ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var fileIDsToAttach,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,6 +100,4 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.paymentRequests.attachedFilesView = new $.paymentRequests.AttachedFilesView();
-
</del><span class="cx" style="display: block; padding: 0 10px"> } );
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js  2016-01-19 17:41:52 UTC (rev 2326)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js    2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,47 +1,35 @@
</span><span class="cx" style="display: block; padding: 0 10px"> jQuery( document ).ready( function( $ ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.paymentRequests = {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // todo add try/catch and log
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        var wcb = window.WordCampBudgets;
+       var app = wcb.PaymentRequests = {
+               
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Main entry point
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                init: function () {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $.paymentRequests.registerEventHandlers();
-                       $.paymentRequests.setupDatePicker();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 app.registerEventHandlers();
+                       wcb.attachedFilesView = new wcb.AttachedFilesView();
+                       wcb.setupDatePicker( '#wcp_general_info' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Registers event handlers
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                registerEventHandlers : function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.paymentRequests.togglePaymentMethodFields );
-                       $( '#payment_category' ).change( $.paymentRequests.toggleOtherCategoryDescription );
-                       $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.paymentRequests.showUploadModal );
-                       $( '#wcp_mark_incomplete_checkbox' ).click( $.paymentRequests.requireNotes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( wcb.togglePaymentMethodFields );
+                       $( '#payment_category' ).change( app.toggleOtherCategoryDescription );
+                               // todo this needs to fire onLoad too, otherwise the field is hidden
+                       $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( { title : wcpLocalizedStrings.uploadModalTitle }, wcb.showUploadModal );
+                       $( '#wcp_mark_incomplete_checkbox' ).click( app.requireNotes );
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Toggle the payment method fields based on which method is selected
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * Toggle the extra input field when the user selects the Other category
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {object} event
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                togglePaymentMethodFields : function( event ) {
-                       var active_fields_container = '#' + $( this ).attr( 'id' ) + '_fields';
-                       var payment_method_fields   = '.payment_method_fields';
-
-                       $( payment_method_fields   ).removeClass( 'active' );
-                       $( payment_method_fields   ).addClass( 'hidden' );
-                       $( active_fields_container ).removeClass( 'hidden' );
-                       $( active_fields_container ).addClass( 'active' );
-
-                       // todo make the transition smoother
-               },
-
-               /**
-                * Example event handler
-                *
-                * @param {object} event
-                */
</del><span class="cx" style="display: block; padding: 0 10px">                 toggleOtherCategoryDescription : function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var otherCategoryDescription = $( '#row-other-category-explanation' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,64 +43,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Initialize Core's Media Picker
-                *
-                * @param {object} event
-                */
-               showUploadModal : function( event ) {
-                       if ( 'undefined' == typeof $.paymentRequests.fileUploadFrame ) {
-                               // Create the frame
-                               $.paymentRequests.fileUploadFrame = wp.media( {
-                                       title: wcpLocalizedStrings.uploadModalTitle,
-                                       multiple: true,
-                                       button: {
-                                               text: wcpLocalizedStrings.uploadModalButton
-                                       }
-                               } );
-
-                               // Add models to the collection for each selected attachment
-                               $.paymentRequests.fileUploadFrame.on( 'select', $.paymentRequests.addSelectedFilesToCollection );
-                       }
-
-                       $.paymentRequests.fileUploadFrame.open();
-                       return false;
-               },
-
-               /**
-                * Add files selected from the Media Picker to the current collection of files
-                */
-               addSelectedFilesToCollection : function() {
-                       var attachments = $.paymentRequests.fileUploadFrame.state().get( 'selection' ).toJSON();
-
-                       $.each( attachments, function( index, attachment ) {
-                               var newFile = new $.paymentRequests.AttachedFile( {
-                                       'ID':          attachment.id,
-                                       'post_parent': attachment.uploadedTo,
-                                       'filename':    attachment.filename,
-                                       'url':         attachment.url
-                               } );
-
-                               $.paymentRequests.attachedFilesView.collection.add( newFile );
-                       } );
-               },
-
-               /**
-                * Fallback to the jQueryUI datepicker if the browser doesn't support <input type="date">
-                */
-               setupDatePicker : function() {
-                       var browserTest = document.createElement( 'input' );
-                       browserTest.setAttribute( 'type', 'date' );
-
-                       if ( 'text' === browserTest.type ) {
-                               $( '#wcp_general_info' ).find( 'input[type=date]' ).not( '[readonly="readonly"]' ).datepicker( {
-                                       dateFormat : 'yy-mm-dd',
-                                       changeMonth: true,
-                                       changeYear : true
-                               } );
-                       }
-               },
-
-               /**
</del><span class="cx" style="display: block; padding: 0 10px">                  * Require notes when the request is being marked as incomplete
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                requireNotes : function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -126,5 +56,5 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.paymentRequests.init();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ app.init();
</ins><span class="cx" style="display: block; padding: 0 10px"> } );
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptsponsorinvoicesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/sponsor-invoices.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/sponsor-invoices.js  2016-01-19 17:41:52 UTC (rev 2326)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/sponsor-invoices.js    2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,18 +1,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> jQuery( document ).ready( function( $ ) {
</span><span class="cx" style="display: block; padding: 0 10px">        'use strict';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.sponsorInvoices = {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var wcb = window.WordCampBudgets;
+       var app = wcb.SponsorInvoices = {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Main entry point
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                init: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $.sponsorInvoices.registerEventHandlers();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         app.registerEventHandlers();
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $( '#_wcbsi_sponsor_id' ).trigger( 'change' );  // Populate the initial sponsor information
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $.sponsorInvoices.setupDatePicker();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         wcb.setupDatePicker( '#wcbsi_sponsor_invoice' );
</ins><span class="cx" style="display: block; padding: 0 10px">                         } catch ( exception ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $.sponsorInvoices.log( exception );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         wcb.log( exception );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,9 +21,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * Registers event handlers
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                registerEventHandlers : function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $( '#_wcbsi_sponsor_id' ).change( $.sponsorInvoices.populateSponsorInformation );
-
-                       // todo detect when invoice fields incomplete, disable submit button (but not draft), and show notice
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $( '#_wcbsi_sponsor_id' ).change( app.populateSponsorInformation );
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,9 +40,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        infoContainer.html( '' );
</span><span class="cx" style="display: block; padding: 0 10px">                                        sendInvoiceButton.prop( 'disabled', true );
</span><span class="cx" style="display: block; padding: 0 10px">                                        return;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } else if ( info.requiredFieldsComplete ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        // todo add info.hasOwnProperty() check
</ins><span class="cx" style="display: block; padding: 0 10px">                                         infoTemplate = wp.template( 'wcbsi-sponsor-information' );
</span><span class="cx" style="display: block; padding: 0 10px">                                        sendInvoiceButton.prop( 'disabled', false );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        infoTemplate = wp.template( 'wcbsi-required-fields-incomplete' );
</span><span class="cx" style="display: block; padding: 0 10px">                                        sendInvoiceButton.prop( 'disabled', true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,47 +53,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                infoContainer.html( infoTemplate( info ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        } catch ( exception ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $.sponsorInvoices.log( exception );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         wcb.log( exception );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                },
-
-               /**
-                * Fallback to the jQueryUI datepicker if the browser doesn't support <input type="date">
-                *
-                * todo this is mostly duplicate of same function in payment-requests.js. should make DRY
-                */
-               setupDatePicker : function() {
-                       var browserTest = document.createElement( 'input' );
-                       browserTest.setAttribute( 'type', 'date' );
-
-                       if ( 'text' === browserTest.type ) {
-                               $( '#wcbsi_sponsor_invoice' ).find( 'input[type=date]' ).not( '[readonly="readonly"]' ).datepicker( {
-                                       dateFormat : 'yy-mm-dd',
-                                       changeMonth: true,
-                                       changeYear : true
-                               } );
-                       }
-               },
-
-               /**
-                * Log a message to the console
-                *
-                * @todo centralize this for all modules to use
-                *
-                * @param {*} error
-                */
-               log : function( error ) {
-                       if ( ! window.console ) {
-                               return;
-                       }
-
-                       if ( 'string' === typeof error ) {
-                               console.log( 'WordCamp Sponsor Invoices: ' + error );
-                       } else {
-                               console.log( 'WordCamp Sponsor Invoices: ', error );
-                       }
</del><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $.sponsorInvoices.init();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ app.init();
</ins><span class="cx" style="display: block; padding: 0 10px"> } );
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptwordcampbudgetsjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js                          (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js    2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,102 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+jQuery( document ).ready( function( $ ) {
+       'use strict';
+
+       var app = window.WordCampBudgets = {
+
+               /**
+                * Toggle the payment method fields based on which method is selected
+                *
+                * @param {object} event
+                */
+               togglePaymentMethodFields : function( event ) {
+                       var active_fields_container = '#' + $( this ).attr( 'id' ) + '_fields';
+                       var payment_method_fields   = '.payment_method_fields';
+
+                       $( payment_method_fields   ).removeClass( 'active' );
+                       $( payment_method_fields   ).addClass( 'hidden' );
+                       $( active_fields_container ).removeClass( 'hidden' );
+                       $( active_fields_container ).addClass( 'active' );
+
+                       // todo make the transition smoother
+               },
+
+               /**
+                * Initialize Core's Media Picker
+                *
+                * @param {object} event
+                */
+               showUploadModal : function( event ) {
+                       if ( 'undefined' == typeof app.fileUploadFrame ) {
+                               // Create the frame
+                               app.fileUploadFrame = wp.media( {
+                                       title: event.data.title,
+                                       multiple: true,
+                                       button: {
+                                               text: wcbLocalizedStrings.uploadModalButton
+                                       }
+                               } );
+
+                               // Add models to the collection for each selected attachment
+                               app.fileUploadFrame.on( 'select', app.addSelectedFilesToCollection );
+                       }
+
+                       app.fileUploadFrame.open();
+                       return false;
+               },
+
+               /**
+                * Add files selected from the Media Picker to the current collection of files
+                */
+               addSelectedFilesToCollection : function() {
+                       // app var needs to point to caller?
+
+                       var attachments = app.fileUploadFrame.state().get( 'selection' ).toJSON();
+
+                       $.each( attachments, function( index, attachment ) {
+                               var newFile = new app.AttachedFile( {
+                                       'ID'          : attachment.id,
+                                       'post_parent' : attachment.uploadedTo,
+                                       'filename'    : attachment.filename,
+                                       'url'         : attachment.url
+                               } );
+
+                               app.attachedFilesView.collection.add( newFile );
+                       } );
+               },
+
+               /**
+                * Fallback to the jQueryUI datepicker if the browser doesn't support <input type="date">
+                *
+                * @param {string} selector
+                */
+               setupDatePicker : function( selector ) {
+                       var browserTest = document.createElement( 'input' );
+                       browserTest.setAttribute( 'type', 'date' );
+
+                       if ( 'text' === browserTest.type ) {
+                               $( selector ).find( 'input[type=date]' ).not( '[readonly="readonly"]' ).datepicker( {
+                                       dateFormat : 'yy-mm-dd',
+                                       changeMonth: true,
+                                       changeYear : true
+                               } );
+                       }
+               },
+
+               /**
+                * Log a message to the console
+                *
+                * @param {*} error
+                */
+               log : function( error ) {
+                       if ( ! window.console ) {
+                               return;
+                       }
+
+                       if ( 'string' === typeof error ) {
+                               console.log( 'WordCamp Budgets: ' + error );
+                       } else {
+                               console.log( 'WordCamp Budgets: ', error );
+                       }
+               }
+       };
+} );
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestinputfilesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php   2016-01-19 17:41:52 UTC (rev 2326)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php     2016-01-19 20:44:53 UTC (rev 2327)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,6 +8,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        </p>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <?php // todo move to centralized view file ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <p>
</span><span class="cx" style="display: block; padding: 0 10px">                        <a class="button wcp-insert-media" role="button">
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php _e( 'Add files', 'wordcamporg' ); ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,6 +27,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <a href="{{ data.url }}">{{ data.filename }}</a>
</span><span class="cx" style="display: block; padding: 0 10px">                </script>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php wp_localize_script( 'wcp-attached-files', 'wcpAttachedFiles', $files ); // todo merge into wordcampBudgets var ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <?php wp_localize_script( 'wcb-attached-files', 'wcbAttachedFiles', $files ); // todo merge into wordcampBudgets var ?>
</ins><span class="cx" style="display: block; padding: 0 10px">         </td>
</span><span class="cx" style="display: block; padding: 0 10px"> </tr>
</span></span></pre>
</div>
</div>

</body>
</html>