UX: The "enable 2FA" string was hard to translate

This commit is contained in:
Gerhard Schlager
2018-05-29 15:47:07 +02:00
parent a8079ab679
commit ce687f334b
6 changed files with 26 additions and 13 deletions

View File

@@ -0,0 +1,18 @@
import { default as computed } from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
tagName: 'span',
@computed("text")
translatedText(text) {
if (text) return I18n.t(text);
},
click(event) {
if (event.target.tagName.toUpperCase() === 'A') {
this.sendAction("action", this.get("actionParam"));
}
return false;
}
});

View File

@@ -4,6 +4,7 @@ import { default as computed } from "ember-addons/ember-computed-decorators";
import PreferencesTabController from "discourse/mixins/preferences-tab-controller";
import { setting } from 'discourse/lib/computed';
import { popupAjaxError } from 'discourse/lib/ajax-error';
import showModal from 'discourse/lib/show-modal';
export default Ember.Controller.extend(CanCheckEmails, PreferencesTabController, {
@@ -41,11 +42,6 @@ export default Ember.Controller.extend(CanCheckEmails, PreferencesTabController,
return !this.siteSettings.enable_sso && this.siteSettings.enable_local_logins;
},
@computed
showTwoFactorModalText() {
return I18n.t('user.second_factor.title').toLowerCase();
},
actions: {
save() {
this.set('saved', false);
@@ -105,6 +101,10 @@ export default Ember.Controller.extend(CanCheckEmails, PreferencesTabController,
}
];
bootbox.dialog(message, buttons, {"classes": "delete-account"});
},
showTwoFactorModal() {
showModal('second-factor-intro');
}
}
});

View File

@@ -15,10 +15,6 @@ export default RestrictedUserRoute.extend({
},
actions: {
showTwoFactorModal() {
showModal('second-factor-intro');
},
showAvatarSelector() {
showModal('avatar-selector');

View File

@@ -0,0 +1 @@
{{{translatedText}}}

View File

@@ -71,9 +71,7 @@
{{#if model.second_factor_enabled}}
{{i18n 'user.second_factor.disable'}}
{{else}}
{{i18n 'enable'}}
<a href {{action "showTwoFactorModal"}}>{{showTwoFactorModalText}}</a>
{{i18n 'user.second_factor.enable'}}
{{discourse-linked-text action="showTwoFactorModal" text="user.second_factor.enable"}}
{{/if}}
{{#if isCurrentUser}}