##// END OF EJS Templates
Applied the flash notices patch by Matt Jones (slightly edited)....
Jean-Philippe Lang -
r597:2d5ac54d2eb9
parent child
Show More
@@ -54,7 +54,7 class AccountController < ApplicationController
54 54 end
55 55 redirect_back_or_default :controller => 'my', :action => 'page'
56 56 else
57 flash.now[:notice] = l(:notice_account_invalid_creditentials)
57 flash.now[:error] = l(:notice_account_invalid_creditentials)
58 58 end
59 59 end
60 60 end
@@ -89,9 +89,9 class AccountController < ApplicationController
89 89 if request.post?
90 90 user = User.find_by_mail(params[:mail])
91 91 # user not found in db
92 flash.now[:notice] = l(:notice_account_unknown_email) and return unless user
92 flash.now[:error] = l(:notice_account_unknown_email) and return unless user
93 93 # user uses an external authentification
94 flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id
94 flash.now[:error] = l(:notice_can_t_change_password) and return if user.auth_source_id
95 95 # create a new token for password recovery
96 96 token = Token.new(:user => user, :action => "recovery")
97 97 if token.save
@@ -66,7 +66,7 class CustomFieldsController < ApplicationController
66 66 @custom_field = CustomField.find(params[:id]).destroy
67 67 redirect_to :action => 'list', :tab => @custom_field.type
68 68 rescue
69 flash[:notice] = "Unable to delete custom field"
69 flash[:error] = "Unable to delete custom field"
70 70 redirect_to :action => 'list'
71 71 end
72 72 end
@@ -64,7 +64,7 class EnumerationsController < ApplicationController
64 64 flash[:notice] = l(:notice_successful_delete)
65 65 redirect_to :action => 'list'
66 66 rescue
67 flash[:notice] = "Unable to delete enumeration"
67 flash[:error] = "Unable to delete enumeration"
68 68 redirect_to :action => 'list'
69 69 end
70 70 end
@@ -30,7 +30,7 class IssueCategoriesController < ApplicationController
30 30 @category.destroy
31 31 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
32 32 rescue
33 flash[:notice] = "Categorie can't be deleted"
33 flash[:error] = "Categorie can't be deleted"
34 34 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
35 35 end
36 36
@@ -79,7 +79,7 class IssueStatusesController < ApplicationController
79 79 IssueStatus.find(params[:id]).destroy
80 80 redirect_to :action => 'list'
81 81 rescue
82 flash[:notice] = "Unable to delete issue status"
82 flash[:error] = "Unable to delete issue status"
83 83 redirect_to :action => 'list'
84 84 end
85 85 end
@@ -69,7 +69,7 class IssuesController < ApplicationController
69 69 end
70 70 rescue ActiveRecord::StaleObjectError
71 71 # Optimistic locking exception
72 flash[:notice] = l(:notice_locking_conflict)
72 flash[:error] = l(:notice_locking_conflict)
73 73 end
74 74 end
75 75 end
@@ -118,7 +118,7 class IssuesController < ApplicationController
118 118 end
119 119 rescue ActiveRecord::StaleObjectError
120 120 # Optimistic locking exception
121 flash[:notice] = l(:notice_locking_conflict)
121 flash[:error] = l(:notice_locking_conflict)
122 122 end
123 123 end
124 124 @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }
@@ -62,7 +62,7 class MyController < ApplicationController
62 62 # Change user's password
63 63 def change_password
64 64 @user = self.logged_in_user
65 flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
65 flash[:error] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
66 66 if @user.check_password?(params[:password])
67 67 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
68 68 if @user.save
@@ -72,7 +72,7 class MyController < ApplicationController
72 72 return
73 73 end
74 74 else
75 flash[:notice] = l(:notice_account_wrong_password)
75 flash[:error] = l(:notice_account_wrong_password)
76 76 end
77 77 redirect_to :action => 'account'
78 78 end
@@ -227,7 +227,7 class ProjectsController < ApplicationController
227 227
228 228 default_status = IssueStatus.default
229 229 unless default_status
230 flash.now[:notice] = 'No default issue status defined. Please check your configuration.'
230 flash.now[:error] = 'No default issue status defined. Please check your configuration.'
231 231 render :nothing => true, :layout => true
232 232 return
233 233 end
@@ -128,7 +128,7 private
128 128 end
129 129
130 130 def show_error
131 flash.now[:notice] = l(:notice_scm_error)
131 flash.now[:error] = l(:notice_scm_error)
132 132 render :nothing => true, :layout => true
133 133 end
134 134
@@ -58,7 +58,7 class RolesController < ApplicationController
58 58 def destroy
59 59 @role = Role.find(params[:id])
60 60 unless @role.members.empty?
61 flash[:notice] = 'Some members have this role. Can\'t delete it.'
61 flash[:error] = 'Some members have this role. Can\'t delete it.'
62 62 else
63 63 @role.destroy
64 64 end
@@ -73,7 +73,7 class TrackersController < ApplicationController
73 73 def destroy
74 74 @tracker = Tracker.find(params[:id])
75 75 unless @tracker.issues.empty?
76 flash[:notice] = "This tracker contains issues and can\'t be deleted."
76 flash[:error] = "This tracker contains issues and can\'t be deleted."
77 77 else
78 78 @tracker.destroy
79 79 end
@@ -114,7 +114,7 class UsersController < ApplicationController
114 114 User.find(params[:id]).destroy
115 115 redirect_to :action => 'list'
116 116 rescue
117 flash[:notice] = "Unable to delete user"
117 flash[:error] = "Unable to delete user"
118 118 redirect_to :action => 'list'
119 119 end
120 120 end
@@ -30,7 +30,7 class VersionsController < ApplicationController
30 30 @version.destroy
31 31 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
32 32 rescue
33 flash[:notice] = "Unable to delete version"
33 flash[:error] = "Unable to delete version"
34 34 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
35 35 end
36 36
@@ -73,7 +73,7 class WikiController < ApplicationController
73 73 end
74 74 rescue ActiveRecord::StaleObjectError
75 75 # Optimistic locking exception
76 flash[:notice] = l(:notice_locking_conflict)
76 flash[:error] = l(:notice_locking_conflict)
77 77 end
78 78
79 79 # show page history
@@ -138,8 +138,9
138 138 </div>
139 139
140 140 <div id="content">
141 <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %>
142 <%= yield %>
141 <%= content_tag('div', flash[:error], :id => 'flash', :class => 'error') if flash[:error] %>
142 <%= content_tag('div', flash[:notice], :id => 'flash', :class => 'notice') if flash[:notice] %>
143 <%= yield %>
143 144 </div>
144 145
145 146 <div id="ajax-indicator" style="display:none;">
@@ -152,4 +153,4
152 153
153 154 </div>
154 155 </body>
155 </html> No newline at end of file
156 </html>
@@ -695,3 +695,25 background-image: url(../images/loading.gif);
695 695 padding-left: 26px;
696 696 vertical-align: bottom;
697 697 }
698
699 /***** Flash messages ****/
700 #flash {
701 padding: 4px 4px 4px 30px;
702 margin-bottom: 16px;
703 font-size: 1.2em;
704 border: 2px solid;
705 }
706
707 #flash.error {
708 background: url(../images/false.png) 8px 50% no-repeat;
709 background-color: #ffe3e3;
710 border-color: #dd0000;
711 color: #550000;
712 }
713
714 #flash.notice {
715 background: url(../images/true.png) 8px 50% no-repeat;
716 background-color: #dfffdf;
717 border-color: #9fcf9f;
718 color: #005f00;
719 }
General Comments 0
You need to be logged in to leave comments. Login now