FIX: badges were not localizing correctly

Overrides were not working
This commit is contained in:
Sam 2016-04-08 17:52:50 +10:00
parent b0ae122fd2
commit 44bf69e3a7
2 changed files with 8 additions and 20 deletions

View file

@ -3,7 +3,7 @@
<div> <div>
<label for="name">{{i18n 'admin.badges.name'}}</label> <label for="name">{{i18n 'admin.badges.name'}}</label>
{{#if readOnly}} {{#if readOnly}}
{{input type="text" name="name" value=buffered.displayName disabled=true}} {{input type="text" name="name" value=buffered.name disabled=true}}
{{else}} {{else}}
{{input type="text" name="name" value=buffered.name}} {{input type="text" name="name" value=buffered.name}}
{{/if}} {{/if}}
@ -45,7 +45,7 @@
<div> <div>
<label for="description">{{i18n 'admin.badges.description'}}</label> <label for="description">{{i18n 'admin.badges.description'}}</label>
{{#if buffered.system}} {{#if buffered.system}}
{{textarea name="description" value=buffered.displayDescription disabled=true}} {{textarea name="description" value=buffered.description disabled=true}}
{{else}} {{else}}
{{textarea name="description" value=buffered.description}} {{textarea name="description" value=buffered.description}}
{{/if}} {{/if}}

View file

@ -158,21 +158,13 @@ SQL
end end
def display_name def display_name
if self.system?
key = "badges.#{i18n_name}.name" key = "badges.#{i18n_name}.name"
I18n.t(key, default: self.name) I18n.t(key, default: self.name)
else
self.name
end
end end
def long_description def long_description
if self[:long_description].present?
self[:long_description]
else
key = "badges.#{i18n_name}.long_description" key = "badges.#{i18n_name}.long_description"
I18n.t(key, default: '') I18n.t(key, default: self[:long_description] || '')
end
end end
def long_description=(val) def long_description=(val)
@ -184,12 +176,8 @@ SQL
end end
def description def description
if self[:description].present?
self[:description]
else
key = "badges.#{i18n_name}.description" key = "badges.#{i18n_name}.description"
I18n.t(key, default: '') I18n.t(key, default: self[:description] || '')
end
end end
def description=(val) def description=(val)