diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-08-02 17:42:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-08-02 17:42:20 +0000 |
commit | 2d5ac54d2eb9f49b8a2f65b4469aa6d95a1e85d6 (patch) | |
tree | efc30fe2b599ba2cce8f368460b76c32fb197413 /app | |
parent | 7701de9ae4fd85ef7ddc0e3a26e2234793d7e902 (diff) | |
download | redmine-2d5ac54d2eb9f49b8a2f65b4469aa6d95a1e85d6.tar.gz redmine-2d5ac54d2eb9f49b8a2f65b4469aa6d95a1e85d6.zip |
Applied the flash notices patch by Matt Jones (slightly edited).
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
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/account_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/custom_fields_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/enumerations_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/issue_categories_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/issue_statuses_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/issues_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/my_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/repositories_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/roles_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/trackers_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/versions_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/wiki_controller.rb | 2 | ||||
-rw-r--r-- | app/views/layouts/base.rhtml | 7 |
15 files changed, 22 insertions, 21 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index ecf37ed53..842247158 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -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 diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index ddeff718e..7fddcbae7 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -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 diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 16e41977c..e77af49ab 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -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 diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb index 9a0f40277..29a3f02af 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/issue_categories_controller.rb @@ -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 diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index 70d352443..d0712e7c3 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -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 diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 990d95b0e..86c6bacf5 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 } diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index bc9a42a63..1c5a039ea 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 443b53a59..3a77bcc9e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 36580f43a..2557f45c8 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -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 diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 57398f323..6f1657675 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -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 diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index e83bd40d9..0fc91b527 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 908001b1a..3e107287b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index c46c01185..e1451f90a 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -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 diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index d75b85b64..748821d72 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -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 diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index bcc4026a0..fdfd3011e 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -138,8 +138,9 @@ </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;"> @@ -152,4 +153,4 @@ </div> </body> -</html>
\ No newline at end of file +</html> |