Skip to content

Commit

Permalink
add modal for when requests fail
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebaker committed Sep 30, 2013
1 parent 5da6409 commit 72f0297
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/views/earls/_vote_box_js.html.erb
Expand Up @@ -83,7 +83,9 @@
box.find('.idea-success').hide(300); box.find('.idea-success').hide(300);
}, 5 * 1000); }, 5 * 1000);


}, "json"); }, "json").fail(function() {
$('#request_error').modal('show');
});
}); });




Expand Down Expand Up @@ -165,13 +167,7 @@
error: function(request,error) { error: function(request,error) {
winningLink.addClass('btn-primary').removeClass('btn-success').removeClass('disabled'); winningLink.addClass('btn-primary').removeClass('btn-success').removeClass('disabled');
losingLink.addClass('btn-primary').removeClass('disabled'); losingLink.addClass('btn-primary').removeClass('disabled');
if (error == "timeout") { $('#request_error').modal('show');
$('.tellmearea').html('<%= t('vote.vote_timeout_error')%>').effect("highlight", {color: '#ff0000'}, 1500);
}
else {
$('.tellmearea').html("<%= t('vote.vote_other_error') %>").effect("highlight", {color: '#ff0000'}, 1500);
}

loadedTime = new Date(); //reset loaded time loadedTime = new Date(); //reset loaded time
}, },
success: function(data){ success: function(data){
Expand Down Expand Up @@ -225,7 +221,9 @@
$('#appearance_lookup').val(data["appearance_lookup"]); $('#appearance_lookup').val(data["appearance_lookup"]);
//clear the radio buttons somehow? //clear the radio buttons somehow?
loadedTime = new Date() //reset loaded time loadedTime = new Date() //reset loaded time
},"json"); },"json").fail(function() {
$('#request_error').modal('show');
});;
}); });




Expand Down Expand Up @@ -285,5 +283,7 @@
$('#item_count').html(decrement(current_item_count)); $('#item_count').html(decrement(current_item_count));
loadedTime = new Date() //reset loaded time loadedTime = new Date() //reset loaded time
} }
}, "json"); }, "json").fail(function() {
$('#request_error').modal('show');
});
}); });
12 changes: 12 additions & 0 deletions app/views/earls/show.html.haml
Expand Up @@ -50,6 +50,18 @@
= render :partial => 'items/form' = render :partial => 'items/form'
.tellmearea .tellmearea


#request_error.hide.modal.fade
.modal-header
%button.close{:"data-dismiss" => 'modal'} x
%h2 Error Processing Your Request
.modal-body
%p
There was a problem processing your request. Sometimes this happens when your browser cookies are deleted. When you close this message, the page will reload, and you can try again.
-content_for :view_javascript do
:plain
$('#request_error').on('hide', function() {
window.location.reload(false);
});
#cant_decide_options.hide.modal.fade #cant_decide_options.hide.modal.fade
.modal-header .modal-header
%button.close{:"data-dismiss" => 'modal'} x %button.close{:"data-dismiss" => 'modal'} x
Expand Down

0 comments on commit 72f0297

Please sign in to comment.