Extract helper i18n-yes-no.

This commit is contained in:
Claas Augner 2016-12-28 11:45:41 +01:00
parent 8760f13c77
commit e17bd6174c
No known key found for this signature in database
GPG Key ID: 63E8BCF5EB1A35AE
2 changed files with 7 additions and 42 deletions

View File

@ -175,13 +175,7 @@
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n 'admin.users.active'}}</div> <div class='field'>{{i18n 'admin.users.active'}}</div>
<div class='value'> <div class='value'>{{i18n-yes-no model.active}}</div>
{{#if model.active}}
{{i18n 'yes_value'}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'> <div class='controls'>
{{#if model.active}} {{#if model.active}}
{{#if model.can_deactivate}} {{#if model.can_deactivate}}
@ -221,13 +215,7 @@
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n 'admin.user.admin'}}</div> <div class='field'>{{i18n 'admin.user.admin'}}</div>
<div class='value'> <div class='value'>{{i18n-yes-no model.admin}}</div>
{{#if model.admin}}
{{i18n 'yes_value'}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'> <div class='controls'>
{{#if model.can_revoke_admin}} {{#if model.can_revoke_admin}}
{{d-button action="revokeAdmin" icon="shield" label="admin.user.revoke_admin"}} {{d-button action="revokeAdmin" icon="shield" label="admin.user.revoke_admin"}}
@ -240,13 +228,7 @@
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n 'admin.user.moderator'}}</div> <div class='field'>{{i18n 'admin.user.moderator'}}</div>
<div class='value'> <div class='value'>{{i18n-yes-no model.moderator}}</div>
{{#if model.moderator}}
{{i18n 'yes_value'}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'> <div class='controls'>
{{#if model.can_revoke_moderation}} {{#if model.can_revoke_moderation}}
{{d-button action="revokeModeration" icon="shield" label="admin.user.revoke_moderation"}} {{d-button action="revokeModeration" icon="shield" label="admin.user.revoke_moderation"}}
@ -284,13 +266,7 @@
<div class="display-row {{if model.isSuspended 'highlight-danger'}}"> <div class="display-row {{if model.isSuspended 'highlight-danger'}}">
<div class='field'>{{i18n 'admin.user.suspended'}}</div> <div class='field'>{{i18n 'admin.user.suspended'}}</div>
<div class='value'> <div class='value'>{{i18n-yes-no model.isSuspended}}</div>
{{#if model.isSuspended}}
{{i18n 'yes_value'}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'> <div class='controls'>
{{#if model.isSuspended}} {{#if model.isSuspended}}
{{d-button class="btn-danger" action="unsuspend" icon="ban" label="admin.user.unsuspend"}} {{d-button class="btn-danger" action="unsuspend" icon="ban" label="admin.user.unsuspend"}}
@ -321,13 +297,7 @@
<div class="display-row {{if model.blocked 'highlight-danger'}}"> <div class="display-row {{if model.blocked 'highlight-danger'}}">
<div class='field'>{{i18n 'admin.user.blocked'}}</div> <div class='field'>{{i18n 'admin.user.blocked'}}</div>
<div class='value'> <div class='value'>{{i18n-yes-no model.blocked}}</div>
{{#if model.blocked}}
{{i18n 'yes_value'}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'> <div class='controls'>
{{#conditional-loading-spinner size="small" condition=model.blockingUser}} {{#conditional-loading-spinner size="small" condition=model.blockingUser}}
{{#if model.blocked}} {{#if model.blocked}}
@ -343,13 +313,7 @@
<div class="display-row"> <div class="display-row">
<div class='field'>{{i18n 'admin.user.staged'}}</div> <div class='field'>{{i18n 'admin.user.staged'}}</div>
<div class='value'> <div class='value'>{{i18n-yes-no model.staged}}</div>
{{#if model.staged}}
{{i18n 'yes_value'}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'>{{i18n 'admin.user.staged_explanation'}}</div> <div class='controls'>{{i18n 'admin.user.staged_explanation'}}</div>
</div> </div>
</section> </section>

View File

@ -1,3 +1,4 @@
import { registerUnbound } from 'discourse-common/lib/helpers'; import { registerUnbound } from 'discourse-common/lib/helpers';
registerUnbound('i18n', (key, params) => I18n.t(key, params)); registerUnbound('i18n', (key, params) => I18n.t(key, params));
registerUnbound('i18n-yes-no', (value, params) => I18n.t(value ? 'yes_value' : 'no_value', params));