diff --git a/redmine/app/controllers/account_controller.rb b/redmine/app/controllers/account_controller.rb index bc65622..22ac860 100644 --- a/redmine/app/controllers/account_controller.rb +++ b/redmine/app/controllers/account_controller.rb @@ -72,14 +72,19 @@ class AccountController < ApplicationController # Change logged in user's password def change_password @user = self.logged_in_user - flash.now[:notice] = l(:notice_can_t_change_password) and render :action => 'my_account' and return if @user.auth_source_id + flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'my_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] - flash.now[:notice] = l(:notice_account_password_updated) if @user.save + if @user.save + flash[:notice] = l(:notice_account_password_updated) + else + render :action => 'my_account' + return + end else - flash.now[:notice] = l(:notice_account_wrong_password) + flash[:notice] = l(:notice_account_wrong_password) end - render :action => 'my_account' + redirect_to :action => 'my_account' end # Enable user to choose a new password diff --git a/redmine/app/controllers/admin_controller.rb b/redmine/app/controllers/admin_controller.rb index 68d0813..4b144e8 100644 --- a/redmine/app/controllers/admin_controller.rb +++ b/redmine/app/controllers/admin_controller.rb @@ -44,7 +44,7 @@ class AdminController < ApplicationController a.mail_enabled = (params[:action_ids] || []).include? a.id.to_s a.save } - flash[:notice] = "Mail options were successfully updated." + flash.now[:notice] = l(:notice_successful_update) end end diff --git a/redmine/app/controllers/application.rb b/redmine/app/controllers/application.rb index 8acbb09..3061359 100644 --- a/redmine/app/controllers/application.rb +++ b/redmine/app/controllers/application.rb @@ -55,7 +55,7 @@ class ApplicationController < ActionController::Base def require_login unless self.logged_in_user store_location - redirect_to(:controller => "account", :action => "login") + redirect_to :controller => "account", :action => "login" return false end true @@ -64,8 +64,7 @@ class ApplicationController < ActionController::Base def require_admin return unless require_login unless self.logged_in_user.admin? - flash[:notice] = "Acces denied" - redirect_to:controller => '' + render :nothing => true, :status => 403 return false end true @@ -86,8 +85,7 @@ class ApplicationController < ActionController::Base if @user_membership and Permission.allowed_to_role( "%s/%s" % [ @params[:controller], @params[:action] ], @user_membership.role_id ) return true end - flash[:notice] = "Acces denied" - redirect_to :controller => '' + render :nothing => true, :status => 403 false end diff --git a/redmine/app/controllers/custom_fields_controller.rb b/redmine/app/controllers/custom_fields_controller.rb index 5743074..d0ffddf 100644 --- a/redmine/app/controllers/custom_fields_controller.rb +++ b/redmine/app/controllers/custom_fields_controller.rb @@ -42,6 +42,7 @@ class CustomFieldsController < ApplicationController return end if request.post? and @custom_field.save + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end @trackers = Tracker.find(:all) @@ -53,7 +54,7 @@ class CustomFieldsController < ApplicationController if @custom_field.is_a? IssueCustomField @custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : [] end - flash[:notice] = 'Custom field was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'list' end @trackers = Tracker.find(:all) diff --git a/redmine/app/controllers/documents_controller.rb b/redmine/app/controllers/documents_controller.rb index cc30f8e..e8c8e2d 100644 --- a/redmine/app/controllers/documents_controller.rb +++ b/redmine/app/controllers/documents_controller.rb @@ -25,7 +25,7 @@ class DocumentsController < ApplicationController def edit @categories = Enumeration::get_values('DCAT') if request.post? and @document.update_attributes(params[:document]) - flash[:notice] = 'Document was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'show', :id => @document end end diff --git a/redmine/app/controllers/issue_categories_controller.rb b/redmine/app/controllers/issue_categories_controller.rb index cf0f9dc..965a15e 100644 --- a/redmine/app/controllers/issue_categories_controller.rb +++ b/redmine/app/controllers/issue_categories_controller.rb @@ -21,7 +21,7 @@ class IssueCategoriesController < ApplicationController def edit if request.post? and @category.update_attributes(params[:category]) - flash[:notice] = 'Issue category was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :controller => 'projects', :action => 'settings', :id => @project end end diff --git a/redmine/app/controllers/issue_statuses_controller.rb b/redmine/app/controllers/issue_statuses_controller.rb index 3de8158..be577ef 100644 --- a/redmine/app/controllers/issue_statuses_controller.rb +++ b/redmine/app/controllers/issue_statuses_controller.rb @@ -35,7 +35,7 @@ class IssueStatusesController < ApplicationController def create @issue_status = IssueStatus.new(params[:issue_status]) if @issue_status.save - flash[:notice] = 'IssueStatus was successfully created.' + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' else render :action => 'new' @@ -49,7 +49,7 @@ class IssueStatusesController < ApplicationController def update @issue_status = IssueStatus.find(params[:id]) if @issue_status.update_attributes(params[:issue_status]) - flash[:notice] = 'IssueStatus was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'list' else render :action => 'edit' diff --git a/redmine/app/controllers/issues_controller.rb b/redmine/app/controllers/issues_controller.rb index fa97e7c..07f2c77 100644 --- a/redmine/app/controllers/issues_controller.rb +++ b/redmine/app/controllers/issues_controller.rb @@ -38,7 +38,7 @@ class IssuesController < ApplicationController @issue.custom_values = @custom_values @issue.attributes = params[:issue] if @issue.save - flash[:notice] = 'Issue was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'show', :id => @issue end end @@ -56,7 +56,7 @@ class IssuesController < ApplicationController @issue.fixed_version_id = (params[:issue][:fixed_version_id]) @issue.assigned_to_id = (params[:issue][:assigned_to_id]) if @issue.save - flash[:notice] = 'Issue was successfully updated.' + flash[:notice] = l(:notice_successful_update) Mailer.deliver_issue_change_status(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled? redirect_to :action => 'show', :id => @issue end diff --git a/redmine/app/controllers/members_controller.rb b/redmine/app/controllers/members_controller.rb index ac6b08d..be3f717 100644 --- a/redmine/app/controllers/members_controller.rb +++ b/redmine/app/controllers/members_controller.rb @@ -21,14 +21,14 @@ class MembersController < ApplicationController def edit if request.post? and @member.update_attributes(params[:member]) - flash[:notice] = 'Member was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :controller => 'projects', :action => 'settings', :id => @project end end def destroy @member.destroy - flash[:notice] = 'Member was successfully removed.' + flash[:notice] = l(:notice_successful_delete) redirect_to :controller => 'projects', :action => 'settings', :id => @project end diff --git a/redmine/app/controllers/news_controller.rb b/redmine/app/controllers/news_controller.rb index 065336f..b50b59d 100644 --- a/redmine/app/controllers/news_controller.rb +++ b/redmine/app/controllers/news_controller.rb @@ -24,7 +24,7 @@ class NewsController < ApplicationController def edit if request.post? and @news.update_attributes(params[:news]) - flash[:notice] = 'News was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'show', :id => @news end end diff --git a/redmine/app/controllers/projects_controller.rb b/redmine/app/controllers/projects_controller.rb index 3d45f72..0f8f194 100644 --- a/redmine/app/controllers/projects_controller.rb +++ b/redmine/app/controllers/projects_controller.rb @@ -58,7 +58,7 @@ class ProjectsController < ApplicationController @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } @project.custom_values = @custom_values if @project.save - flash[:notice] = 'Project was successfully created.' + flash[:notice] = l(:notice_successful_create) redirect_to :controller => 'admin', :action => 'projects' end end @@ -92,7 +92,7 @@ class ProjectsController < ApplicationController @project.custom_values = @custom_values end if @project.update_attributes(params[:project]) - flash[:notice] = 'Project was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'settings', :id => @project else settings @@ -114,6 +114,7 @@ class ProjectsController < ApplicationController if request.post? @issue_category = @project.issue_categories.build(params[:issue_category]) if @issue_category.save + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'settings', :id => @project else settings @@ -126,6 +127,7 @@ class ProjectsController < ApplicationController def add_version @version = @project.versions.build(params[:version]) if request.post? and @version.save + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'settings', :id => @project end end @@ -135,7 +137,7 @@ class ProjectsController < ApplicationController @member = @project.members.build(params[:member]) if request.post? if @member.save - flash[:notice] = 'Member was successfully added.' + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'settings', :id => @project else settings @@ -160,6 +162,7 @@ class ProjectsController < ApplicationController @attachment.author_id = self.logged_in_user.id if self.logged_in_user end if @document.save + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list_documents', :id => @project end end @@ -188,7 +191,7 @@ class ProjectsController < ApplicationController @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } @issue.custom_values = @custom_values if @issue.save - flash[:notice] = "Issue was successfully added." + flash[:notice] = l(:notice_successful_create) Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled? redirect_to :action => 'list_issues', :id => @project end @@ -243,6 +246,7 @@ class ProjectsController < ApplicationController @news.attributes = params[:news] @news.author_id = self.logged_in_user.id if self.logged_in_user if @news.save + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list_news', :id => @project end end @@ -260,6 +264,7 @@ class ProjectsController < ApplicationController @attachment = @project.versions.find(params[:version_id]).attachments.build(params[:attachment]) @attachment.author_id = self.logged_in_user.id if self.logged_in_user if @attachment.save + flash[:notice] = l(:notice_successful_create) redirect_to :controller => 'projects', :action => 'list_files', :id => @project end end @@ -285,8 +290,7 @@ private # used as a before_filter def find_project @project = Project.find(params[:id]) - rescue - flash[:notice] = 'Project not found.' + rescue redirect_to :action => 'list' end end diff --git a/redmine/app/controllers/roles_controller.rb b/redmine/app/controllers/roles_controller.rb index 0e26ff5..6d524cf 100644 --- a/redmine/app/controllers/roles_controller.rb +++ b/redmine/app/controllers/roles_controller.rb @@ -33,7 +33,7 @@ class RolesController < ApplicationController if request.post? @role.permissions = Permission.find(@params[:permission_ids]) if @params[:permission_ids] if @role.save - flash[:notice] = 'Role was successfully created.' + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end end @@ -45,7 +45,7 @@ class RolesController < ApplicationController if request.post? and @role.update_attributes(params[:role]) @role.permissions = Permission.find(@params[:permission_ids] || []) Permission.allowed_to_role_expired - flash[:notice] = 'Role was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'list' end @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC') @@ -73,7 +73,7 @@ class RolesController < ApplicationController } } if @role.save - flash[:notice] = 'Workflow was successfully updated.' + flash[:notice] = l(:notice_successful_update) end end @roles = Role.find_all diff --git a/redmine/app/controllers/trackers_controller.rb b/redmine/app/controllers/trackers_controller.rb index 38cdb6c..bc76ea5 100644 --- a/redmine/app/controllers/trackers_controller.rb +++ b/redmine/app/controllers/trackers_controller.rb @@ -16,8 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class TrackersController < ApplicationController - layout 'base' - before_filter :require_admin + layout 'base' + before_filter :require_admin def index list @@ -34,7 +34,7 @@ class TrackersController < ApplicationController def new @tracker = Tracker.new(params[:tracker]) if request.post? and @tracker.save - flash[:notice] = 'Tracker was successfully created.' + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end end @@ -42,7 +42,7 @@ class TrackersController < ApplicationController def edit @tracker = Tracker.find(params[:id]) if request.post? and @tracker.update_attributes(params[:tracker]) - flash[:notice] = 'Tracker was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'list' end end diff --git a/redmine/app/controllers/users_controller.rb b/redmine/app/controllers/users_controller.rb index 758afc2..51c10ca 100644 --- a/redmine/app/controllers/users_controller.rb +++ b/redmine/app/controllers/users_controller.rb @@ -53,7 +53,7 @@ class UsersController < ApplicationController @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) } @user.custom_values = @custom_values if @user.save - flash[:notice] = 'User was successfully created.' + flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end end @@ -72,7 +72,7 @@ class UsersController < ApplicationController @user.custom_values = @custom_values end if @user.update_attributes(params[:user]) - flash[:notice] = 'User was successfully updated.' + flash[:notice] = l(:notice_successful_update) redirect_to :action => 'list' end end diff --git a/redmine/app/controllers/versions_controller.rb b/redmine/app/controllers/versions_controller.rb index c462867..57f56bf 100644 --- a/redmine/app/controllers/versions_controller.rb +++ b/redmine/app/controllers/versions_controller.rb @@ -16,41 +16,42 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class VersionsController < ApplicationController - layout 'base' - before_filter :find_project, :authorize - - def edit - if request.post? and @version.update_attributes(params[:version]) - flash[:notice] = 'Version was successfully updated.' + layout 'base' + before_filter :find_project, :authorize + + def edit + if request.post? and @version.update_attributes(params[:version]) + flash[:notice] = l(:notice_successful_update) redirect_to :controller => 'projects', :action => 'settings', :id => @project - end - end - - def destroy - @version.destroy - redirect_to :controller => 'projects', :action => 'settings', :id => @project + end + end + + def destroy + @version.destroy + redirect_to :controller => 'projects', :action => 'settings', :id => @project rescue flash[:notice] = "Unable to delete version" - redirect_to :controller => 'projects', :action => 'settings', :id => @project - end - + redirect_to :controller => 'projects', :action => 'settings', :id => @project + end + def download @attachment = @version.attachments.find(params[:attachment_id]) @attachment.increment_download send_file @attachment.diskfile, :filename => @attachment.filename rescue - flash[:notice]="Requested file doesn't exist or has been deleted." + flash[:notice] = l(:notice_file_not_found) redirect_to :controller => 'projects', :action => 'list_files', :id => @project end def destroy_file @version.attachments.find(params[:attachment_id]).destroy + flash[:notice] = l(:notice_successful_delete) redirect_to :controller => 'projects', :action => 'list_files', :id => @project end private - def find_project + def find_project @version = Version.find(params[:id]) - @project = @version.project - end + @project = @version.project + end end diff --git a/redmine/app/helpers/application_helper.rb b/redmine/app/helpers/application_helper.rb index 6e395d3..7f3f975 100644 --- a/redmine/app/helpers/application_helper.rb +++ b/redmine/app/helpers/application_helper.rb @@ -92,6 +92,6 @@ module ApplicationHelper end def lang_options_for_select - GLoc.valid_languages.collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]} + (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]} end end diff --git a/redmine/app/helpers/custom_fields_helper.rb b/redmine/app/helpers/custom_fields_helper.rb index 10cb1bb..2af21ed 100644 --- a/redmine/app/helpers/custom_fields_helper.rb +++ b/redmine/app/helpers/custom_fields_helper.rb @@ -20,24 +20,27 @@ module CustomFieldsHelper def custom_field_tag(custom_value) custom_field = custom_value.custom_field field_name = "custom_fields[#{custom_field.id}]" + field_id = "custom_fields_#{custom_field.id}" + case custom_field.field_format when "string", "int", "date" - text_field_tag field_name, custom_value.value + text_field_tag field_name, custom_value.value, :id => field_id when "text" - text_area_tag field_name, custom_value.value, :cols => 60, :rows => 3 + text_area_tag field_name, custom_value.value, :id => field_id, :cols => 60, :rows => 3 when "bool" - check_box_tag(field_name, "1", custom_value.value == "1") + + check_box_tag(field_name, "1", custom_value.value == "1", :id => field_id) + hidden_field_tag(field_name, "0") when "list" select_tag field_name, "" + options_for_select(custom_field.possible_values.split('|'), - custom_value.value) + custom_value.value), :id => field_id end end def custom_field_label_tag(custom_value) content_tag "label", custom_value.custom_field.name + - (custom_value.custom_field.is_required? ? " *" : "") + (custom_value.custom_field.is_required? ? " *" : ""), + :for => "custom_fields_#{custom_value.custom_field.id}" end def custom_field_tag_with_label(custom_value) diff --git a/redmine/app/views/account/my_account.rhtml b/redmine/app/views/account/my_account.rhtml index 4aa6e62..e401ef3 100644 --- a/redmine/app/views/account/my_account.rhtml +++ b/redmine/app/views/account/my_account.rhtml @@ -9,7 +9,7 @@
- <%= text_field 'user', 'mail' %>
<%= select("user", "language", lang_options_for_select) %>
diff --git a/redmine/app/views/admin/mail_options.rhtml b/redmine/app/views/admin/mail_options.rhtml
index dcfc619..7424d3f 100644
--- a/redmine/app/views/admin/mail_options.rhtml
+++ b/redmine/app/views/admin/mail_options.rhtml
@@ -3,10 +3,19 @@
<%=l(:text_select_mail_notifications)%>
<%= start_form_tag ({}, :id => 'mail_options_form')%> -<% for action in @actions %> - <%= check_box_tag "action_ids[]", action.id, action.mail_enabled? %> - <%= action.description %><%=l(:button_check_all)%> | diff --git a/redmine/app/views/projects/show.rhtml b/redmine/app/views/projects/show.rhtml index 81f2beb..b9e28ce 100644 --- a/redmine/app/views/projects/show.rhtml +++ b/redmine/app/views/projects/show.rhtml @@ -56,11 +56,9 @@
- <%= news.title %> (<%= link_to_user news.author %> <%= format_time(news.created_on) %>)
+
<%= news.title %> (<%= link_to_user news.author %> <%= format_time(news.created_on) %>)
<%= news.summary %>
- [<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]
-