Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
@@ -147,11 +147,15 @@ $(function($) {
147 147 var model = this;
148 148 model.trigger('before_warp');
149 149 saveOptions = {
150   - error: function(){
  150 + error: function(model, response){
  151 + if ( response.readyState < 4 ) {
  152 + model.trigger('warp_server_unreachable');
  153 + } else {
  154 + model.trigger('warp_server_error');
  155 + }
151 156 if (options.error) options.error();
152   - model.trigger('warp_error');
153 157 },
154   - success: function() {
  158 + success: function(model, response) {
155 159 if (options.success) options.success();
156 160 model.trigger('warp_success');
157 161 },
21 geocamTiePoint/static/geocamTiePoint/js/backbone/views.js
@@ -499,7 +499,7 @@ $(function($) {
499 499 '<div id="save-export" class="btn-group">'+
500 500 '<button class="btn" id="export">Share</button>'+
501 501 '<button class="btn" id="save">Save</button>'+
502   - '<span id="saveStatus" data-saving-text="Saving..." data-saved-text="Saved." data-save-error="SAVE ERROR!"></span>'+
  502 + '<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>'+
503 503 '</div>'+
504 504 '</div>' +
505 505 '<div id="split_container">' +
@@ -695,28 +695,23 @@ $(function($) {
695 695 $('button#save').click( function() {
696 696 var button = $(this);
697 697 button.data('original-text', button.text());
698   - button.disabled = true;
699 698 overlay.warp({
700 699 success: function(model, response) {
701   - button.disabled = false;
702   - button.text(button.data('original-text'));
703 700 $('input#show_preview').attr('checked', true).change();
704   - },
705   - error: function(model, response) {
706   - button.disabled = false;
707   - button.text("FAILED");
708   - _.delay(function(){button.text("save");}, 1000);
709   - },
  701 + }
710 702 });
711 703 });
712 704
713 705 var saveStatus = $('#saveStatus');
714 706 this.model.on('before_warp', function(){
715   - saveStatus.text(saveStatus.data('saving-text'));
  707 + //saveStatus.text(saveStatus.data('saving-text'));
  708 + saveStatus.html('<img src="/static/geocamTiePoint/images/loading.gif">');
716 709 }).on('warp_success', function(){
717 710 saveStatus.text(saveStatus.data('saved-text'));
718   - }).on('warp_error', function(){
719   - saveStatus.text(saveStatus.data('save-error'));
  711 + }).on('warp_server_error', function(){
  712 + saveStatus.html($('<span class="error">').text(saveStatus.data('server-error')));
  713 + }).on('warp_server_unreachable', function(){
  714 + saveStatus.html($('<span class="error">').text(saveStatus.data('server-unreachable')));
720 715 });
721 716
722 717 $('button#export').click(function() {

0 comments on commit feb28e6

Please sign in to comment.
Something went wrong with that request. Please try again.