human_attribute_name accepts optional argument.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8286 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-12-18 13:20:19 +00:00
parent 2a0257e8af
commit 5eed64b848
9 changed files with 17 additions and 17 deletions

View File

@ -51,12 +51,12 @@ class Group < Principal
end
end
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == 'lastname'
attr_name = "name"
end
super(attr_name)
super(attr_name, *args)
end
private

View File

@ -40,12 +40,12 @@ class Repository < ActiveRecord::Base
end
end
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == "log_encoding"
attr_name = "commit_logs_encoding"
end
super(attr_name)
super(attr_name, *args)
end
# Removes leading and trailing whitespace

View File

@ -21,12 +21,12 @@ class Repository::Bazaar < Repository
attr_protected :root_url
validates_presence_of :url, :log_encoding
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == "url"
attr_name = "path_to_repository"
end
super(attr_name)
super(attr_name, *args)
end
def self.scm_adapter_class

View File

@ -21,14 +21,14 @@ require 'digest/sha1'
class Repository::Cvs < Repository
validates_presence_of :url, :root_url, :log_encoding
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == "root_url"
attr_name = "cvsroot"
elsif attr_name == "url"
attr_name = "cvs_module"
end
super(attr_name)
super(attr_name, *args)
end
def self.scm_adapter_class

View File

@ -20,12 +20,12 @@ require 'redmine/scm/adapters/darcs_adapter'
class Repository::Darcs < Repository
validates_presence_of :url, :log_encoding
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == "url"
attr_name = "path_to_repository"
end
super(attr_name)
super(attr_name, *args)
end
def self.scm_adapter_class

View File

@ -24,12 +24,12 @@ class Repository::Filesystem < Repository
attr_protected :root_url
validates_presence_of :url
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == "url"
attr_name = "root_directory"
end
super(attr_name)
super(attr_name, *args)
end
def self.scm_adapter_class

View File

@ -22,12 +22,12 @@ class Repository::Git < Repository
attr_protected :root_url
validates_presence_of :url
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == "url"
attr_name = "path_to_repository"
end
super(attr_name)
super(attr_name, *args)
end
def self.scm_adapter_class

View File

@ -29,12 +29,12 @@ class Repository::Mercurial < Repository
# number of changesets to fetch at once
FETCH_AT_ONCE = 100
def self.human_attribute_name(attribute_key_name)
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name
if attr_name == "url"
attr_name = "path_to_repository"
end
super(attr_name)
super(attr_name, *args)
end
def self.scm_adapter_class

View File

@ -10,7 +10,7 @@ module ActiveRecord
include Redmine::I18n
# Translate attribute names for validation errors display
def self.human_attribute_name(attr)
def self.human_attribute_name(attr, *args)
l("field_#{attr.to_s.gsub(/_id$/, '')}", :default => attr)
end
end