From 5eed64b8488ac1f45537f9d8cb36a811921f7794 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 18 Dec 2011 13:20:19 +0000 Subject: [PATCH] human_attribute_name accepts optional argument. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8286 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/group.rb | 4 ++-- app/models/repository.rb | 4 ++-- app/models/repository/bazaar.rb | 4 ++-- app/models/repository/cvs.rb | 4 ++-- app/models/repository/darcs.rb | 4 ++-- app/models/repository/filesystem.rb | 4 ++-- app/models/repository/git.rb | 4 ++-- app/models/repository/mercurial.rb | 4 ++-- config/initializers/10-patches.rb | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/models/group.rb b/app/models/group.rb index c79b98111..cd0368a5c 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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 diff --git a/app/models/repository.rb b/app/models/repository.rb index 2cd5c8820..5130cc220 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -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 diff --git a/app/models/repository/bazaar.rb b/app/models/repository/bazaar.rb index b290bc8b0..d18dd6aed 100644 --- a/app/models/repository/bazaar.rb +++ b/app/models/repository/bazaar.rb @@ -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 diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb index e1bc9e33d..f8c10ddff 100644 --- a/app/models/repository/cvs.rb +++ b/app/models/repository/cvs.rb @@ -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 diff --git a/app/models/repository/darcs.rb b/app/models/repository/darcs.rb index 8003583a5..187e4783e 100644 --- a/app/models/repository/darcs.rb +++ b/app/models/repository/darcs.rb @@ -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 diff --git a/app/models/repository/filesystem.rb b/app/models/repository/filesystem.rb index a107a2f64..ca8a67284 100644 --- a/app/models/repository/filesystem.rb +++ b/app/models/repository/filesystem.rb @@ -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 diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 586a6e5ef..86507acbc 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -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 diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index 58332e803..e40841f20 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.rb @@ -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 diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index ad301d887..b4810f0fa 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -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