Skip to content

Commit

Permalink
Fix: Update assets, see #48
Browse files Browse the repository at this point in the history
  • Loading branch information
Franz Josef Kaiser committed Nov 16, 2016
1 parent 9e7cd6e commit cb702e0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 28 deletions.
61 changes: 38 additions & 23 deletions assets/src/logo/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,18 @@
task : 'fetch'
} )
)
.then(
// success
function( response ) {
//console.log( 'RESPONSE', self.attributes );
},
// error
function( reason ) {
//console.log( 'Model:fetch Error',reason );
}
);
.done( function( response ) {
self.set( {
thumb : response.data.thumb,
name : response.data.name,
width : response.data.width,
height : response.data.height,
link : response.data.link
} );
} )
.fail( function( reason ) {
//console.log( 'Model:fetch Error',reason );
} );

/*wp.ajax.post( plugin.action, {
_ajax_nonce : plugin._ajax_nonce,
Expand All @@ -69,7 +71,9 @@

// Triggered by: views.Delete
destroy : function( att_id ) {

var self = this;

$.when(
$.post( this.urlRoot, {
action : plugin.action,
Expand All @@ -78,16 +82,13 @@
task : 'destroy'
} )
)
.then(
// success
function( response ) {
//console.log( 'Model:destroy Success', response );
},
// error
function( reason ) {
//console.log( 'Model:destroy Error', reason );
}
);
.done( function( response ) {
// console.log( 'Model:destroy Success', response );
} )
.fail( function( reason ) {
// console.log( 'Model:destroy Error', reason );
} );

return {};
}
} );
Expand Down Expand Up @@ -260,9 +261,23 @@
// Bind event handler to file upload / drag&drop
uploader.bind( 'FileUploaded', function( up, file, response ) {

if ( 200 !== response.status ) {
return;
}
if ( 200 !== response.status ) {
return;
}

// Start C&P from handlers.js
// https://github.com/WordPress/WordPress/blob/32be6f7bb73b5c8e4bdd90179aa85b275606d982/wp-includes/js/plupload/handlers.js#L83-L87

var serverData = response.response;

// on success serverData should be numeric, fix bug in html4 runtime returning the serverData wrapped in a <pre> tag
serverData = serverData.replace(/^<pre>(\d+)<\/pre>$/, '$1');

// if async-upload returned an error message, place it in the media item div and return
if ( serverData.match(/media-upload-error|error-div/) ) {
return;
}
// End C&P from handlers.js

// Triggers Model:fetch( att_id ) & event listeners in the views
logo.set( { 'att_id' : response.response } );
Expand Down
2 changes: 1 addition & 1 deletion assets/src/logo/all.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/src/logo/controller.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/src/logo/models.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/src/logo/views.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb702e0

Please sign in to comment.