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:
parent
2a0257e8af
commit
5eed64b848
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue