diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-21 11:04:50 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-21 11:04:50 +0000 |
commit | fe28193e4eb9af2dc5262535a29ffde5249568fc (patch) | |
tree | bd4cf3a9fbada98e58e510ca0e25c42bf00676a7 /app | |
parent | 9a986ac0a51fe844eee816325e6a6d4122136d9a (diff) | |
download | redmine-fe28193e4eb9af2dc5262535a29ffde5249568fc.tar.gz redmine-fe28193e4eb9af2dc5262535a29ffde5249568fc.zip |
Merged Rails 2.2 branch. Redmine now requires Rails 2.2.2.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2493 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
49 files changed, 121 insertions, 180 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index e8d0a85b7..109771133 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -19,6 +19,13 @@ require 'uri' require 'cgi' class ApplicationController < ActionController::Base + include Redmine::I18n + + # In case the cookie store secret changes + rescue_from CGI::Session::CookieStore::TamperedWithCookie do |exception| + render :text => 'Your session was invalid and has been reset. Please, reload this page.', :status => 500 + end + layout 'base' before_filter :user_setup, :check_if_login_required, :set_localization @@ -64,20 +71,18 @@ class ApplicationController < ActionController::Base end def set_localization - User.current.language = nil unless User.current.logged? - lang = begin - if !User.current.language.blank? && GLoc.valid_language?(User.current.language) - User.current.language - elsif request.env['HTTP_ACCEPT_LANGUAGE'] - accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase - if !accept_lang.blank? && (GLoc.valid_language?(accept_lang) || GLoc.valid_language?(accept_lang = accept_lang.split('-').first)) - User.current.language = accept_lang - end + lang = nil + if User.current.logged? + lang = find_language(User.current.language) + end + if lang.nil? && request.env['HTTP_ACCEPT_LANGUAGE'] + accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase + if !accept_lang.blank? + lang = find_language(accept_lang) || find_language(accept_lang.split('-').first) end - rescue - nil - end || Setting.default_language - set_language_if_valid(lang) + end + lang ||= Setting.default_language + set_language_if_valid(lang) end def require_login @@ -152,7 +157,7 @@ class ApplicationController < ActionController::Base def render_error(msg) flash.now[:error] = msg - render :nothing => true, :layout => !request.xhr?, :status => 500 + render :text => '', :layout => !request.xhr?, :status => 500 end def render_feed(items, options={}) @@ -225,6 +230,8 @@ class ApplicationController < ActionController::Base tmp.collect!{|val, q| val} end return tmp + rescue + nil end # Returns a string that can be used as filename value in Content-Disposition header diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 5efa1d64c..8aa463019 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -258,7 +258,9 @@ class IssuesController < ApplicationController if unsaved_issue_ids.empty? flash[:notice] = l(:notice_successful_update) unless @issues.empty? else - flash[:error] = l(:notice_failed_to_save_issues, unsaved_issue_ids.size, @issues.size, '#' + unsaved_issue_ids.join(', #')) + flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size, + :total => @issues.size, + :ids => '#' + unsaved_issue_ids.join(', #')) end redirect_to(params[:back_to] || {:controller => 'issues', :action => 'index', :project_id => @project}) return @@ -291,7 +293,9 @@ class IssuesController < ApplicationController if unsaved_issue_ids.empty? flash[:notice] = l(:notice_successful_update) unless @issues.empty? else - flash[:error] = l(:notice_failed_to_save_issues, unsaved_issue_ids.size, @issues.size, '#' + unsaved_issue_ids.join(', #')) + flash[:error] = l(:notice_failed_to_save_issues, :count => unsaved_issue_ids.size, + :total => @issues.size, + :ids => '#' + unsaved_issue_ids.join(', #')) end redirect_to :controller => 'issues', :action => 'index', :project_id => @project return diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index a90b57c3d..e2cdd17b8 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -238,8 +238,7 @@ private changes_by_day.each {|c| changes_by_month[c.first.to_date.months_ago] += c.last } fields = [] - month_names = l(:actionview_datehelper_select_month_names_abbr).split(',') - 12.times {|m| fields << month_names[((Date.today.month - 1 - m) % 12)]} + 12.times {|m| fields << month_name(((Date.today.month - 1 - m) % 12) + 1)} graph = SVG::Graph::Bar.new( :height => 300, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5b63ecd5a..2e95ca5ff 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -22,6 +22,7 @@ require 'cgi' module ApplicationHelper include Redmine::WikiFormatting::Macros::Definitions + include Redmine::I18n include GravatarHelper::PublicMethods extend Forwardable @@ -89,26 +90,9 @@ module ApplicationHelper html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" link_to name, {}, html_options end - - def format_date(date) - return nil unless date - # "Setting.date_format.size < 2" is a temporary fix (content of date_format setting changed) - @date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format) - date.strftime(@date_format) - end - - def format_time(time, include_date = true) - return nil unless time - time = time.to_time if time.is_a?(String) - zone = User.current.time_zone - local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) - @date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format) - @time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format) - include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format) - end def format_activity_title(text) - h(truncate_single_line(text, 100)) + h(truncate_single_line(text, :length => 100)) end def format_activity_day(date) @@ -116,14 +100,7 @@ module ApplicationHelper end def format_activity_description(text) - h(truncate(text.to_s, 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />") - end - - def distance_of_date_in_words(from_date, to_date = 0) - from_date = from_date.to_date if from_date.respond_to?(:to_date) - to_date = to_date.to_date if to_date.respond_to?(:to_date) - distance_in_days = (to_date - from_date).abs - lwr(:actionview_datehelper_time_in_words_day, distance_in_days) + h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />") end def due_date_distance_in_words(date) @@ -235,20 +212,7 @@ module ApplicationHelper {:controller => 'projects', :action => 'activity', :id => @project, :from => created.to_date}, :title => format_time(created)) author_tag = (author.is_a?(User) && !author.anonymous?) ? link_to(h(author), :controller => 'account', :action => 'show', :id => author) : h(author || 'Anonymous') - l(options[:label] || :label_added_time_by, author_tag, time_tag) - end - - def l_or_humanize(s, options={}) - k = "#{options[:prefix]}#{s}".to_sym - l_has_string?(k) ? l(k) : s.to_s.humanize - end - - def day_name(day) - l(:general_day_names).split(',')[day-1] - end - - def month_name(month) - l(:actionview_datehelper_select_month_names).split(',')[month-1] + l(options[:label] || :label_added_time_by, :author => author_tag, :age => time_tag) end def syntax_highlight(name, content) @@ -308,9 +272,9 @@ module ApplicationHelper end def other_formats_links(&block) - concat('<p class="other-formats">' + l(:label_export_to), block.binding) + concat('<p class="other-formats">' + l(:label_export_to)) yield Redmine::Views::OtherFormatsBuilder.new(self) - concat('</p>', block.binding) + concat('</p>') end def page_header_title @@ -479,7 +443,7 @@ module ApplicationHelper if project && (changeset = project.changesets.find_by_revision(oid)) link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid}, :class => 'changeset', - :title => truncate_single_line(changeset.comments, 100)) + :title => truncate_single_line(changeset.comments, :length => 100)) end elsif sep == '#' oid = oid.to_i @@ -488,7 +452,7 @@ module ApplicationHelper if issue = Issue.find_by_id(oid, :include => [:project, :status], :conditions => Project.visible_by(User.current)) link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid}, :class => (issue.closed? ? 'issue closed' : 'issue'), - :title => "#{truncate(issue.subject, 100)} (#{issue.status.name})") + :title => "#{truncate(issue.subject, :length => 100)} (#{issue.status.name})") link = content_tag('del', link) if issue.closed? end when 'document' @@ -503,7 +467,7 @@ module ApplicationHelper end when 'message' if message = Message.find_by_id(oid, :include => [:parent, {:board => :project}], :conditions => Project.visible_by(User.current)) - link = link_to h(truncate(message.subject, 60)), {:only_path => only_path, + link = link_to h(truncate(message.subject, :length => 60)), {:only_path => only_path, :controller => 'messages', :action => 'show', :board_id => message.board, @@ -530,7 +494,7 @@ module ApplicationHelper if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, :class => 'changeset', - :title => truncate_single_line(changeset.comments, 100) + :title => truncate_single_line(changeset.comments, :length => 100) end when 'source', 'export' if project && project.repository @@ -565,46 +529,9 @@ module ApplicationHelper gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br end - def error_messages_for(object_name, options = {}) - options = options.symbolize_keys - object = instance_variable_get("@#{object_name}") - if object && !object.errors.empty? - # build full_messages here with controller current language - full_messages = [] - object.errors.each do |attr, msg| - next if msg.nil? - msg = [msg] unless msg.is_a?(Array) - if attr == "base" - full_messages << l(*msg) - else - full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(*msg) unless attr == "custom_values" - end - end - # retrieve custom values error messages - if object.errors[:custom_values] - object.custom_values.each do |v| - v.errors.each do |attr, msg| - next if msg.nil? - msg = [msg] unless msg.is_a?(Array) - full_messages << "« " + v.custom_field.name + " » " + l(*msg) - end - end - end - content_tag("div", - content_tag( - options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":" - ) + - content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), - "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" - ) - else - "" - end - end - def lang_options_for_select(blank=true) (blank ? [["(auto)", ""]] : []) + - GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last } + valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last } end def label_tag_for(name, option_tags = nil, options = {}) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index b2b85ee4c..16678df7d 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -119,7 +119,7 @@ module IssuesHelper case detail.property when 'attr', 'cf' if !detail.old_value.blank? - label + " " + l(:text_journal_changed, old_value, value) + label + " " + l(:text_journal_changed, :old => old_value, :new => value) else label + " " + l(:text_journal_set_to, value) end diff --git a/app/helpers/messages_helper.rb b/app/helpers/messages_helper.rb index bf23275c3..034d1ad31 100644 --- a/app/helpers/messages_helper.rb +++ b/app/helpers/messages_helper.rb @@ -19,7 +19,7 @@ module MessagesHelper def link_to_message(message) return '' unless message - link_to h(truncate(message.subject, 60)), :controller => 'messages', + link_to h(truncate(message.subject, :length => 60)), :controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root, diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index 35442f615..7d130331d 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -22,8 +22,8 @@ module SettingsHelper {:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication}, {:name => 'projects', :partial => 'settings/projects', :label => :label_project_plural}, {:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking}, - {:name => 'notifications', :partial => 'settings/notifications', :label => l(:field_mail_notification)}, - {:name => 'mail_handler', :partial => 'settings/mail_handler', :label => l(:label_incoming_emails)}, + {:name => 'notifications', :partial => 'settings/notifications', :label => :field_mail_notification}, + {:name => 'mail_handler', :partial => 'settings/mail_handler', :label => :label_incoming_emails}, {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural} ] end diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 0824a980e..e29de363b 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -109,7 +109,7 @@ class Changeset < ActiveRecord::Base if self.scmid && (! (csettext =~ /^r[0-9]+$/)) csettext = "commit:\"#{self.scmid}\"" end - journal = issue.init_journal(user || User.anonymous, l(:text_status_changed_by_changeset, csettext)) + journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, csettext)) issue.status = fix_status issue.done_ratio = done_ratio if done_ratio issue.save diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index f277dc349..5160fcf8a 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -48,14 +48,14 @@ class CustomField < ActiveRecord::Base def validate if self.field_format == "list" - errors.add(:possible_values, :activerecord_error_blank) if self.possible_values.nil? || self.possible_values.empty? - errors.add(:possible_values, :activerecord_error_invalid) unless self.possible_values.is_a? Array + errors.add(:possible_values, :blank) if self.possible_values.nil? || self.possible_values.empty? + errors.add(:possible_values, :invalid) unless self.possible_values.is_a? Array end # validate default value v = CustomValue.new(:custom_field => self.clone, :value => default_value, :customized => nil) v.custom_field.is_required = false - errors.add(:default_value, :activerecord_error_invalid) unless v.valid? + errors.add(:default_value, :invalid) unless v.valid? end # Makes possible_values accept a multiline string diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb index 1f662baa7..2d7d1cffe 100644 --- a/app/models/custom_value.rb +++ b/app/models/custom_value.rb @@ -45,22 +45,22 @@ class CustomValue < ActiveRecord::Base protected def validate if value.blank? - errors.add(:value, :activerecord_error_blank) if custom_field.is_required? and value.blank? + errors.add(:value, :blank) if custom_field.is_required? and value.blank? else - errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.blank? or value =~ Regexp.new(custom_field.regexp) - errors.add(:value, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length - errors.add(:value, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length + errors.add(:value, :invalid) unless custom_field.regexp.blank? or value =~ Regexp.new(custom_field.regexp) + errors.add(:value, :too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length + errors.add(:value, :too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length # Format specific validations case custom_field.field_format when 'int' - errors.add(:value, :activerecord_error_not_a_number) unless value =~ /^[+-]?\d+$/ + errors.add(:value, :not_a_number) unless value =~ /^[+-]?\d+$/ when 'float' - begin; Kernel.Float(value); rescue; errors.add(:value, :activerecord_error_invalid) end + begin; Kernel.Float(value); rescue; errors.add(:value, :invalid) end when 'date' - errors.add(:value, :activerecord_error_not_a_date) unless value =~ /^\d{4}-\d{2}-\d{2}$/ + errors.add(:value, :not_a_date) unless value =~ /^\d{4}-\d{2}-\d{2}$/ when 'list' - errors.add(:value, :activerecord_error_inclusion) unless custom_field.possible_values.include?(value) + errors.add(:value, :inclusion) unless custom_field.possible_values.include?(value) end end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 46a28708d..3a278a759 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -129,20 +129,20 @@ class Issue < ActiveRecord::Base def validate if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty? - errors.add :due_date, :activerecord_error_not_a_date + errors.add :due_date, :not_a_date end if self.due_date and self.start_date and self.due_date < self.start_date - errors.add :due_date, :activerecord_error_greater_than_start_date + errors.add :due_date, :greater_than_start_date end if start_date && soonest_start && start_date < soonest_start - errors.add :start_date, :activerecord_error_invalid + errors.add :start_date, :invalid end end def validate_on_create - errors.add :tracker_id, :activerecord_error_invalid unless project.trackers.include?(tracker) + errors.add :tracker_id, :invalid unless project.trackers.include?(tracker) end def before_create diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb index 13e14cccc..d26292c37 100644 --- a/app/models/issue_relation.rb +++ b/app/models/issue_relation.rb @@ -39,9 +39,9 @@ class IssueRelation < ActiveRecord::Base def validate if issue_from && issue_to - errors.add :issue_to_id, :activerecord_error_invalid if issue_from_id == issue_to_id - errors.add :issue_to_id, :activerecord_error_not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations? - errors.add_to_base :activerecord_error_circular_dependency if issue_to.all_dependent_issues.include? issue_from + errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id + errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations? + errors.add_to_base :circular_dependency if issue_to.all_dependent_issues.include? issue_from end end diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 8e19bcdf4..8d73f0d6e 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -236,4 +236,9 @@ class MailHandler < ActionMailer::Base end @plain_text_body.strip! end + + + def self.full_sanitizer + @full_sanitizer ||= HTML::FullSanitizer.new + end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index c8deeffbd..7560e53b5 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -21,6 +21,7 @@ class Mailer < ActionMailer::Base helper :custom_fields include ActionController::UrlWriter + include Redmine::I18n def issue_add(issue) redmine_headers 'Project' => issue.project.identifier, diff --git a/app/models/member.rb b/app/models/member.rb index b4617c229..0f644dbe7 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -24,7 +24,7 @@ class Member < ActiveRecord::Base validates_uniqueness_of :user_id, :scope => :project_id def validate - errors.add :role_id, :activerecord_error_invalid if role && !role.member? + errors.add :role_id, :invalid if role && !role.member? end def name diff --git a/app/models/project.rb b/app/models/project.rb index e4db6d867..980d194b1 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -306,7 +306,7 @@ class Project < ActiveRecord::Base protected def validate - errors.add(:identifier, :activerecord_error_invalid) if !identifier.blank? && identifier.match(/^\d*$/) + errors.add(:identifier, :invalid) if !identifier.blank? && identifier.match(/^\d*$/) end private diff --git a/app/models/query.rb b/app/models/query.rb index 23742cfa5..84e127b6b 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -17,7 +17,7 @@ class QueryColumn attr_accessor :name, :sortable, :default_order - include GLoc + include Redmine::I18n def initialize(name, options={}) self.name = name @@ -26,7 +26,6 @@ class QueryColumn end def caption - set_language_if_valid(User.current.language) l("field_#{name}") end end @@ -113,7 +112,6 @@ class Query < ActiveRecord::Base def initialize(attributes = nil) super attributes self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} } - set_language_if_valid(User.current.language) end def after_initialize @@ -123,7 +121,7 @@ class Query < ActiveRecord::Base def validate filters.each_key do |field| - errors.add label_for(field), :activerecord_error_blank unless + errors.add label_for(field), :blank unless # filter requires one or more values (values_for(field) and !values_for(field).first.blank?) or # filter doesn't require any value diff --git a/app/models/repository.rb b/app/models/repository.rb index 920cf2460..a205af5b4 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -25,7 +25,7 @@ class Repository < ActiveRecord::Base before_destroy :clear_changesets # Checks if the SCM is enabled when creating a repository - validate_on_create { |r| r.errors.add(:type, :activerecord_error_invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) } + validate_on_create { |r| r.errors.add(:type, :invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) } # Removes leading and trailing whitespace def url=(arg) diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index 4cb76441b..7d165492a 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -26,13 +26,13 @@ class TimeEntry < ActiveRecord::Base attr_protected :project_id, :user_id, :tyear, :tmonth, :tweek acts_as_customizable - acts_as_event :title => Proc.new {|o| "#{o.user}: #{lwr(:label_f_hour, o.hours)} (#{(o.issue || o.project).event_title})"}, + acts_as_event :title => Proc.new {|o| "#{o.user}: #{l_hours(o.hours)} (#{(o.issue || o.project).event_title})"}, :url => Proc.new {|o| {:controller => 'timelog', :action => 'details', :project_id => o.project}}, :author => :user, :description => :comments validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on - validates_numericality_of :hours, :allow_nil => true, :message => :activerecord_error_invalid + validates_numericality_of :hours, :allow_nil => true, :message => :invalid validates_length_of :comments, :maximum => 255, :allow_nil => true def after_initialize @@ -48,9 +48,9 @@ class TimeEntry < ActiveRecord::Base end def validate - errors.add :hours, :activerecord_error_invalid if hours && (hours < 0 || hours >= 1000) - errors.add :project_id, :activerecord_error_invalid if project.nil? - errors.add :issue_id, :activerecord_error_invalid if (issue_id && !issue) || (issue && project!=issue.project) + errors.add :hours, :invalid if hours && (hours < 0 || hours >= 1000) + errors.add :project_id, :invalid if project.nil? + errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project) end def hours=(h) diff --git a/app/models/version.rb b/app/models/version.rb index 7f96cea6b..679854340 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -25,7 +25,7 @@ class Version < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name, :scope => [:project_id] validates_length_of :name, :maximum => 60 - validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => 'activerecord_error_not_a_date', :allow_nil => true + validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :not_a_date, :allow_nil => true def start_date effective_date diff --git a/app/models/watcher.rb b/app/models/watcher.rb index 38110c584..b13039f84 100644 --- a/app/models/watcher.rb +++ b/app/models/watcher.rb @@ -25,6 +25,6 @@ class Watcher < ActiveRecord::Base protected def validate - errors.add :user_id, :activerecord_error_invalid unless user.nil? || user.active? + errors.add :user_id, :invalid unless user.nil? || user.active? end end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 0d96cc047..f8bbcdebd 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -129,9 +129,9 @@ class WikiPage < ActiveRecord::Base protected def validate - errors.add(:parent_title, :activerecord_error_invalid) if !@parent_title.blank? && parent.nil? - errors.add(:parent_title, :activerecord_error_circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) - errors.add(:parent_title, :activerecord_error_not_same_project) if parent && (parent.wiki_id != wiki_id) + errors.add(:parent_title, :invalid) if !@parent_title.blank? && parent.nil? + errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) + errors.add(:parent_title, :not_same_project) if parent && (parent.wiki_id != wiki_id) end end diff --git a/app/views/common/_calendar.rhtml b/app/views/common/_calendar.rhtml index 1095cd501..6ac9ddce6 100644 --- a/app/views/common/_calendar.rhtml +++ b/app/views/common/_calendar.rhtml @@ -20,7 +20,7 @@ while day <= calendar.enddt %> image_tag('arrow_to.png') end %> <%= h("#{i.project} -") unless @project && @project == i.project %> - <%= link_to_issue i %>: <%= h(truncate(i.subject, 30)) %> + <%= link_to_issue i %>: <%= h(truncate(i.subject, :length => 30)) %> <span class="tip"><%= render_issue_tooltip i %></span> </div> <% else %> diff --git a/app/views/common/feed.atom.rxml b/app/views/common/feed.atom.rxml index 8d07cf208..811140152 100644 --- a/app/views/common/feed.atom.rxml +++ b/app/views/common/feed.atom.rxml @@ -1,6 +1,6 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do - xml.title truncate_single_line(@title, 100) + xml.title truncate_single_line(@title, :length => 100) xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false})) xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) xml.id url_for(:controller => 'welcome', :only_path => false) @@ -11,9 +11,9 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.entry do url = url_for(item.event_url(:only_path => false)) if @project - xml.title truncate_single_line(item.event_title, 100) + xml.title truncate_single_line(item.event_title, :length => 100) else - xml.title truncate_single_line("#{item.project} - #{item.event_title}", 100) + xml.title truncate_single_line("#{item.project} - #{item.event_title}", :length => 100) end xml.link "rel" => "alternate", "href" => url xml.id url diff --git a/app/views/custom_fields/index.rhtml b/app/views/custom_fields/index.rhtml index 43ddd99c8..70b7197ff 100644 --- a/app/views/custom_fields/index.rhtml +++ b/app/views/custom_fields/index.rhtml @@ -35,7 +35,7 @@ <td align="center"><%= image_tag 'true.png' if custom_field.is_required? %></td> <% if tab[:name] == 'IssueCustomField' %> <td align="center"><%= image_tag 'true.png' if custom_field.is_for_all? %></td> - <td align="center"><%= custom_field.projects.count.to_s + ' ' + lwr(:label_project, custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> + <td align="center"><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> <% end %> <td align="center" style="width:15%;"> <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => custom_field, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> diff --git a/app/views/documents/_document.rhtml b/app/views/documents/_document.rhtml index ddfdb9eec..47b450000 100644 --- a/app/views/documents/_document.rhtml +++ b/app/views/documents/_document.rhtml @@ -1,3 +1,3 @@ <p><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %><br /> -<% unless document.description.blank? %><%=h(truncate(document.description, 250)) %><br /><% end %> +<% unless document.description.blank? %><%=h(truncate(document.description, :length => 250)) %><br /><% end %> <em><%= format_time(document.created_on) %></em></p>
\ No newline at end of file diff --git a/app/views/issues/_relations.rhtml b/app/views/issues/_relations.rhtml index f99976f5c..6f02d1937 100644 --- a/app/views/issues/_relations.rhtml +++ b/app/views/issues/_relations.rhtml @@ -10,7 +10,7 @@ <table style="width:100%"> <% @issue.relations.select {|r| r.other_issue(@issue).visible? }.each do |relation| %> <tr> -<td><%= l(relation.label_for(@issue)) %> <%= "(#{lwr(:actionview_datehelper_time_in_words_day, relation.delay)})" if relation.delay && relation.delay != 0 %> +<td><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %> <%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %> <%= link_to_issue relation.other_issue(@issue) %></td> <td><%=h relation.other_issue(@issue).subject %></td> <td><%= relation.other_issue(@issue).status.name %></td> diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 6b79ba841..cd18dfa09 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -34,13 +34,13 @@ <td class="category"><b><%=l(:field_category)%>:</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> <% if User.current.allowed_to?(:view_time_entries, @project) %> <td class="spent-time"><b><%=l(:label_spent_time)%>:</b></td> - <td class="spent-hours"><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :project_id => @project, :issue_id => @issue}) : "-" %></td> + <td class="spent-hours"><%= @issue.spent_hours > 0 ? (link_to l_hours(@issue.spent_hours), {:controller => 'timelog', :action => 'details', :project_id => @project, :issue_id => @issue}) : "-" %></td> <% end %> </tr> <tr> <td class="fixed-version"><b><%=l(:field_fixed_version)%>:</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> <% if @issue.estimated_hours %> - <td class="estimated-hours"><b><%=l(:field_estimated_hours)%>:</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td> + <td class="estimated-hours"><b><%=l(:field_estimated_hours)%>:</b></td><td><%= l_hours(@issue.estimated_hours) %></td> <% end %> </tr> <tr> diff --git a/app/views/mailer/issue_add.text.html.rhtml b/app/views/mailer/issue_add.text.html.rhtml index b1c4605e6..ef1d0dec4 100644 --- a/app/views/mailer/issue_add.text.html.rhtml +++ b/app/views/mailer/issue_add.text.html.rhtml @@ -1,3 +1,3 @@ -<%= l(:text_issue_added, "##{@issue.id}", @issue.author) %> +<%= l(:text_issue_added, :id => "##{@issue.id}", :author => @issue.author) %> <hr /> <%= render :partial => "issue_text_html", :locals => { :issue => @issue, :issue_url => @issue_url } %> diff --git a/app/views/mailer/issue_add.text.plain.rhtml b/app/views/mailer/issue_add.text.plain.rhtml index c6cb0837f..19c1dcf5b 100644 --- a/app/views/mailer/issue_add.text.plain.rhtml +++ b/app/views/mailer/issue_add.text.plain.rhtml @@ -1,4 +1,4 @@ -<%= l(:text_issue_added, "##{@issue.id}", @issue.author) %> +<%= l(:text_issue_added, :id => "##{@issue.id}", :author => @issue.author) %> ---------------------------------------- <%= render :partial => "issue_text_plain", :locals => { :issue => @issue, :issue_url => @issue_url } %> diff --git a/app/views/mailer/issue_edit.text.html.rhtml b/app/views/mailer/issue_edit.text.html.rhtml index 48affaf77..b4a1f953e 100644 --- a/app/views/mailer/issue_edit.text.html.rhtml +++ b/app/views/mailer/issue_edit.text.html.rhtml @@ -1,4 +1,4 @@ -<%= l(:text_issue_updated, "##{@issue.id}", @journal.user) %> +<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user) %> <ul> <% for detail in @journal.details %> diff --git a/app/views/mailer/issue_edit.text.plain.rhtml b/app/views/mailer/issue_edit.text.plain.rhtml index b5a5ec978..870f8fa3a 100644 --- a/app/views/mailer/issue_edit.text.plain.rhtml +++ b/app/views/mailer/issue_edit.text.plain.rhtml @@ -1,4 +1,4 @@ -<%= l(:text_issue_updated, "##{@issue.id}", @journal.user) %> +<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user) %> <% for detail in @journal.details -%> <%= show_detail(detail, true) %> diff --git a/app/views/mailer/reminder.text.html.rhtml b/app/views/mailer/reminder.text.html.rhtml index 1e33fbe43..bd53df802 100644 --- a/app/views/mailer/reminder.text.html.rhtml +++ b/app/views/mailer/reminder.text.html.rhtml @@ -1,4 +1,4 @@ -<p><%= l(:mail_body_reminder, @issues.size, @days) %></p> +<p><%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %></p> <ul> <% @issues.each do |issue| -%> diff --git a/app/views/mailer/reminder.text.plain.rhtml b/app/views/mailer/reminder.text.plain.rhtml index 7e6a2e585..c9e27dc8d 100644 --- a/app/views/mailer/reminder.text.plain.rhtml +++ b/app/views/mailer/reminder.text.plain.rhtml @@ -1,4 +1,4 @@ -<%= l(:mail_body_reminder, @issues.size, @days) %>: +<%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %>: <% @issues.each do |issue| -%> * <%= "#{issue.project} - #{issue.tracker} ##{issue.id}: #{issue.subject}" %> diff --git a/app/views/my/blocks/_issueswatched.rhtml b/app/views/my/blocks/_issueswatched.rhtml index 22b911310..0abda6165 100644 --- a/app/views/my/blocks/_issueswatched.rhtml +++ b/app/views/my/blocks/_issueswatched.rhtml @@ -1,4 +1,5 @@ -<h3><%=l(:label_watched_issues)%></h3>
+<h3><%=l(:label_watched_issues)%> (<%= Issue.visible.count(:include => :watchers,
+ :conditions => ["#{Watcher.table_name}.user_id = ?", user.id]) %>)</h3>
<% watched_issues = Issue.visible.find(:all,
:include => [:status, :project, :tracker, :watchers],
:limit => 10,
diff --git a/app/views/news/_news.rhtml b/app/views/news/_news.rhtml index e26d2c4a7..e95e8a557 100644 --- a/app/views/news/_news.rhtml +++ b/app/views/news/_news.rhtml @@ -1,6 +1,6 @@ <p><%= link_to(h(news.project.name), :controller => 'projects', :action => 'show', :id => news.project) + ': ' unless @project %> <%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %> -<%= "(#{news.comments_count} #{lwr(:label_comment, news.comments_count).downcase})" if news.comments_count > 0 %> +<%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %> <br /> <% unless news.summary.blank? %><span class="summary"><%=h news.summary %></span><br /><% end %> <span class="author"><%= authoring news.created_on, news.author %></span></p> diff --git a/app/views/news/index.rhtml b/app/views/news/index.rhtml index 826894e08..11a39232c 100644 --- a/app/views/news/index.rhtml +++ b/app/views/news/index.rhtml @@ -30,7 +30,7 @@ <% @newss.each do |news| %> <h3><%= link_to(h(news.project.name), :controller => 'projects', :action => 'show', :id => news.project) + ': ' unless news.project == @project %> <%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %> - <%= "(#{news.comments_count} #{lwr(:label_comment, news.comments_count).downcase})" if news.comments_count > 0 %></h3> + <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3> <p class="author"><%= authoring news.created_on, news.author %></p> <div class="wiki"> <%= textilizable(news.description) %> diff --git a/app/views/projects/_form.rhtml b/app/views/projects/_form.rhtml index 24b1d9c1f..68fd053d7 100644 --- a/app/views/projects/_form.rhtml +++ b/app/views/projects/_form.rhtml @@ -11,7 +11,7 @@ <p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p> <p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen? %> <% unless @project.identifier_frozen? %> -<br /><em><%= l(:text_length_between, 2, 20) %> <%= l(:text_project_identifier_info) %></em> +<br /><em><%= l(:text_length_between, :min => 2, :max => 20) %> <%= l(:text_project_identifier_info) %></em> <% end %></p> <p><%= f.text_field :homepage, :size => 60 %></p> <p><%= f.check_box :is_public %></p> diff --git a/app/views/projects/add.rhtml b/app/views/projects/add.rhtml index 46ab1a9be..d2ec5db92 100644 --- a/app/views/projects/add.rhtml +++ b/app/views/projects/add.rhtml @@ -7,7 +7,7 @@ <% Redmine::AccessControl.available_project_modules.each do |m| %> <label class="floating"> <%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) %> - <%= (l_has_string?("project_module_#{m}".to_sym) ? l("project_module_#{m}".to_sym) : m.to_s.humanize) %> + <%= l_or_humanize(m, :prefix => "project_module_") %> </label> <% end %> </fieldset> diff --git a/app/views/projects/settings/_modules.rhtml b/app/views/projects/settings/_modules.rhtml index b4decf78a..06dea9b48 100644 --- a/app/views/projects/settings/_modules.rhtml +++ b/app/views/projects/settings/_modules.rhtml @@ -7,7 +7,7 @@ <% Redmine::AccessControl.available_project_modules.each do |m| %> <p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) -%> - <%= (l_has_string?("project_module_#{m}".to_sym) ? l("project_module_#{m}".to_sym) : m.to_s.humanize) %></label></p> + <%= l_or_humanize(m, :prefix => "project_module_") %></label></p> <% end %> </div> diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml index 37daa88be..b8de58d4e 100644 --- a/app/views/projects/show.rhtml +++ b/app/views/projects/show.rhtml @@ -23,8 +23,9 @@ <li><%= link_to tracker.name, :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1, "tracker_id" => tracker.id %>: - <%= @open_issues_by_tracker[tracker] || 0 %> <%= lwr(:label_open_issues, @open_issues_by_tracker[tracker] || 0) %> - <%= l(:label_on) %> <%= @total_issues_by_tracker[tracker] || 0 %></li> + <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, + :total => @total_issues_by_tracker[tracker].to_i) %> + </li> <% end %> </ul> <p><%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %></p> @@ -65,7 +66,7 @@ <% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %> <h3><%= l(:label_spent_time) %></h3> - <p><span class="icon icon-time"><%= lwr(:label_f_hour, @total_hours) %></span></p> + <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'details', :project_id => @project}) %> | <%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project}) %></p> <% end %> diff --git a/app/views/repositories/_dir_list_content.rhtml b/app/views/repositories/_dir_list_content.rhtml index 12ee44dbf..3fad7c02c 100644 --- a/app/views/repositories/_dir_list_content.rhtml +++ b/app/views/repositories/_dir_list_content.rhtml @@ -19,6 +19,6 @@ <td class="revision"><%= link_to(format_revision(entry.lastrev.name), :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td> <td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td> <td class="author"><%= changeset.nil? ? h(entry.lastrev.author.to_s.split('<').first) : changeset.author if entry.lastrev %></td> -<td class="comments"><%=h truncate(changeset.comments, 50) unless changeset.nil? %></td> +<td class="comments"><%=h truncate(changeset.comments, :length => 50) unless changeset.nil? %></td> </tr> <% end %> diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index cb5b70a4c..128937288 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -26,7 +26,7 @@ <h3><%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)</h3>
<dl id="search-results">
<% @results.each do |e| %>
- <dt class="<%= e.event_type %>"><%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate(e.event_title, 255), @tokens), e.event_url %></dt>
+ <dt class="<%= e.event_type %>"><%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate(e.event_title, :length => 255), @tokens), e.event_url %></dt>
<dd><span class="description"><%= highlight_tokens(e.event_description, @tokens) %></span>
<span class="author"><%= format_time(e.event_datetime) %></span></dd>
<% end %>
diff --git a/app/views/settings/_authentication.rhtml b/app/views/settings/_authentication.rhtml index a3ac555ed..ec8a0be96 100644 --- a/app/views/settings/_authentication.rhtml +++ b/app/views/settings/_authentication.rhtml @@ -5,7 +5,7 @@ <%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p> <p><label><%= l(:setting_autologin) %></label> -<%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p> +<%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, Setting.autologin) %></p> <p><label><%= l(:setting_self_registration) %></label> <%= select_tag 'settings[self_registration]', diff --git a/app/views/timelog/_list.rhtml b/app/views/timelog/_list.rhtml index 1144d42cc..019eda2ec 100644 --- a/app/views/timelog/_list.rhtml +++ b/app/views/timelog/_list.rhtml @@ -20,7 +20,7 @@ <td class="project"><%=h entry.project %></td> <td class="subject"> <% if entry.issue -%> -<%= link_to_issue entry.issue %>: <%= h(truncate(entry.issue.subject, 50)) -%> +<%= link_to_issue entry.issue %>: <%= h(truncate(entry.issue.subject, :length => 50)) -%> <% end -%> </td> <td class="comments"><%=h entry.comments %></td> diff --git a/app/views/timelog/details.rhtml b/app/views/timelog/details.rhtml index f4ae68aa9..950b37dc1 100644 --- a/app/views/timelog/details.rhtml +++ b/app/views/timelog/details.rhtml @@ -15,7 +15,7 @@ already in the URI %> <% end %>
<div class="total-hours">
-<p><%= l(:label_total) %>: <%= html_hours(lwr(:label_f_hour, @total_hours)) %></p>
+<p><%= l(:label_total) %>: <%= html_hours(l_hours(@total_hours)) %></p>
</div>
<% unless @entries.empty? %>
diff --git a/app/views/timelog/report.rhtml b/app/views/timelog/report.rhtml index 5f3ed09bd..6ff61ff75 100644 --- a/app/views/timelog/report.rhtml +++ b/app/views/timelog/report.rhtml @@ -20,7 +20,7 @@ [l(:label_day_plural).titleize, 'day']], @columns), :onchange => "this.form.onsubmit();" %> - <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l(@available_criterias[k][:label]), k]}), + <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l_or_humanize(@available_criterias[k][:label]), k]}), :onchange => "this.form.onsubmit();", :style => 'width: 200px', :id => nil, @@ -33,7 +33,7 @@ <% unless @criterias.empty? %> <div class="total-hours"> -<p><%= l(:label_total) %>: <%= html_hours(lwr(:label_f_hour, @total_hours)) %></p> +<p><%= l(:label_total) %>: <%= html_hours(l_hours(@total_hours)) %></p> </div> <% unless @hours.empty? %> @@ -41,7 +41,7 @@ <thead> <tr> <% @criterias.each do |criteria| %> - <th><%= l(@available_criterias[criteria][:label]) %></th> + <th><%= l_or_humanize(@available_criterias[criteria][:label]) %></th> <% end %> <% columns_width = (40 / (@periods.length+1)).to_i %> <% @periods.each do |period| %> diff --git a/app/views/versions/_overview.rhtml b/app/views/versions/_overview.rhtml index 377e9178b..724f9f923 100644 --- a/app/views/versions/_overview.rhtml +++ b/app/views/versions/_overview.rhtml @@ -9,12 +9,10 @@ <% if version.fixed_issues.count > 0 %> <%= progress_bar([version.closed_pourcent, version.completed_pourcent], :width => '40em', :legend => ('%0.0f%' % version.completed_pourcent)) %> <p class="progress-info"> - <%= link_to(version.closed_issues_count, :controller => 'issues', :action => 'index', :project_id => version.project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> - <%= lwr(:label_closed_issues, version.closed_issues_count) %> + <%= link_to_if(version.closed_issues_count > 0, l(:label_x_closed_issues_abbr, :count => version.closed_issues_count), :controller => 'issues', :action => 'index', :project_id => version.project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> (<%= '%0.0f' % (version.closed_issues_count.to_f / version.fixed_issues.count * 100) %>%)   - <%= link_to(version.open_issues_count, :controller => 'issues', :action => 'index', :project_id => version.project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) %> - <%= lwr(:label_open_issues, version.open_issues_count)%> + <%= link_to_if(version.open_issues_count > 0, l(:label_x_open_issues_abbr, :count => version.open_issues_count), :controller => 'issues', :action => 'index', :project_id => version.project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) %> (<%= '%0.0f' % (version.open_issues_count.to_f / version.fixed_issues.count * 100) %>%) </p> <% else %> diff --git a/app/views/versions/show.rhtml b/app/views/versions/show.rhtml index 7e5264562..ef5375198 100644 --- a/app/views/versions/show.rhtml +++ b/app/views/versions/show.rhtml @@ -10,12 +10,12 @@ <table> <tr> <td width="130px" align="right"><%= l(:field_estimated_hours) %></td> - <td width="240px" class="total-hours"width="130px" align="right"><%= html_hours(lwr(:label_f_hour, @version.estimated_hours)) %></td> + <td width="240px" class="total-hours"width="130px" align="right"><%= html_hours(l_hours(@version.estimated_hours)) %></td> </tr> <% if User.current.allowed_to?(:view_time_entries, @project) %> <tr> <td width="130px" align="right"><%= l(:label_spent_time) %></td> - <td width="240px" class="total-hours"><%= html_hours(lwr(:label_f_hour, @version.spent_hours)) %></td> + <td width="240px" class="total-hours"><%= html_hours(l_hours(@version.spent_hours)) %></td> </tr> <% end %> </table> |