Project

General

Profile

Actions

Patch #2634

closed

Refactoring of error messages

Added by Brad Beattie about 15 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
UI
Target version:
-
Start date:
2009-01-31
Due date:
% Done:

50%

Estimated time:
0.20 h

Description

Seems that there were two methods of declaring errors: #errorExplanation or div.flash.error. Considering they were both used in the same way, I'm not sure why two are necessary. The following patch replaces all instances of the former with the latter.

### Eclipse Workspace Patch 1.0
#P Redmine
Index: test/functional/my_controller_test.rb
===================================================================
--- test/functional/my_controller_test.rb    (revision 2338)
+++ test/functional/my_controller_test.rb    (working copy)
@@ -88,7 +88,7 @@
                     :new_password_confirmation => 'hello2'
     assert_response :success
     assert_template 'password'
-    assert_tag :tag => "div", :attributes => { :class => "errorExplanation" }
+    assert_tag :tag => "div", :attributes => { :class => "flash error" }

     # wrong password
     post :password, :password => 'wrongpassword', 
Index: public/stylesheets/application.css
===================================================================
--- public/stylesheets/application.css    (revision 2344)
+++ public/stylesheets/application.css    (working copy)
@@ -313,7 +313,7 @@
 a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; }

 /***** Flash & error messages ****/
-#errorExplanation, div.flash, .nodata, .warning {
+div.flash, .nodata, .warning {
     padding: 4px 4px 4px 30px;
     margin-bottom: 12px;
     font-size: 1.1em;
@@ -322,7 +322,7 @@

 div.flash {margin-top: 8px;}

-div.flash.error, #errorExplanation {
+div.flash.error {
     background: url(../images/false.png) 8px 5px no-repeat;
     background-color: #ffe3e3;
     border-color: #dd0000;
@@ -351,7 +351,7 @@
     color: #A6750C;
 }

-#errorExplanation ul { font-size: 0.9em;}
+div.flash.error ul { font-size: 0.9em;}

 /***** Ajax indicator ******/
 #ajax-indicator {
Index: app/helpers/application_helper.rb
===================================================================
--- app/helpers/application_helper.rb    (revision 2344)
+++ app/helpers/application_helper.rb    (working copy)
@@ -576,7 +576,7 @@
           options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":" 
         ) +
         content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
-        "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" 
+        "id" => options[:id], "class" => options[:class] || "flash error" 
       )
     else
       "" 
Index: test/functional/news_controller_test.rb
===================================================================
--- test/functional/news_controller_test.rb    (revision 2338)
+++ test/functional/news_controller_test.rb    (working copy)
@@ -160,7 +160,7 @@
     assert_template 'new'
     assert_not_nil assigns(:news)
     assert assigns(:news).new_record?
-    assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' },
+    assert_tag :tag => 'div', :attributes => { :class => 'flash error' },
                               :content => /1 error/
   end

Index: vendor/plugins/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb
===================================================================
--- vendor/plugins/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb    (revision 2338)
+++ vendor/plugins/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb    (working copy)
@@ -26,7 +26,7 @@
       display: table;
     }

-    #errorExplanation {
+    div.flash.error {
       width: 400px;
       border: 2px solid red;
       padding: 7px;
@@ -35,7 +35,7 @@
       background-color: #f0f0f0;
     }

-    #errorExplanation h2 {
+    div.flash.error h2 {
       text-align: left;
       font-weight: bold;
       padding: 5px 5px 5px 15px;
@@ -45,13 +45,13 @@
       color: #fff;
     }

-    #errorExplanation p {
+    div.flash.error p {
       color: #333;
       margin-bottom: 0;
       padding: 5px;
     }

-    #errorExplanation ul li {
+    div.flash.error ul li {
       font-size: 12px;
       list-style: square;
     }
Index: test/functional/roles_controller_test.rb
===================================================================
--- test/functional/roles_controller_test.rb    (revision 2338)
+++ test/functional/roles_controller_test.rb    (working copy)
@@ -57,7 +57,7 @@

     assert_response :success
     assert_template 'new'
-    assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' }
+    assert_tag :tag => 'div', :attributes => { :class => 'flash error' }
   end

   def test_post_new_without_workflow_copy
Actions #1

Updated by Brad Beattie about 15 years ago

  • Assignee set to Eric Davis
Actions #2

Updated by Eric Davis about 15 years ago

  • Assignee deleted (Eric Davis)

Please don't assign issue to people without them saying to.

Actions #3

Updated by Jean-Baptiste Barth almost 11 years ago

  • Status changed from New to Closed

#errorExplanation is common id for error messages in a form, .flash.error is for any kind of error.

Since both can be used in plugins, we can't change them easily now. I close the issue.

Actions

Also available in: Atom PDF