Commit 1cc40a0bf8b1aa7cfb22c8a6e393c138a334802c
1 parent
9e023e2a
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
hotfix to manage translation
Showing
3 changed files
with
15 additions
and
6 deletions
Show diff stats
app/models/article.rb
| ... | ... | @@ -172,14 +172,17 @@ class Article < ActiveRecord::Base |
| 172 | 172 | self.profile |
| 173 | 173 | end |
| 174 | 174 | |
| 175 | - def self.human_attribute_name(attrib, options = {}) | |
| 175 | + def self.human_attribute_name_with_customization(attrib, options={}) | |
| 176 | 176 | case attrib.to_sym |
| 177 | 177 | when :name |
| 178 | 178 | _('Title') |
| 179 | 179 | else |
| 180 | - _(self.superclass.human_attribute_name(attrib)) | |
| 180 | + _(self.human_attribute_name_without_customization(attrib)) | |
| 181 | 181 | end |
| 182 | 182 | end |
| 183 | + class << self | |
| 184 | + alias_method_chain :human_attribute_name, :customization | |
| 185 | + end | |
| 183 | 186 | |
| 184 | 187 | def css_class_list |
| 185 | 188 | [self.class.name.to_css_class] | ... | ... |
app/models/change_password.rb
| ... | ... | @@ -2,16 +2,19 @@ class ChangePassword < Task |
| 2 | 2 | |
| 3 | 3 | attr_accessor :password, :password_confirmation |
| 4 | 4 | |
| 5 | - def self.human_attribute_name(attrib, options = {}) | |
| 5 | + def self.human_attribute_name_with_customization(attrib, options={}) | |
| 6 | 6 | case attrib.to_sym |
| 7 | 7 | when :password |
| 8 | 8 | _('Password') |
| 9 | 9 | when :password_confirmation |
| 10 | 10 | _('Password Confirmation') |
| 11 | 11 | else |
| 12 | - _(self.superclass.human_attribute_name(attrib)) | |
| 12 | + _(self.human_attribute_name_without_customization(attrib)) | |
| 13 | 13 | end |
| 14 | 14 | end |
| 15 | + class << self | |
| 16 | + alias_method_chain :human_attribute_name, :customization | |
| 17 | + end | |
| 15 | 18 | |
| 16 | 19 | validates_presence_of :requestor |
| 17 | 20 | ... | ... |
app/models/user.rb
| ... | ... | @@ -17,15 +17,18 @@ class User < ActiveRecord::Base |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | 19 | # FIXME ugly workaround |
| 20 | - def self.human_attribute_name(attrib, options={}) | |
| 20 | + def self.human_attribute_name_with_customization(attrib, options={}) | |
| 21 | 21 | case attrib.to_sym |
| 22 | 22 | when :login |
| 23 | 23 | return [_('Username'), _('Email')].join(' / ') |
| 24 | 24 | when :email |
| 25 | 25 | return _('e-Mail') |
| 26 | - else _(self.superclass.human_attribute_name(attrib)) | |
| 26 | + else _(self.human_attribute_name_without_customization(attrib)) | |
| 27 | 27 | end |
| 28 | 28 | end |
| 29 | + class << self | |
| 30 | + alias_method_chain :human_attribute_name, :customization | |
| 31 | + end | |
| 29 | 32 | |
| 30 | 33 | before_create do |user| |
| 31 | 34 | if user.environment.nil? | ... | ... |