<!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>[8107] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js: WordCamp Payments: Apply coding standards.</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 { white-space: pre-line; 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/8107">8107</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/8107","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>2019-01-18 20:24:04 +0000 (Fri, 18 Jan 2019)</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 Payments: Apply coding standards.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptbudgettooljs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptbudgettooljs"></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/budget-tool.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/budget-tool.js       2019-01-18 20:24:01 UTC (rev 8106)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js 2019-01-18 20:24:04 UTC (rev 8107)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,235 +1,249 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-window.wcb = window.wcb || {models:{}, input:[]};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+window.wcb = window.wcb || { models: {}, input: [] };
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-(function($){
-    var $document = $(document),
-        $container = $('.wcb-budget-container tbody'),
-        $income = $container.find('.wcb-income-placeholder'),
-        $expense = $container.find('.wcb-expense-placeholder'),
-        $meta = $container.find('.wcb-meta-placeholder'),
-        $summary = $('.wcb-summary-placeholder'),
-        $form = $('.wcb-submit-form');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+( function( $ ) {
+       var wcb = window.wcb;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    var template_options = {
-               evaluate:    /<#([\s\S]+?)#>/g,
-               interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
-               escape:      /\{\{([^\}]+?)\}\}(?!\})/g,
-               variable:    'data'
-    };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $document  = $( document ),
+               $container = $( '.wcb-budget-container tbody' ),
+               $income    = $container.find( '.wcb-income-placeholder' ),
+               $expense   = $container.find( '.wcb-expense-placeholder' ),
+               $meta      = $container.find( '.wcb-meta-placeholder' ),
+               $summary   = $( '.wcb-summary-placeholder' ),
+               $form      = $( '.wcb-submit-form' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    var Entry = Backbone.Model.extend({
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var template_options = {
+               evaluate    : /<#([\s\S]+?)#>/g,
+               interpolate : /\{\{\{([\s\S]+?)\}\}\}/g,
+               escape      : /\{\{([^\}]+?)\}\}(?!\})/g,
+               variable    : 'data',
+       };
+
+       var Entry = Backbone.Model.extend( {
</ins><span class="cx" style="display: block; padding: 0 10px">                 defaults: {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        type: 'expense',
-            category: 'other',
-            amount: 0,
-            note: '',
-            new: false,
-            link: null,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 type     : 'expense',
+                       category : 'other',
+                       amount   : 0,
+                       note     : '',
+                       new      : false,
+                       link     : null,
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            // metadata
-            name: '',
-            value: null
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // metadata
+                       name  : '',
+                       value : null,
</ins><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: function() {
-            this._realAmount = this.getRealAmount();
-            this._attr = _.clone(this.attributes);
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         initialize: function() {
+                       this._realAmount = this.getRealAmount();
+                       this._attr       = _.clone( this.attributes );
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        getRealAmount: function() {
-            if (!this.get('link'))
-                return this.get('amount');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         getRealAmount: function() {
+                       if ( ! this.get( 'link' ) ) {
+                               return this.get( 'amount' );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if (this.get('link') in wcb.linkData) {
-                var link = wcb.linkData[this.get('link')]
-                return link.callback(this.get('amount'));
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( this.get( 'link' ) in wcb.linkData ) {
+                               var link = wcb.linkData[ this.get( 'link' ) ];
+                               return link.callback( this.get( 'amount' ) );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            return 0;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return 0;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        getLinkLabel: function() {
-            if (!this.get('link'))
-                return '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         getLinkLabel: function() {
+                       if ( ! this.get( 'link' ) ) {
+                               return '';
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if (this.get('link') in wcb.linkData)
-                return wcb.linkData[this.get('link')].label;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( this.get( 'link' ) in wcb.linkData ) {
+                               return wcb.linkData[ this.get( 'link' ) ].label;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            return '';
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return '';
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        linkHasValue: function() {
-            if (!this.get('link'))
-                return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         linkHasValue: function() {
+                       if ( ! this.get( 'link' ) ) {
+                               return false;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if (this.get('link') in wcb.linkData)
-                return wcb.linkData[this.get('link')].hasValue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( this.get( 'link' ) in wcb.linkData ) {
+                               return wcb.linkData[ this.get( 'link' ) ].hasValue;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            return false;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return false;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        hasChanged: function() {
-            // console.log(this._attr);
-            // console.log(this.attributes);
-            // console.log(this._realAmount)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         hasChanged: function() {
+                       var _stringify = function( v ) {
+                               if ( ! v ) {
+                                       return v;
+                               }
+                               return v.toString();
+                       };
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            var _stringify = function(v) {
-                if (!v) return v;
-                return v.toString();
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var changed = _.isEqual(
+                               _.map( this._attr, _stringify ),
+                               _.map( this.attributes, _stringify )
+                       ) && this._realAmount == this.getRealAmount();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            var changed = _.isEqual(
-                _.map(this._attr, _stringify),
-                _.map(this.attributes, _stringify)
-            ) && this._realAmount == this.getRealAmount();
-            return !changed;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return ! changed;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        editStart: function() {
-            this.trigger('edit-start.wordcamp-budgets');
-        }
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         editStart: function() {
+                       this.trigger( 'edit-start.wordcamp-budgets' );
+               },
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    var SummaryView = Backbone.View.extend({
-        className: 'wcb-budget-container wcb-budget-summary',
-        tagName: 'table',
-        urls: [],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var SummaryView = Backbone.View.extend( {
+               className : 'wcb-budget-container wcb-budget-summary',
+               tagName   : 'table',
+               urls      : [],
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        events: {
-            'click .inspire': 'inspire'
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         events: {
+                       'click .inspire' : 'inspire',
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        render: function() {
-               var attendees = wcb.table.collection.findWhere({type: 'meta', name: 'attendees'}),
-                   days      = wcb.table.collection.findWhere({type: 'meta', name: 'days'}),
-                data = {
-                    'income': 0,
-                    'expenses': 0,
-                    'variance': 0,
-                    'variance_raw': 0,
-                    'per_person': 0
-                };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         render: function() {
+                       var attendees = wcb.table.collection.findWhere( { type: 'meta', name: 'attendees' } ),
+                               days      = wcb.table.collection.findWhere( { type: 'meta', name: 'days' } ),
+                               data      = {
+                                       income       : 0,
+                                       expenses     : 0,
+                                       variance     : 0,
+                                       variance_raw : 0,
+                                       per_person   : 0,
+                               };
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            _.each(wcb.table.collection.where({type: 'income'}), function(item) {
-                data['income'] += item.getRealAmount();
-            });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 _.each( wcb.table.collection.where( { type: 'income' } ), function( item ) {
+                               data[ 'income' ] += item.getRealAmount();
+                       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            _.each(wcb.table.collection.where({type: 'expense'}), function(item) {
-                data['expenses'] += item.getRealAmount();
-            });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 _.each( wcb.table.collection.where( { type: 'expense' } ), function( item ) {
+                               data[ 'expenses' ] += item.getRealAmount();
+                       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            data['variance'] = data['income'] - data['expenses'];
-            data['variance_raw'] = data['variance'];
-            data['per_person'] = (attendees && days) ? data['expenses'] / attendees.get('value') / days.get('value'): 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 data[ 'variance' ]     = data[ 'income' ] - data[ 'expenses' ];
+                       data[ 'variance_raw' ] = data[ 'variance' ];
+                       data[ 'per_person' ]   = ( attendees && days ) ? data[ 'expenses' ] / attendees.get( 'value' ) / days.get( 'value' ) : 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            data = _.mapObject(data, function(v, k) {
-                if (k == 'variance_raw')
-                    return v;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 data = _.mapObject( data, function( v, k ) {
+                               if ( k == 'variance_raw' ) {
+                                       return v;
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return v.toLocaleString('en-US', {
-                    minimumFractionDigits: 2,
-                    maximumFractionDigits: 2
-                });
-            });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return v.toLocaleString( 'en-US', {
+                                       minimumFractionDigits : 2,
+                                       maximumFractionDigits : 2,
+                               } );
+                       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            this.template = _.template($('#wcb-tmpl-summary').html(), null, template_options);
-            this.$el.html(this.template(data));
-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 this.template = _.template( $( '#wcb-tmpl-summary' ).html(), null, template_options );
+                       this.$el.html( this.template( data ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        initialize: function() {
-            $summary.append(this.render().el);
-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return this;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        inspire: function(e) {
-            e.target.href = this.urls[Math.floor(Math.random()*this.urls.length)];
-            return true;
-        }
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         initialize: function() {
+                       $summary.append( this.render().el );
+                       return this;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    var EntryView = Backbone.View.extend({
-        className: 'wcb-entry',
-        tagName: 'tr',
-        cancel: false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         inspire: function( e ) {
+                       e.target.href = this.urls[ Math.floor( Math.random() * this.urls.length ) ];
+                       return true;
+               },
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        events: {
-            'keyup': 'keyup',
-            'click .delete': 'delete',
-            'click .move': 'move',
-            'change input': 'editSave',
-            'change select.category': 'editSave',
-            'change select.link-value': 'linkChange',
-            'change select.value': 'editSave',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var EntryView = Backbone.View.extend( {
+               className : 'wcb-entry',
+               tagName   : 'tr',
+               cancel    : false,
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            'focus input, select': 'focus',
-            'blur input, select': 'blur'
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         events: {
+                       'keyup'                    : 'keyup',
+                       'click .delete'            : 'delete',
+                       'click .move'              : 'move',
+                       'change input'             : 'editSave',
+                       'change select.category'   : 'editSave',
+                       'change select.link-value' : 'linkChange',
+                       'change select.value'      : 'editSave',
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        initialize: function() {
-            this.model.bind('destroy', this.remove, this);
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'focus input, select' : 'focus',
+                       'blur input, select'  : 'blur',
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        linkChange: function() {
-            this.model.set('link', this.$el.find('.link-value').val() || null);
-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         initialize: function() {
+                       this.model.bind( 'destroy', this.remove, this );
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        focus: function(e) {
-            var $target = $(e.target);
-            $target.parents('td').addClass('focused');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         linkChange: function() {
+                       this.model.set( 'link', this.$el.find( '.link-value' ).val() || null );
+                       return this;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if (($target.hasClass('amount') || $target.hasClass('link-value')) && this.model.get('link') && this.model.linkHasValue()) {
-                this.$el.find('.amount').val(this.model.get('amount').toLocaleString('en-US', {
-                    minimumFractionDigits: 2,
-                    maximumFractionDigits: 2
-                }));
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         focus: function( e ) {
+                       var $target = $( e.target );
+                       $target.parents( 'td' ).addClass( 'focused' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if ($target.hasClass('note') && $target.parents('tr').hasClass('is-new')) {
-                if (_.contains(['New Expense Item', 'New Income Item'], this.model.get('note'))) {
-                    this.$el.find('.note').val('');
-                }
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( ( $target.hasClass( 'amount' ) || $target.hasClass( 'link-value' ) ) && this.model.get( 'link' ) && this.model.linkHasValue() ) {
+                               this.$el.find( '.amount' ).val( this.model.get( 'amount' ).toLocaleString( 'en-US', {
+                                       minimumFractionDigits : 2,
+                                       maximumFractionDigits : 2,
+                               } ) );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $target.hasClass( 'note' ) && $target.parents( 'tr' ).hasClass( 'is-new' ) ) {
+                               if ( _.contains( [ 'New Expense Item', 'New Income Item' ], this.model.get( 'note' ) ) ) {
+                                       this.$el.find( '.note' ).val( '' );
+                               }
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        blur: function(e) {
-            var $target = $(e.target);
-            $target.parents('td').removeClass('focused');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return this;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if (($target.hasClass('amount') || $target.hasClass('link-value')) && this.model.get('link')) {
-                this.$el.find('.amount').val(this.model.getRealAmount().toLocaleString('en-US', {
-                    minimumFractionDigits: 2,
-                    maximumFractionDigits: 2
-                }));
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         blur: function( e ) {
+                       var $target = $( e.target );
+                       $target.parents( 'td' ).removeClass( 'focused' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if ($target.hasClass('note') && $target.parents('tr').hasClass('is-new')) {
-                if (_.contains(['New Expense Item', 'New Income Item'], this.model.get('note'))) {
-                    this.$el.find('.note').val(this.model.get('note'));
-                }
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( ( $target.hasClass( 'amount' ) || $target.hasClass( 'link-value' ) ) && this.model.get( 'link' ) ) {
+                               this.$el.find( '.amount' ).val( this.model.getRealAmount().toLocaleString( 'en-US', {
+                                       minimumFractionDigits : 2,
+                                       maximumFractionDigits : 2,
+                               } ) );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $target.hasClass( 'note' ) && $target.parents( 'tr' ).hasClass( 'is-new' ) ) {
+                               if ( _.contains( [ 'New Expense Item', 'New Income Item' ], this.model.get( 'note' ) ) ) {
+                                       this.$el.find( '.note' ).val( this.model.get( 'note' ) );
+                               }
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        render: function() {
-            var data = this.model.toJSON();
-            data.realAmount = this.model.getRealAmount();
-            data.realAmountFormatted = data.realAmount.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
-            data.amountFormatted = data.amount.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
-            data.linkLabel = this.model.getLinkLabel();
-            data.linkHasValue = this.model.linkHasValue();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return this;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            this.template = _.template($('#wcb-tmpl-entry').html(), null, template_options);
-            this.$el.html(this.template(data));
-            this.$el.toggleClass('has-changed', this.model.hasChanged() && ! this.model.get('new'));
-            this.$el.toggleClass('is-new', this.model.get('new'));
-            this.$el.data('wcb-cid', this.model.cid);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         render: function() {
+                       var data                 = this.model.toJSON();
+                       data.realAmount          = this.model.getRealAmount();
+                       data.realAmountFormatted = data.realAmount.toLocaleString( 'en-US', {
+                               minimumFractionDigits : 2,
+                               maximumFractionDigits : 2,
+                       } );
+                       data.amountFormatted     = data.amount.toLocaleString( 'en-US', {
+                               minimumFractionDigits : 2,
+                               maximumFractionDigits : 2,
+                       } );
+                       data.linkLabel           = this.model.getLinkLabel();
+                       data.linkHasValue        = this.model.linkHasValue();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if( data.name === 'currency' && $.fn.hasOwnProperty( 'select2' ) ){
-                               var currSelect2Box = this.$el.find( 'select' ).select2( { width: '100%' } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 this.template = _.template( $( '#wcb-tmpl-entry' ).html(), null, template_options );
+                       this.$el.html( this.template( data ) );
+                       this.$el.toggleClass( 'has-changed', this.model.hasChanged() && ! this.model.get( 'new' ) );
+                       this.$el.toggleClass( 'is-new', this.model.get( 'new' ) );
+                       this.$el.data( 'wcb-cid', this.model.cid );
+
+                       if ( data.name === 'currency' && $.fn.hasOwnProperty( 'select2' ) ) {
+                               var currSelect2Box       = this.$el.find( 'select' ).select2( { width: '100%' } );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 var initializedSelectBox = currSelect2Box.data( 'select2' );
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( initializedSelectBox ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        initializedSelectBox.$dropdown.addClass( 'select2-currency-dropdown' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -236,301 +250,339 @@
</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">-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return this;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        keyup: function(e) {
-            if (e.keyCode == 27) {
-                return this.editCancel.apply(this, arguments);
-            } else if (e.keyCode == 13) {
-                return this.editSave.apply(this, arguments);
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         keyup: function( e ) {
+                       if ( e.keyCode == 27 ) {
+                               return this.editCancel.apply( this, arguments );
+                       } else if ( e.keyCode == 13 ) {
+                               return this.editSave.apply( this, arguments );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return this;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        editSave: function(e) {
-            if (this.model.get('type') == 'meta') {
-                var value = this.$el.find('.value').val(),
-                    name = this.model.get('name');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         editSave: function( e ) {
+                       if ( this.model.get( 'type' ) == 'meta' ) {
+                               var value = this.$el.find( '.value' ).val(),
+                                       name  = this.model.get( 'name' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (_.contains(['attendees', 'days', 'tracks', 'speakers', 'volunteers'], name)) {
-                    value = parseInt(value.replace(/[^\d.-]/g, '')) || 0;
-                } else if (_.contains(['ticket-price'], name)) {
-                    value = parseFloat(value.replace(/[^\d.-]/g, '')) || 0;
-                }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( _.contains( [ 'attendees', 'days', 'tracks', 'speakers', 'volunteers' ], name ) ) {
+                                       value = parseInt( value.replace( /[^\d.-]/g, '' ) ) || 0;
+                               } else if ( _.contains( [ 'ticket-price' ], name ) ) {
+                                       value = parseFloat( value.replace( /[^\d.-]/g, '' ) ) || 0;
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                this.model.set('value', value);
-            } else {
-                this.model.set('note', this.$el.find('.note').val());
-                this.model.set('category', this.$el.find('.category').val());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         this.model.set( 'value', value );
+                       } else {
+                               this.model.set( 'note', this.$el.find( '.note' ).val() );
+                               this.model.set( 'category', this.$el.find( '.category' ).val() );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                var $target = $(e.target);
-                if ($target.hasClass('amount') || $target.hasClass('link-value')) {
-                    var amount = parseFloat(this.$el.find('.amount').val().replace(/[^\d.-]/g, ''));
-                    this.model.set('amount', amount || 0);
-                }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         var $target = $( e.target );
+                               if ( $target.hasClass( 'amount' ) || $target.hasClass( 'link-value' ) ) {
+                                       var amount = parseFloat( this.$el.find( '.amount' ).val().replace( /[^\d.-]/g, '' ) );
+                                       this.model.set( 'amount', amount || 0 );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 this.render.apply( this );
</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">-            this.clearSelection.apply(this);
-            return false;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 this.clearSelection.apply( this );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        editCancel: function(e) {
-            this.clearSelection.apply(this);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return false;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if (this.model.get('type') == 'meta') {
-                this.$el.find('.value').val(this.model.get('value'));
-            } else {
-                this.$el.find('.amount').val(this.model.get('amount'));
-                this.$el.find('.note').val(this.model.get('note'));
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         editCancel: function( e ) {
+                       this.clearSelection.apply( this );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            this.editSave.apply(this, arguments);
-            return false;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( this.model.get( 'type' ) == 'meta' ) {
+                               this.$el.find( '.value' ).val( this.model.get( 'value' ) );
+                       } else {
+                               this.$el.find( '.amount' ).val( this.model.get( 'amount' ) );
+                               this.$el.find( '.note' ).val( this.model.get( 'note' ) );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        clearSelection: function() {
-            if (window.getSelection) {
-                if (window.getSelection().empty) {
-                    window.getSelection().empty();
-                } else if (window.getSelection().removeAllRanges) {
-                    window.getSelection().removeAllRanges();
-                }
-            } else if (document.selection) {
-                document.selection.empty();
-            }
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 this.editSave.apply( this, arguments );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        delete: function() {
-            if (!confirm('Delete this line item?'))
-                return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return false;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            this.model.destroy();
-            wcb.summary.render.apply(wcb.summary);
-            return false;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         clearSelection: function() {
+                       if ( window.getSelection ) {
+                               if ( window.getSelection().empty ) {
+                                       window.getSelection().empty();
+                               } else if ( window.getSelection().removeAllRanges ) {
+                                       window.getSelection().removeAllRanges();
+                               }
+                       } else if ( document.selection ) {
+                               document.selection.empty();
+                       }
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        move: function() {
-            return false;
-        }
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         delete: function() {
+                       if ( ! confirm( 'Delete this line item?' ) ) {
+                               return false;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    var Entries = Backbone.Collection.extend({
-        model: Entry
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 this.model.destroy();
+                       wcb.summary.render.apply( wcb.summary );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    var EntriesView = Backbone.View.extend({
-        tagName: 'table',
-        className: 'wcb-table',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return false;
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        initialize: function() {
-            this.collection.bind('add', this.addOne, this);
-            this.collection.bind('change reset', this.refresh, this);
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         move: function() {
+                       return false;
+               },
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        refresh: function(model) {
-            if (model.get('type') == 'meta') {
-                this.render.apply(this);
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Entries = Backbone.Collection.extend( {
+               model : Entry,
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            wcb.summary.render.apply(wcb.summary);
-            return this;
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var EntriesView = Backbone.View.extend( {
+               tagName   : 'table',
+               className : 'wcb-table',
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        addOne: function(item) {
-            var view = new EntryView({model: item});
-            switch (view.model.get('type')) {
-                case 'expense':
-                    var $c = $expense;
-                    break;
-                case 'income':
-                    var $c = $income;
-                    break;
-                case 'meta':
-                default:
-                    var $c = $meta;
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         initialize: function() {
+                       this.collection.bind( 'add', this.addOne, this );
+                       this.collection.bind( 'change reset', this.refresh, this );
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $c.before(view.render().el);
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         refresh: function( model ) {
+                       if ( model.get( 'type' ) == 'meta' ) {
+                               this.render.apply( this );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        render: function() {
-            $container.find('.wcb-entry').remove();
-            this.collection.each(this.addOne, this);
-            return this;
-        }
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wcb.summary.render.apply( wcb.summary );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        return this;
+               },
+
+               addOne: function( item ) {
+                       var view = new EntryView( { model: item } );
+
+                       switch ( view.model.get( 'type' ) ) {
+                               case 'expense':
+                                       var $c = $expense;
+                                       break;
+                               case 'income':
+                                       var $c = $income;
+                                       break;
+                               case 'meta':
+                               default:
+                                       var $c = $meta;
+                       }
+
+                       $c.before( view.render().el );
+               },
+
+               render: function() {
+                       $container.find( '.wcb-entry' ).remove();
+                       this.collection.each( this.addOne, this );
+
+                       return this;
+               },
+       } );
+
</ins><span class="cx" style="display: block; padding: 0 10px">         // Decode HTML entities in category names
</span><span class="cx" style="display: block; padding: 0 10px">        _.each( wcb.categories, function( name, slug, list ) {
</span><span class="cx" style="display: block; padding: 0 10px">                list[ slug ] = name.replace( '&amp;', '&' );
</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">-    wcb.metaLabels = {
-        'attendees': 'Attendees',
-        'days': 'Days',
-        'tracks': 'Tracks',
-        'speakers': 'Speakers',
-        'volunteers': 'Volunteers',
-        'currency': 'Currency',
-        'ticket-price': 'Ticket Price'
-    };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wcb.metaLabels = {
+               'attendees'    : 'Attendees',
+               'days'         : 'Days',
+               'tracks'       : 'Tracks',
+               'speakers'     : 'Speakers',
+               'volunteers'   : 'Volunteers',
+               'currency'     : 'Currency',
+               'ticket-price' : 'Ticket Price',
+       };
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    wcb.linkData = {
-        'per-speaker': {
-            'label': 'per speaker',
-            'hasValue': true,
-            'callback': function(value) {
-                return parseFloat(value) * parseInt(wcb.table.collection.findWhere({type: 'meta', name: 'speakers'}).get('value'));
-            }
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wcb.linkData = {
+               'per-speaker' : {
+                       'label'    : 'per speaker',
+                       'hasValue' : true,
+                       'callback' : function( value ) {
+                               return parseFloat( value ) * parseInt( wcb.table.collection.findWhere( {
+                                       type : 'meta',
+                                       name : 'speakers',
+                               } ).get( 'value' ) );
+                       },
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        'per-volunteer': {
-            'label': 'per volunteer',
-            'hasValue': true,
-            'callback': function(value) {
-                return parseFloat(value) * parseInt(wcb.table.collection.findWhere({type: 'meta', name: 'volunteers'}).get('value'));
-            }
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'per-volunteer' : {
+                       'label'    : 'per volunteer',
+                       'hasValue' : true,
+                       'callback' : function( value ) {
+                               return parseFloat( value ) * parseInt( wcb.table.collection.findWhere( {
+                                       type : 'meta',
+                                       name : 'volunteers',
+                               } ).get( 'value' ) );
+                       },
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        'per-speaker-volunteer': {
-            'label': 'per speakers + volunteers',
-            'hasValue': true,
-            'callback': function(value) {
-                return parseFloat(value) * (
-                    parseInt(wcb.table.collection.findWhere({type: 'meta', name: 'volunteers'}).get('value'))
-                    + parseInt(wcb.table.collection.findWhere({type: 'meta', name: 'speakers'}).get('value'))
-                );
-            }
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'per-speaker-volunteer' : {
+                       'label'    : 'per speakers + volunteers',
+                       'hasValue' : true,
+                       'callback' : function( value ) {
+                               return parseFloat( value ) * (
+                                       parseInt( wcb.table.collection.findWhere( {
+                                               type : 'meta',
+                                               name : 'volunteers',
+                                       } ).get( 'value' ) )
+                                       + parseInt( wcb.table.collection.findWhere( {
+                                               type : 'meta',
+                                               name : 'speakers',
+                                       } ).get( 'value' ) )
+                               );
+                       },
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        'per-attendee': {
-            'label': 'per attendee',
-            'hasValue': true,
-            'callback': function(value) {
-                return parseFloat(value) * parseInt(wcb.table.collection.findWhere({type: 'meta', name: 'attendees'}).get('value'));
-            }
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'per-attendee' : {
+                       'label'    : 'per attendee',
+                       'hasValue' : true,
+                       'callback' : function( value ) {
+                               return parseFloat( value ) * parseInt( wcb.table.collection.findWhere( {
+                                       type : 'meta',
+                                       name : 'attendees',
+                               } ).get( 'value' ) );
+                       },
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        'per-day': {
-            'label': 'per day',
-            'hasValue': true,
-            'callback': function(value) {
-                return parseFloat(value) * parseInt(wcb.table.collection.findWhere({type: 'meta', name: 'days'}).get('value'));
-            }
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'per-day' : {
+                       'label'    : 'per day',
+                       'hasValue' : true,
+                       'callback' : function( value ) {
+                               return parseFloat( value ) * parseInt( wcb.table.collection.findWhere( {
+                                       type : 'meta',
+                                       name : 'days',
+                               } ).get( 'value' ) );
+                       },
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        'per-track': {
-            'label': 'per track',
-            'hasValue': true,
-            'callback': function(value) {
-                return parseFloat(value) * parseInt(wcb.table.collection.findWhere({type: 'meta', name: 'tracks'}).get('value'));
-            }
-        },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'per-track' : {
+                       'label'    : 'per track',
+                       'hasValue' : true,
+                       'callback' : function( value ) {
+                               return parseFloat( value ) * parseInt( wcb.table.collection.findWhere( {
+                                       type : 'meta',
+                                       name : 'tracks',
+                               } ).get( 'value' ) );
+                       },
+               },
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        'ticket-price-x-attendees': {
-            'label': 'ticket price &times; attendees',
-            'hasValue': false,
-            'callback': function(value) {
-                var attendees = wcb.table.collection.findWhere({type: 'meta', name: 'attendees'}).get('value');
-                var price = wcb.table.collection.findWhere({type: 'meta', name: 'ticket-price'}).get('value');
-                return parseInt(attendees) * parseFloat(price);
-            }
-        }
-    };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'ticket-price-x-attendees' : {
+                       'label'    : 'ticket price &times; attendees',
+                       'hasValue' : false,
+                       'callback' : function( value ) {
+                               var attendees = wcb.table.collection.findWhere( {
+                                       type : 'meta',
+                                       name : 'attendees',
+                               } ).get( 'value' );
+                               var price     = wcb.table.collection.findWhere( {
+                                       type : 'meta',
+                                       name : 'ticket-price',
+                               } ).get( 'value' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    var table = new EntriesView({collection: new Entries()});
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return parseInt( attendees ) * parseFloat( price );
+                       },
+               },
+       };
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    $income.on('click', function() {
-        table.collection.add(new wcb.models.Entry({
-            type: 'income',
-            amount: 0,
-            note: 'New Income Item',
-            category: 'other',
-            new: true
-        })).editStart();
-        return false;
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var table = new EntriesView( { collection: new Entries() } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    $expense.on('click', function() {
-        table.collection.add(new wcb.models.Entry({
-            type: 'expense',
-            amount: 0,
-            note: 'New Expense Item',
-            category: 'other',
-            new: true
-        })).editStart();
-        return false;
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $income.on( 'click', function() {
+               table.collection.add( new wcb.models.Entry( {
+                       type     : 'income',
+                       amount   : 0,
+                       note     : 'New Income Item',
+                       category : 'other',
+                       new      : true,
+               } ) ).editStart();
+               return false;
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    $form.on('submit', function() {
-        $container.find('.wcb-entry').each(function(el){
-            var $this = $(this);
-                model = wcb.table.collection.get($this.data('wcb-cid'));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expense.on( 'click', function() {
+               table.collection.add( new wcb.models.Entry( {
+                       type     : 'expense',
+                       amount   : 0,
+                       note     : 'New Expense Item',
+                       category : 'other',
+                       new      : true,
+               } ) ).editStart();
+               return false;
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            model.set({'order': $this.index()}, {silent: true});
-        });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $form.on( 'submit', function() {
+               $container.find( '.wcb-entry' ).each( function( el ) {
+                       var $this = $( this );
+                       model     = wcb.table.collection.get( $this.data( 'wcb-cid' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        var sorted = JSON.stringify(wcb.table.collection.sortBy(function(m){
-            return m.get('type') + ':' + (m.get('order')/Math.pow(10,10)).toFixed(10); // Don't ask.
-        }));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 model.set( { 'order': $this.index() }, { silent: true } );
+               } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $form.find('[name="_wcb_budget_data"]').val(sorted);
-        return true;
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         var sorted = JSON.stringify( wcb.table.collection.sortBy( function( m ) {
+                       return m.get( 'type' ) + ':' + ( m.get( 'order' ) / Math.pow( 10, 10 ) ).toFixed( 10 ); // Don't ask.
+               } ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    wcb.models.Entry = Entry;
-    wcb.table = table;
-    wcb.summary = new SummaryView();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $form.find( '[name="_wcb_budget_data"]' ).val( sorted );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    // Sort all the input by types, meta first, because linked data in
-    // income and expenses rely on meta values.
-    var types = ['meta', 'expense', 'income'];
-    wcb.input = _.sortBy(wcb.input, function(i) {
-        return types.indexOf(i.type);
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return true;
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    _.each(wcb.input, function(i){
-        wcb.table.collection.add(new wcb.models.Entry(i));
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wcb.models.Entry = Entry;
+       wcb.table        = table;
+       wcb.summary      = new SummaryView();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    wcb.summary.urls = wcb.urls;
-    wcb.summary.render();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Sort all the input by types, meta first, because linked data in
+       // income and expenses rely on meta values.
+       var types = [ 'meta', 'expense', 'income' ];
+       wcb.input = _.sortBy( wcb.input, function( i ) {
+               return types.indexOf( i.type );
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    // Allow sorting entries.
-    $container.sortable({
-        items: '.wcb-entry',
-        handle: '.move',
-        axis: 'y',
-        placeholder: 'wcb-entry-placeholder',
-        start: function(e, ui) {
-            ui.placeholder.height(ui.item.height());
-        }
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _.each( wcb.input, function( i ) {
+               wcb.table.collection.add( new wcb.models.Entry( i ) );
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    // Update nonces when necessary.
-    // TODO: Add post locking.
-    $document.on('heartbeat-send', function(e, data) {
-        data['wcb_budgets_heartbeat'] = 1;
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wcb.summary.urls = wcb.urls;
+       wcb.summary.render();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    $document.on('heartbeat-tick', function(e, data) {
-        $('#_wpnonce').val(data.wcb_budgets.nonce);
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Allow sorting entries.
+       $container.sortable( {
+               items       : '.wcb-entry',
+               handle      : '.move',
+               axis        : 'y',
+               placeholder : 'wcb-entry-placeholder',
+               start       : function( e, ui ) {
+                       ui.placeholder.height( ui.item.height() );
+               },
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    $document.on('click', '#wcb-budget-submit', function() {
-        if (!confirm('Are you sure you would like to submit this budget for approval?'))
-            return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Update nonces when necessary.
+       // TODO: Add post locking.
+       $document.on( 'heartbeat-send', function( e, data ) {
+               data[ 'wcb_budgets_heartbeat' ] = 1;
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return true;
-    });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $document.on( 'heartbeat-tick', function( e, data ) {
+               $( '#_wpnonce' ).val( data.wcb_budgets.nonce );
+       } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    $document.on('click', '#wcb-budget-approve, #wcb-budget-reject', function() {
-        if (!confirm('Are you sure?'))
-            return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $document.on( 'click', '#wcb-budget-submit', function() {
+               if ( ! confirm( 'Are you sure you would like to submit this budget for approval?' ) ) {
+                       return false;
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return true;
-    });
-}(jQuery));
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                return true;
+       } );
+
+       $document.on( 'click', '#wcb-budget-approve, #wcb-budget-reject', function() {
+               if ( ! confirm( 'Are you sure?' ) ) {
+                       return false;
+               }
+
+               return true;
+       } );
+}( jQuery ) );
</ins></span></pre>
</div>
</div>

</body>
</html>