Translate VIEW MORE and VIEW LESS into component strings

This commit is contained in:
kialam
2018-05-31 16:32:34 -04:00
parent 265554accb
commit e66b00eb64
3 changed files with 10 additions and 4 deletions

View File

@@ -52,6 +52,11 @@ function ComponentsStrings (BaseString) {
COPIED: t.s('Copied to clipboard.') COPIED: t.s('Copied to clipboard.')
}; };
ns.toggle = {
VIEW_MORE: t.s('VIEW MORE'),
VIEW_LESS: t.s('VIEW LESS')
};
ns.layout = { ns.layout = {
CURRENT_USER_LABEL: t.s('Logged in as'), CURRENT_USER_LABEL: t.s('Logged in as'),
VIEW_DOCS: t.s('View Documentation'), VIEW_DOCS: t.s('View Documentation'),

View File

@@ -2,11 +2,12 @@ import { TRUNCATED, TRUNCATE_LENGTH } from './constants';
const templateUrl = require('~components/toggle/toggle-tag.partial.html'); const templateUrl = require('~components/toggle/toggle-tag.partial.html');
function controller ($scope, TagService) { function controller ($scope, TagService, strings) {
const { tags } = $scope; const { tags } = $scope;
const vm = this; const vm = this;
vm.truncatedLength = TRUNCATE_LENGTH; vm.truncatedLength = TRUNCATE_LENGTH;
vm.truncated = TRUNCATED; vm.truncated = TRUNCATED;
vm.strings = strings;
vm.toggle = () => { vm.toggle = () => {
vm.truncated = !vm.truncated; vm.truncated = !vm.truncated;
@@ -19,7 +20,7 @@ function controller ($scope, TagService) {
}); });
} }
controller.$inject = ['$scope', 'TagService']; controller.$inject = ['$scope', 'TagService', 'ComponentsStrings'];
function atToggleTag () { function atToggleTag () {
return { return {

View File

@@ -3,12 +3,12 @@
<div ng-repeat="tag in vm.tags | limitTo: vm.truncatedLength"> <div ng-repeat="tag in vm.tags | limitTo: vm.truncatedLength">
<at-tag tag="tag.value" icon="{{ tag.icon }}" link="{{ tag.link }}"></at-tag> <at-tag tag="tag.value" icon="{{ tag.icon }}" link="{{ tag.link }}"></at-tag>
</div> </div>
<button class="ToggleComponent-button" ng-click="vm.toggle()">VIEW MORE</button> <button class="ToggleComponent-button" ng-click="vm.toggle()">{{:: vm.strings.get('toggle.VIEW_MORE') }}</button>
</div> </div>
<div ng-show="!vm.truncated" class="ToggleComponent-container"> <div ng-show="!vm.truncated" class="ToggleComponent-container">
<div ng-repeat="tag in vm.tags"> <div ng-repeat="tag in vm.tags">
<at-tag tag="tag.value" icon="{{ tag.icon }}" link="{{ tag.link }}"></at-tag> <at-tag tag="tag.value" icon="{{ tag.icon }}" link="{{ tag.link }}"></at-tag>
</div> </div>
<button class="ToggleComponent-button" ng-click="vm.toggle()">VIEW LESS</button> <button class="ToggleComponent-button" ng-click="vm.toggle()">{{:: vm.strings.get('toggle.VIEW_LESS') }}</button>
</div> </div>
</div> </div>