]> source.dussan.org Git - redmine.git/commitdiff
Applied the flash notices patch by Matt Jones (slightly edited).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 2 Aug 2007 17:42:20 +0000 (17:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 2 Aug 2007 17:42:20 +0000 (17:42 +0000)
flash[:notice] and flash[:error] are now used for notice/error messages.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@600 e93f8b46-1217-0410-a6f0-8f06a7374b81

16 files changed:
app/controllers/account_controller.rb
app/controllers/custom_fields_controller.rb
app/controllers/enumerations_controller.rb
app/controllers/issue_categories_controller.rb
app/controllers/issue_statuses_controller.rb
app/controllers/issues_controller.rb
app/controllers/my_controller.rb
app/controllers/projects_controller.rb
app/controllers/repositories_controller.rb
app/controllers/roles_controller.rb
app/controllers/trackers_controller.rb
app/controllers/users_controller.rb
app/controllers/versions_controller.rb
app/controllers/wiki_controller.rb
app/views/layouts/base.rhtml
public/stylesheets/application.css

index ecf37ed532e797757a4de128912344f183983699..842247158e25f566a0786a4485269135de317592 100644 (file)
@@ -54,7 +54,7 @@ class AccountController < ApplicationController
         end
         redirect_back_or_default :controller => 'my', :action => 'page'
       else
-        flash.now[:notice] = l(:notice_account_invalid_creditentials)
+        flash.now[:error] = l(:notice_account_invalid_creditentials)
       end
     end
   end
@@ -89,9 +89,9 @@ class AccountController < ApplicationController
       if request.post?
         user = User.find_by_mail(params[:mail])
         # user not found in db
-        flash.now[:notice] = l(:notice_account_unknown_email) and return unless user
+        flash.now[:error] = l(:notice_account_unknown_email) and return unless user
         # user uses an external authentification
-        flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id
+        flash.now[:error] = l(:notice_can_t_change_password) and return if user.auth_source_id
         # create a new token for password recovery
         token = Token.new(:user => user, :action => "recovery")
         if token.save
index ddeff718e83d089dbfc9a2f0e3478fad2821caae..7fddcbae7b4f39f726d37718cd6b5b5915fd802b 100644 (file)
@@ -66,7 +66,7 @@ class CustomFieldsController < ApplicationController
     @custom_field = CustomField.find(params[:id]).destroy
     redirect_to :action => 'list', :tab => @custom_field.type
   rescue
-    flash[:notice] = "Unable to delete custom field"
+    flash[:error] = "Unable to delete custom field"
     redirect_to :action => 'list'
   end
 end
index 16e41977c984d853efc9f1c7204a6055e07edd3d..e77af49abe5c845e80d43fc57fb4881cbfd6c66d 100644 (file)
@@ -64,7 +64,7 @@ class EnumerationsController < ApplicationController
     flash[:notice] = l(:notice_successful_delete)
     redirect_to :action => 'list'
   rescue
-    flash[:notice] = "Unable to delete enumeration"
+    flash[:error] = "Unable to delete enumeration"
     redirect_to :action => 'list'
   end
 end
index 9a0f402774c86eb0611f41a139cf408c033651c7..29a3f02afb4f46d2f7a4be7b44dcda490353f16a 100644 (file)
@@ -30,7 +30,7 @@ class IssueCategoriesController < ApplicationController
     @category.destroy
     redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
   rescue
-    flash[:notice] = "Categorie can't be deleted"
+    flash[:error] = "Categorie can't be deleted"
     redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
   end
 
index 70d352443e99d5a9947becc4c2268aefd569a0ae..d0712e7c3c807090281fb705270f549d8e1ce509 100644 (file)
@@ -79,7 +79,7 @@ class IssueStatusesController < ApplicationController
     IssueStatus.find(params[:id]).destroy
     redirect_to :action => 'list'
   rescue
-    flash[:notice] = "Unable to delete issue status"
+    flash[:error] = "Unable to delete issue status"
     redirect_to :action => 'list'
   end          
 end
index 990d95b0e116626e017b4969ea6b8b615f571e92..86c6bacf5dddbb681f57999cd3459e9185e1ae60 100644 (file)
@@ -69,7 +69,7 @@ class IssuesController < ApplicationController
         end
       rescue ActiveRecord::StaleObjectError
         # Optimistic locking exception
-        flash[:notice] = l(:notice_locking_conflict)
+        flash[:error] = l(:notice_locking_conflict)
       end
     end                
   end
@@ -118,7 +118,7 @@ class IssuesController < ApplicationController
         end
       rescue ActiveRecord::StaleObjectError
         # Optimistic locking exception
-        flash[:notice] = l(:notice_locking_conflict)
+        flash[:error] = l(:notice_locking_conflict)
       end
     end    
     @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }
index bc9a42a63c8c2095e33e67f262d5f6672b4de3d9..1c5a039eacae90d5cd143e0ac66f7e5a0c440a09 100644 (file)
@@ -62,7 +62,7 @@ class MyController < ApplicationController
   # Change user's password
   def change_password
     @user = self.logged_in_user
