##// 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 end
54 end
55 redirect_back_or_default :controller => 'my', :action => 'page'
55 redirect_back_or_default :controller => 'my', :action => 'page'
56 else
56 else
57 flash.now[:notice] = l(:notice_account_invalid_creditentials)
57 flash.now[:error] = l(:notice_account_invalid_creditentials)
58 end
58 end
59 end
59 end
60 end
60 end
@@ -89,9 +89,9 class AccountController < ApplicationController
89 if request.post?
89 if request.post?
90 user = User.find_by_mail(params[:mail])
90 user = User.find_by_mail(params[:mail])
91 # user not found in db
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 # user uses an external authentification
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 # create a new token for password recovery
95 # create a new token for password recovery
96 token = Token.new(:user => user, :action => "recovery")
96 token = Token.new(:user => user, :action => "recovery")
97 if token.save
97 if token.save
@@ -66,7 +66,7 class CustomFieldsController < ApplicationController
66 @custom_field = CustomField.find(params[:id]).destroy
66 @custom_field = CustomField.find(params[:id]).destroy
67 redirect_to :action => 'list', :tab => @custom_field.type
67 redirect_to :action => 'list', :tab => @custom_field.type
68 rescue
68 rescue
69 flash[:notice] = "Unable to delete custom field"
69 flash[:error] = "Unable to delete custom field"
70 redirect_to :action => 'list'
70 redirect_to :action => 'list'
71 end
71 end
72 end
72 end
@@ -64,7 +64,7 class EnumerationsController < ApplicationController
64 flash[:notice] = l(:notice_successful_delete)
64 flash[:notice] = l(:notice_successful_delete)
65 redirect_to :action => 'list'
65 redirect_to :action => 'list'
66 rescue
66 rescue
67 flash[:notice] = "Unable to delete enumeration"
67 flash[:error] = "Unable to delete enumeration"
68 redirect_to :action => 'list'
68 redirect_to :action => 'list'
69 end
69 end
70 end
70 end
@@ -30,7 +30,7 class IssueCategoriesController < ApplicationController
30 @category.destroy
30 @category.destroy
31 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
31 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
32 rescue
32 rescue
33 flash[:notice] = "Categorie can't be deleted"
33 flash[:error] = "Categorie can't be deleted"
34 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
34 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project
35 end
35 end
36
36
@@ -79,7 +79,7 class IssueStatusesController < ApplicationController
79 IssueStatus.find(params[:id]).destroy
79 IssueStatus.find(params[:id]).destroy
80 redirect_to :action => 'list'
80 redirect_to :action => 'list'
81 rescue
81 rescue
82 flash[:notice] = "Unable to delete issue status"
82 flash[:error] = "Unable to delete issue status"
83 redirect_to :action => 'list'
83 redirect_to :action => 'list'
84 end
84 end
85 end
85 end
@@ -69,7 +69,7 class IssuesController < ApplicationController
69 end
69 end
70 rescue ActiveRecord::StaleObjectError
70 rescue ActiveRecord::StaleObjectError
71 # Optimistic locking exception
71 # Optimistic locking exception
72 flash[:notice] = l(:notice_locking_conflict)
72 flash[:error] = l(:notice_locking_conflict)
73 end
73 end
74 end
74 end
75 end
75 end
@@ -118,7 +118,7 class IssuesController < ApplicationController
118 end
118 end
119 rescue ActiveRecord::StaleObjectError
119 rescue ActiveRecord::StaleObjectError
120 # Optimistic locking exception
120 # Optimistic locking exception
121 flash[:notice] = l(:notice_locking_conflict)
121 flash[:error] = l(:notice_locking_conflict)
122 end
122 end
123 end
123 end
124 @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }
124 @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }
@@ -62,7 +62,7 class MyController < ApplicationController
62 # Change user's password
62 # Change user's password
63 def change_password
63 def change_password
64 @user = self.logged_in_user
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 if @user.check_password?(params[:password])
66 if @user.check_password?(params[:password])
67 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
67 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
68 if @user.save
68 if @user.save
@@ -72,7 +72,7 class MyController < ApplicationController
72 return
72 return
73 end
73 end
74 else
74 else
75 flash[:notice] = l(:notice_account_wrong_password)
75 flash[:error] = l(:notice_account_wrong_password)
76 end
76 end
77 redirect_to :action => 'account'
77 redirect_to :action => 'account'
78 end
78 end
@@ -227,7 +227,7 class ProjectsController < ApplicationController
227
227
228 default_status = IssueStatus.default
228 default_status = IssueStatus.default
229 unless default_status
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 render :nothing => true, :layout => true
231 render :nothing => true, :layout => true
232 return
232 return
233 end
233 end
@@ -128,7 +128,7 private
128 end
128 end
129
129
130 def show_error
130 def show_error
131 flash.now[:notice] = l(:notice_scm_error)
131 flash.now[:error] = l(:notice_scm_error)
132 render :nothing => true, :layout => true
132 render :nothing => true, :layout => true
133 end
133 end
134
134
@@ -58,7 +58,7 class RolesController < ApplicationController
58 def destroy
58 def destroy
59 @role = Role.find(params[:id])
59 @role = Role.find(params[:id])
60 unless @role.members.empty?
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 else
62 else
63 @role.destroy
63 @role.destroy
64 end
64 end
@@ -73,7 +73,7 class TrackersController < ApplicationController
73 def destroy
73 def destroy
74 @tracker = Tracker.find(params[:id])
74 @tracker = Tracker.find(params[:id])
75 unless @tracker.issues.empty?
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 else
77 else
78 @tracker.destroy
78 @tracker.destroy
79 end
79 end
@@ -114,7 +114,7 class UsersController < ApplicationController
114 User.find(params[:id]).destroy
114 User.find(params[:id]).destroy
115 redirect_to :action => 'list'
115 redirect_to :action => 'list'
116 rescue
116 rescue
117 flash[:notice] = "Unable to delete user"
117 flash[:error] = "Unable to delete user"
118 redirect_to :action => 'list'
118 redirect_to :action => 'list'
119 end
119 end
120 end
120 end
@@ -30,7 +30,7 class VersionsController < ApplicationController
30 @version.destroy
30 @version.destroy
31 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
31 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
32 rescue
32 rescue
33 flash[:notice] = "Unable to delete version"
33 flash[:error] = "Unable to delete version"
34 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
34 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
35 end
35 end
36
36
@@ -73,7 +73,7 class WikiController < ApplicationController
73 end
73 end
74 rescue ActiveRecord::StaleObjectError
74 rescue ActiveRecord::StaleObjectError
75 # Optimistic locking exception
75 # Optimistic locking exception
76 flash[:notice] = l(:notice_locking_conflict)
76 flash[:error] = l(:notice_locking_conflict)
77 end
77 end
78
78
79 # show page history
79 # show page history
@@ -138,8 +138,9
138 </div>
138 </div>
139
139
140 <div id="content">
140 <div id="content">
141 <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %>
141 <%= content_tag('div', flash[:error], :id => 'flash', :class => 'error') if flash[:error] %>
142 <%= yield %>
142 <%= content_tag('div', flash[:notice], :id => 'flash', :class => 'notice') if flash[:notice] %>
143 <%= yield %>
143 </div>
144 </div>
144
145
145 <div id="ajax-indicator" style="display:none;">
146 <div id="ajax-indicator" style="display:none;">
@@ -152,4 +153,4
152
153
153 </div>
154 </div>
154 </body>
155 </body>
155 </html> No newline at end of file
156 </html>
@@ -695,3 +695,25 background-image: url(../images/loading.gif);
695 padding-left: 26px;
695 padding-left: 26px;
696 vertical-align: bottom;
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