Permalink
Browse files

fixes #40

  • Loading branch information...
1 parent ae536ef commit c923aa2a77292039ee27f1060d675a6faca132f2 @kawasima committed Jul 8, 2012
@@ -1,4 +1,4 @@
-<%= error_messages_for 'test_case' %>
+<div id="errorExplanation" style="display:none"></div>
<div class="box">
<p><label><span class="required">*</span><%=l :field_name %></label><%= text_field_tag 'node[name]', @node.name, :size => 50, :required=>true %></p>
<p><%= form.text_area :summary,
@@ -1,4 +1,4 @@
-<%= error_messages_for 'test_case' %>
+<div id="errorExplanation" style="display:none"></div>
<div class="box">
<p><label><span class="required">*</span><%=l :field_name %></label><%= text_field_tag 'node[name]', @node.name, :size => 50, :required=>true %></p>
<p><%= form.text_area :details, :rows => 10,
@@ -171,7 +171,15 @@ jQuery(document).ready(function ($) {
data: tc,
success: function(r, status, xhr) {
if (r.errors) {
- console.error(r.errors);
+ var ul = $("<ul/>");
+ $.each(r.errors, function(i, error) {
+ ul.append($("<li/>").html(error));
+ });
+ $("#errorExplanation", dialog[node_type])
+ .html(ul)
+ .show();
+ var top = $("#errorExplanation", dialog[node_type]).position().top;
+ $(window).scrollTop(top);
return;
}
$.each(r, function(i, n) {

0 comments on commit c923aa2

Please sign in to comment.