-    flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
+    flash[:error] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
     if @user.check_password?(params[:password])
       @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
       if @user.save
@@ -72,7 +72,7 @@ class MyController < ApplicationController
         return
       end
     else
-      flash[:notice] = l(:notice_account_wrong_password)
+      flash[:error] = l(:notice_account_wrong_password)
     end
     redirect_to :action => 'account'
   end
index 443b53a599468dd14dbaabde4b26b06519d37755..3a77bcc9ef55867fa99ca724bdd1796842163ce2 100644 (file)
@@ -227,7 +227,7 @@ class ProjectsController < ApplicationController
     
     default_status = IssueStatus.default
     unless default_status
-      flash.now[:notice] = 'No default issue status defined. Please check your configuration.'
+      flash.now[:error] = 'No default issue status defined. Please check your configuration.'
       render :nothing => true, :layout => true
       return
     end
index 36580f43ab15bca481cab6a727e6d8ef04ee8aa9..2557f45c8fb80447db24214afabedf673621ccb1 100644 (file)
@@ -128,7 +128,7 @@ private
   end
 
   def show_error
-    flash.now[:notice] = l(:notice_scm_error)
+    flash.now[:error] = l(:notice_scm_error)
     render :nothing => true, :layout => true
   end
   
index 57398f32399e42067acbec8491dd8a13ab2bc085..6f1657675b04c87dfb1a4ea1fb1314e522f1f698 100644 (file)
@@ -58,7 +58,7 @@ class RolesController < ApplicationController
   def destroy
     @role = Role.find(params[:id])
     unless @role.members.empty?
-      flash[:notice] = 'Some members have this role. Can\'t delete it.'
+      flash[:error] = 'Some members have this role. Can\'t delete it.'
     else
       @role.destroy
     end
index e83bd40d937abd8ed3548e197c00947320c21d60..0fc91b5274b7c8ad26d0c94196715984dbb51fe2 100644 (file)
@@ -73,7 +73,7 @@ class TrackersController < ApplicationController
   def destroy
     @tracker = Tracker.find(params[:id])
     unless @tracker.issues.empty?
-      flash[:notice] = "This tracker contains issues and can\'t be deleted."
+      flash[:error] = "This tracker contains issues and can\'t be deleted."
     else
       @tracker.destroy
     end
index 908001b1ad6f8766f1dc827681273273aa91f0d7..3e107287b93497345e400135b59c820e05ffae2d 100644 (file)
@@ -114,7 +114,7 @@ class UsersController < ApplicationController
     User.find(params[:id]).destroy
     redirect_to :action => 'list'
   rescue
-    flash[:notice] = "Unable to delete user"
+    flash[:error] = "Unable to delete user"
     redirect_to :action => 'list'
   end  
 end
index c46c011853d13d8a559a2e9fc2b3cfdb65eb65c9..e1451f90a11f000d46d0e005953836ebe0b233ee 100644 (file)
@@ -30,7 +30,7 @@ class VersionsController < ApplicationController
     @version.destroy
     redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
   rescue
-    flash[:notice] = "Unable to delete version"
+    flash[:error] = "Unable to delete version"
     redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
   end
 
index d75b85b6407e431d608be087f1c7a5830a8b34c1..748821d723c9f9f05063ab58b11730591ddb7d31 100644 (file)
@@ -73,7 +73,7 @@ class WikiController < ApplicationController
     end
   rescue ActiveRecord::StaleObjectError
     # Optimistic locking exception
-    flash[:notice] = l(:notice_locking_conflict)
+    flash[:error] = l(:notice_locking_conflict)
   end
   
   # show page history
index bcc4026a00e5b518752c62f8a6e2fc7ba20d2b83..fdfd3011e1d39f7f47b79e1dc6e7f4d401fa7c1a 100644 (file)
        </div>
        
        <div id="content">
-               <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %>               
-               <%= yield %>    
+               <%= content_tag('div', flash[:error], :id => 'flash', :class => 'error') if flash[:error] %>
+               <%= content_tag('div', flash[:notice], :id => 'flash', :class => 'notice') if flash[:notice] %>
+               <%= yield %>
        </div>
        
        <div id="ajax-indicator" style="display:none;">
 
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>
index 16206f0014a59d64eda9d1a79efee5611834347b..732d02753d7687f402c7aec4b60abba5ab351f53 100644 (file)
@@ -695,3 +695,25 @@ background-image: url(../images/loading.gif);
 padding-left: 26px;
 vertical-align: bottom;
 }
+
+/***** Flash messages ****/
+#flash {
+    padding: 4px 4px 4px 30px;
+    margin-bottom: 16px;
+       font-size: 1.2em;
+       border: 2px solid;
+}
+
+#flash.error {
+    background: url(../images/false.png) 8px 50% no-repeat;
+       background-color: #ffe3e3;
+       border-color: #dd0000;
+       color: #550000;
+}
+
+#flash.notice {
+    background: url(../images/true.png) 8px 50% no-repeat;
+       background-color: #dfffdf;
+       border-color: #9fcf9f;
+       color: #005f00;
+}