Skip to content
This repository has been archived by the owner on Jul 5, 2018. It is now read-only.

38317 #240

Merged
merged 2 commits into from
Sep 5, 2012
Merged

38317 #240

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/www/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ header .back {
tap-highlight-color: rgba( 0, 0, 0, 0 );
}

.back:disabled {
opacity: 0.2;
}

/* upload page */
#upload-page .popup {
text-align: center;
Expand Down
27 changes: 17 additions & 10 deletions assets/www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,17 @@ require( [ 'jquery', 'l10n', 'geo', 'api', 'templates', 'monuments', 'monument',
return displayError( code, info, info ? true : false );
}

function uploadProgressHandler( state ) {
$( '#upload-progress-page .back' ).attr( 'disabled', false );
if( state === 'starting' ) {
$( '#upload-progress-state' ).html( mw.msg( 'upload-progress-starting' ) );
showPage( 'upload-progress-page' );
} else if ( state === 'in-progress' ) {
$( '#upload-progress-page .back' ).attr( 'disabled', true );
$( '#upload-progress-state' ).html( mw.msg( 'upload-progress-in-progress' ) );
}
}

function showPhotoConfirmation(fileUrl) {
var comment = mw.msg( 'upload-comment', WLMConfig.VERSION_NUMBER );
var uploadConfirmTemplate = templates.getTemplate('upload-confirm-template');
Expand Down Expand Up @@ -591,14 +602,7 @@ require( [ 'jquery', 'l10n', 'geo', 'api', 'templates', 'monuments', 'monument',
goBack(); // undo back button to skip upload progress page
goBack(); // undo back button to skip upload form
showPage( 'upload-latest-page' );
} ).progress( function( state ) {
if( state === 'starting' ) {
$( '#upload-progress-state' ).html(mw.msg( 'upload-progress-starting' ));
showPage("upload-progress-page");
} else if ( state === 'in-progress' ) {
$("#upload-progress-state").html(mw.msg("upload-progress-in-progress"));
}
} ).fail( function( data ) {
} ).progress( uploadProgressHandler ).fail( function( data ) {
var container;
if (data == "Aborted") {
// no-op
Expand Down Expand Up @@ -1077,7 +1081,9 @@ require( [ 'jquery', 'l10n', 'geo', 'api', 'templates', 'monuments', 'monument',
// allow cancellation of current api upload request
$( '#upload-progress-page .back' ).click( function() {
console.log( 'request to cancel upload' );
api.cancel();
if ( !$( this ).is( ':disabled' ) ) {
api.cancel();
}
});

// setup dropdowns that allow switching a page
Expand Down Expand Up @@ -1120,7 +1126,8 @@ require( [ 'jquery', 'l10n', 'geo', 'api', 'templates', 'monuments', 'monument',
resolveImageThumbnail: resolveImageThumbnail,
showPage: showPage,
translateAdminLevels: translateAdminLevels,
uploadErrorHandler: uploadErrorHandler
uploadErrorHandler: uploadErrorHandler,
uploadProgressHandler: uploadProgressHandler
},
commonsApi: commonsApi,
db: db,
Expand Down
11 changes: 3 additions & 8 deletions assets/www/js/page-uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/*jslint sloppy: true, white:true, maxerr: 50, indent: 4, plusplus: true, vars:true */
define( [ 'jquery' ], function() {
var api, db, templates, commonsApi, showMonumentDetail, showPage, translateAdminLevels,
app,
doLogin, uploadErrorHandler,
uploadsRendered = 0, // For display caching: compare vs db.dirty
incompleteUploadsRendered = 0,
Expand Down Expand Up @@ -218,14 +219,7 @@ define( [ 'jquery' ], function() {
db.completeUpload( photo ).done( function() {
iter();
} );
} ).progress( function( state ) {
if( state === 'starting' ) {
$( '#upload-progress-state' ).html(mw.msg( 'upload-progress-starting' ));
showPage("upload-progress-page");
} else if ( state === 'in-progress' ) {
$("#upload-progress-state").html(mw.msg("upload-progress-in-progress"));
}
} ).fail( function( data ) {
} ).progress( app.uploadProgressHandler ).fail( function( data ) {
// @todo show error data here
if ( data === 'Aborted' ) {
// no-op
Expand All @@ -245,6 +239,7 @@ define( [ 'jquery' ], function() {
}

function UploadPage( WLMMobile ) {
app = WLMMobile.app;
api = WLMMobile.api;
db = WLMMobile.db;
Monument = WLMMobile.Monument;
Expand Down