Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better save-button status messages

  • Loading branch information...
commit feb28e671dcb7f0af85abc9bc76ce0ed72077bf4 1 parent 8e9f955
Ted Scharff deleted authored
10 geocamTiePoint/static/geocamTiePoint/js/backbone/models.js
View
@@ -147,11 +147,15 @@ $(function($) {
var model = this;
model.trigger('before_warp');
saveOptions = {
- error: function(){
+ error: function(model, response){
+ if ( response.readyState < 4 ) {
+ model.trigger('warp_server_unreachable');
+ } else {
+ model.trigger('warp_server_error');
+ }
if (options.error) options.error();
- model.trigger('warp_error');
},
- success: function() {
+ success: function(model, response) {
if (options.success) options.success();
model.trigger('warp_success');
},
21 geocamTiePoint/static/geocamTiePoint/js/backbone/views.js
View
@@ -499,7 +499,7 @@ $(function($) {
'<div id="save-export" class="btn-group">'+
'<button class="btn" id="export">Share</button>'+
'<button class="btn" id="save">Save</button>'+
- '<span id="saveStatus" data-saving-text="Saving..." data-saved-text="Saved." data-save-error="SAVE ERROR!"></span>'+
+ '<span id="saveStatus" data-saving-text="Saving..." data-changed-text="Changed since last save" data-saved-text="Saved." data-server-error="Server Error" data-server-unreachable="Server unreachable"></span>'+
'</div>'+
'</div>' +
'<div id="split_container">' +
@@ -695,28 +695,23 @@ $(function($) {
$('button#save').click( function() {
var button = $(this);
button.data('original-text', button.text());
- button.disabled = true;
overlay.warp({
success: function(model, response) {
- button.disabled = false;
- button.text(button.data('original-text'));
$('input#show_preview').attr('checked', true).change();
- },
- error: function(model, response) {
- button.disabled = false;
- button.text("FAILED");
- _.delay(function(){button.text("save");}, 1000);
- },
+ }
});
});
var saveStatus = $('#saveStatus');
this.model.on('before_warp', function(){
- saveStatus.text(saveStatus.data('saving-text'));
+ //saveStatus.text(saveStatus.data('saving-text'));
+ saveStatus.html('<img src="/static/geocamTiePoint/images/loading.gif">');
}).on('warp_success', function(){
saveStatus.text(saveStatus.data('saved-text'));
- }).on('warp_error', function(){
- saveStatus.text(saveStatus.data('save-error'));
+ }).on('warp_server_error', function(){
+ saveStatus.html($('<span class="error">').text(saveStatus.data('server-error')));
+ }).on('warp_server_unreachable', function(){
+ saveStatus.html($('<span class="error">').text(saveStatus.data('server-unreachable')));
});
$('button#export').click(function() {
Please sign in to comment.
Something went wrong with that request. Please try again.