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,14 +172,17 @@ class Article < ActiveRecord::Base | ||
| 172 | self.profile | 172 | self.profile |
| 173 | end | 173 | end |
| 174 | 174 | ||
| 175 | - def self.human_attribute_name(attrib, options = {}) | 175 | + def self.human_attribute_name_with_customization(attrib, options={}) |
| 176 | case attrib.to_sym | 176 | case attrib.to_sym |
| 177 | when :name | 177 | when :name |
| 178 | _('Title') | 178 | _('Title') |
| 179 | else | 179 | else |
| 180 | - _(self.superclass.human_attribute_name(attrib)) | 180 | + _(self.human_attribute_name_without_customization(attrib)) |
| 181 | end | 181 | end |
| 182 | end | 182 | end |
| 183 | + class << self | ||
| 184 | + alias_method_chain :human_attribute_name, :customization | ||
| 185 | + end | ||
| 183 | 186 | ||
| 184 | def css_class_list | 187 | def css_class_list |
| 185 | [self.class.name.to_css_class] | 188 | [self.class.name.to_css_class] |
app/models/change_password.rb
| @@ -2,16 +2,19 @@ class ChangePassword < Task | @@ -2,16 +2,19 @@ class ChangePassword < Task | ||
| 2 | 2 | ||
| 3 | attr_accessor :password, :password_confirmation | 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 | case attrib.to_sym | 6 | case attrib.to_sym |
| 7 | when :password | 7 | when :password |
| 8 | _('Password') | 8 | _('Password') |
| 9 | when :password_confirmation | 9 | when :password_confirmation |
| 10 | _('Password Confirmation') | 10 | _('Password Confirmation') |
| 11 | else | 11 | else |
| 12 | - _(self.superclass.human_attribute_name(attrib)) | 12 | + _(self.human_attribute_name_without_customization(attrib)) |
| 13 | end | 13 | end |
| 14 | end | 14 | end |
| 15 | + class << self | ||
| 16 | + alias_method_chain :human_attribute_name, :customization | ||
| 17 | + end | ||
| 15 | 18 | ||
| 16 | validates_presence_of :requestor | 19 | validates_presence_of :requestor |
| 17 | 20 |
app/models/user.rb
| @@ -17,15 +17,18 @@ class User < ActiveRecord::Base | @@ -17,15 +17,18 @@ class User < ActiveRecord::Base | ||
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | # FIXME ugly workaround | 19 | # FIXME ugly workaround |
| 20 | - def self.human_attribute_name(attrib, options={}) | 20 | + def self.human_attribute_name_with_customization(attrib, options={}) |
| 21 | case attrib.to_sym | 21 | case attrib.to_sym |
| 22 | when :login | 22 | when :login |
| 23 | return [_('Username'), _('Email')].join(' / ') | 23 | return [_('Username'), _('Email')].join(' / ') |
| 24 | when :email | 24 | when :email |
| 25 | return _('e-Mail') | 25 | return _('e-Mail') |
| 26 | - else _(self.superclass.human_attribute_name(attrib)) | 26 | + else _(self.human_attribute_name_without_customization(attrib)) |
| 27 | end | 27 | end |
| 28 | end | 28 | end |
| 29 | + class << self | ||
| 30 | + alias_method_chain :human_attribute_name, :customization | ||
| 31 | + end | ||
| 29 | 32 | ||
| 30 | before_create do |user| | 33 | before_create do |user| |
| 31 | if user.environment.nil? | 34 | if user.environment.nil? |