Skip to content
Snippets Groups Projects
Commit 36b79bc2 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Simplifying the error message handling, checking to make sure error messages...

Simplifying the error message handling, checking to make sure error messages are printed to the correct DOM elements.
parent cea460da
No related branches found
No related tags found
No related merge requests found
......@@ -89,12 +89,17 @@
renderDialog: function(body, body_vars) {
this.renderTemplates("#formWrap", body, body_vars);
$("#wait").stop().fadeOut(250);
$("#wait").stop().fadeOut(ANIMATION_TIME);
},
renderWait: function(body, body_vars) {
this.renderTemplates("#wait", body, body_vars);
$("#wait").stop().css('opacity', 1).hide().fadeIn(250);
$("#wait").stop().css('opacity', 1).hide().fadeIn(ANIMATION_TIME);
},
renderError: function(error_vars) {
this.renderTemplates("#error", "wait.ejs", error_vars);
$("#error").stop().css('opacity', 1).hide().fadeIn(ANIMATION_TIME);
},
onSubmit: function(event) {
......@@ -135,14 +140,7 @@
* two fields, message, description.
*/
errorDialog: function(info) {
$("form").hide();
$("#error_dialog .title").text(info.message);
$("#error_dialog .content").text(info.description);
$("body").removeClass("authenticated").addClass("error");
$("#error_dialog").fadeIn(ANIMATION_TIME);
this.renderError({title: info.message, message: info.description});
},
/**
......
......@@ -13,13 +13,19 @@
<h2 id="qunit-userAgent"></h2>
<div id="test-content">
<div id="page_controller">
<div id="formWrap">
<div class="contents"></div>
<div class="contents"></div>
</div>
<div id="wait">
<div class="contents"></div>
<div class="contents"></div>
</div>
<div id="error">
<div class="contents"></div>
</div>
</div>
</div>
<ol id="qunit-tests"></ol>
......
......@@ -49,6 +49,7 @@ steal.plugins("jquery").then("/dialog/controllers/page_controller", function() {
teardown: function() {
el.find("#formWrap .contents").html("");
el.find("#wait .contents").html("");
el.find("#error .contents").html("");
controller.destroy();
}
});
......@@ -99,5 +100,23 @@ steal.plugins("jquery").then("/dialog/controllers/page_controller", function() {
ok(html.length, "with wait template specified, wait text is loaded");
});
test("renderError does what it is meant to", function() {
controller = el.page({
waitTemplate: waitTemplate,
waitVars: {
title: "Test title",
message: "Test message"
}
}).controller();
el.page("renderError", {
title: "error title",
message: "error message"
});
var html = el.find("#error .contents").html();
ok(html.length, "with error template specified, error text is loaded");
});
});
......@@ -56,8 +56,6 @@
<section id="error">
<div class="table">
<div class="vertical contents">
<h2 class="title"></h2>
<p class="content"></p>
</div>
</div>
</section>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment