Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit 5438de0

Browse files
committed
Global ajax error handler
1 parent b4528e8 commit 5438de0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

assets/javascripts/steno.js

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
self.syncScrolling = true;
1616

1717
self.init = function() {
18+
$(document).ajaxError(self.ajaxError);
19+
$('#error-box .close').on('click', function() { $('#error-box').hide(); });
20+
1821
$('#parse-btn').on('click', self.parseSource);
1922
$('#render-btn').on('click', self.checkAndRenderXml);
2023
$('#export-btn').on('click', self.exportToGitHub);
@@ -62,6 +65,11 @@
6265
self.checkAuth();
6366
};
6467

68+
self.ajaxError = function(event, jqxhr, settings, exception) {
69+
$('#error-box .text').text(jqxhr.status == 500 ? 'Whoops, something went wrong.' : exception);
70+
$('#error-box').show();
71+
};
72+
6573
/**
6674
* Create a new editor, using the controls inside
6775
* +container+.

assets/stylesheets/app.scss

+9
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,12 @@ header {
9595
.render-label {
9696
display: none;
9797
}
98+
99+
#error-box {
100+
position: fixed;
101+
top: 10px;
102+
width: 30%;
103+
left: 35%;
104+
z-index: 1000;
105+
display: none;
106+
}

views/index.haml

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#error-box.alert.alert-danger
2+
%button.close(type="button") ×
3+
%div.text
4+
15
%ul.steps.nav.nav-pills
26
%li.active
37
%a(href="#metadata-step" data-toggle="tab") 1. By-law Info

0 commit comments

Comments
 (0)