<!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>[2276] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments: WordCamp Budgets: Rename `wordcamp-budgets` script to `payment-requests`.</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/2276">2276</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/2276","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-12 15:56:43 +0000 (Tue, 12 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: Rename `wordcamp-budgets` script to `payment-requests`.
It only deals with payment requests, rather than having functionality common to all modules.</pre>
<h3>Modified Paths</h3>
<ul>
<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>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js</a></li>
</ul>
<h3>Removed 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_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-12 15:01:45 UTC (rev 2275)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php 2016-01-12 15:56:43 UTC (rev 2276)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,8 +23,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Register our assets
</span><span class="cx" style="display: block; padding: 0 10px"> wp_register_script(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'wordcamp-budgets',
- plugins_url( 'javascript/wordcamp-budgets.js', __DIR__ ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'payment-requests',
+ plugins_url( 'javascript/payment-requests.js', __DIR__ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ),
</span><span class="cx" style="display: block; padding: 0 10px"> self::VERSION,
</span><span class="cx" style="display: block; padding: 0 10px"> true
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,7 +33,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp_register_script(
</span><span class="cx" style="display: block; padding: 0 10px"> 'wcp-attached-files',
</span><span class="cx" style="display: block; padding: 0 10px"> plugins_url( 'javascript/attached-files.js', __DIR__ ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( 'wordcamp-budgets', 'backbone', 'wp-util' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( 'payment-requests', 'backbone', 'wp-util' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> self::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="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,7 +55,7 @@
</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="cx" style="display: block; padding: 0 10px"> if ( in_array( $current_screen->id, array( 'edit-wcp_payment_request', 'wcp_payment_request' ) ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_enqueue_script( 'wordcamp-budgets' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_enqueue_script( 'payment-requests' );
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_enqueue_style( 'wordcamp-budgets' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $current_screen->id, array( 'wcp_payment_request' ) ) && isset( $post->ID ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,7 +64,7 @@
</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"> wp_localize_script(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'wordcamp-budgets',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'payment-requests',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wcpLocalizedStrings', // todo merge into wordcampBudgets var
</span><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></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-12 15:01:45 UTC (rev 2275)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js 2016-01-12 15:56:43 UTC (rev 2276)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,7 +3,7 @@
</span><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">- $.wordcampBudgets.AttachedFile = Backbone.Model.extend( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $.paymentRequests.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 +15,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">- $.wordcampBudgets.AttachedFiles = Backbone.Collection.extend( {
- model: $.wordcampBudgets.AttachedFile
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $.paymentRequests.AttachedFiles = Backbone.Collection.extend( {
+ model: $.paymentRequests.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">- $.wordcampBudgets.AttachedFileView = Backbone.View.extend( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $.paymentRequests.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 +39,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">- $.wordcampBudgets.AttachedFilesView = Backbone.View.extend( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $.paymentRequests.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 $.wordcampBudgets.AttachedFiles( wcpAttachedFiles );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.collection = new $.paymentRequests.AttachedFiles( wcpAttachedFiles );
</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 +61,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 $.wordcampBudgets.AttachedFileView( { model: file } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var attachedFileView = new $.paymentRequests.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 +78,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 {wordcampBudgets.AttachedFile} file
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {paymentRequests.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 +97,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">- $.wordcampBudgets.attachedFilesView = new $.wordcampBudgets.AttachedFilesView();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $.paymentRequests.attachedFilesView = new $.paymentRequests.AttachedFilesView();
</ins><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_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjsfromrev2272sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptwordcampbudgetsjs"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js (from rev 2272, 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/payment-requests.js (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js 2016-01-12 15:56:43 UTC (rev 2276)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,130 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+jQuery( document ).ready( function( $ ) {
+
+ $.paymentRequests = {
+
+ /**
+ * Main entry point
+ */
+ init: function () {
+ $.paymentRequests.registerEventHandlers();
+ $.paymentRequests.setupDatePicker();
+ },
+
+ /**
+ * Registers event handlers
+ */
+ registerEventHandlers : function() {
+ $( '#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 );
+ },
+
+ /**
+ * 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
+ },
+
+ /**
+ * Example event handler
+ *
+ * @param {object} event
+ */
+ toggleOtherCategoryDescription : function( event ) {
+ var otherCategoryDescription = $( '#row-other-category-explanation' );
+
+ if ( 'other' == $( this ).find( 'option:selected' ).val() ) {
+ $( otherCategoryDescription ).removeClass( 'hidden' );
+ } else {
+ $( otherCategoryDescription ).addClass( 'hidden' );
+ }
+
+ // todo make the transition smoother
+ },
+
+ /**
+ * 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
+ } );
+ }
+ },
+
+ /**
+ * Require notes when the request is being marked as incomplete
+ */
+ requireNotes : function() {
+ var notes = $( '#wcp_mark_incomplete_notes' );
+
+ if ( 'checked' === $( '#wcp_mark_incomplete_checkbox' ).attr( 'checked' ) ) {
+ notes.attr( 'required', true );
+ } else {
+ notes.attr( 'required', false );
+ }
+ }
+ };
+
+ $.paymentRequests.init();
+} );
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptwordcampbudgetsjs"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: 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 2016-01-12 15:01:45 UTC (rev 2275)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js 2016-01-12 15:56:43 UTC (rev 2276)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,130 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-jQuery( document ).ready( function( $ ) {
-
- $.wordcampBudgets = {
-
- /**
- * Main entry point
- */
- init: function () {
- $.wordcampBudgets.registerEventHandlers();
- $.wordcampBudgets.setupDatePicker();
- },
-
- /**
- * Registers event handlers
- */
- registerEventHandlers : function() {
- $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.wordcampBudgets.togglePaymentMethodFields );
- $( '#payment_category' ).change( $.wordcampBudgets.toggleOtherCategoryDescription );
- $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.wordcampBudgets.showUploadModal );
- $( '#wcp_mark_incomplete_checkbox' ).click( $.wordcampBudgets.requireNotes );
- },
-
- /**
- * 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
- },
-
- /**
- * Example event handler
- *
- * @param {object} event
- */
- toggleOtherCategoryDescription : function( event ) {
- var otherCategoryDescription = $( '#row-other-category-explanation' );
-
- if ( 'other' == $( this ).find( 'option:selected' ).val() ) {
- $( otherCategoryDescription ).removeClass( 'hidden' );
- } else {
- $( otherCategoryDescription ).addClass( 'hidden' );
- }
-
- // todo make the transition smoother
- },
-
- /**
- * Initialize Core's Media Picker
- *
- * @param {object} event
- */
- showUploadModal : function( event ) {
- if ( 'undefined' == typeof $.wordcampBudgets.fileUploadFrame ) {
- // Create the frame
- $.wordcampBudgets.fileUploadFrame = wp.media( {
- title: wcpLocalizedStrings.uploadModalTitle,
- multiple: true,
- button: {
- text: wcpLocalizedStrings.uploadModalButton
- }
- } );
-
- // Add models to the collection for each selected attachment
- $.wordcampBudgets.fileUploadFrame.on( 'select', $.wordcampBudgets.addSelectedFilesToCollection );
- }
-
- $.wordcampBudgets.fileUploadFrame.open();
- return false;
- },
-
- /**
- * Add files selected from the Media Picker to the current collection of files
- */
- addSelectedFilesToCollection : function() {
- var attachments = $.wordcampBudgets.fileUploadFrame.state().get( 'selection' ).toJSON();
-
- $.each( attachments, function( index, attachment ) {
- var newFile = new $.wordcampBudgets.AttachedFile( {
- 'ID': attachment.id,
- 'post_parent': attachment.uploadedTo,
- 'filename': attachment.filename,
- 'url': attachment.url
- } );
-
- $.wordcampBudgets.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
- } );
- }
- },
-
- /**
- * Require notes when the request is being marked as incomplete
- */
- requireNotes : function() {
- var notes = $( '#wcp_mark_incomplete_notes' );
-
- if ( 'checked' === $( '#wcp_mark_incomplete_checkbox' ).attr( 'checked' ) ) {
- notes.attr( 'required', true );
- } else {
- notes.attr( 'required', false );
- }
- }
- };
-
- $.wordcampBudgets.init();
-} );
</del></span></pre>
</div>
</div>
</body>
</html>