Ivan - Add language icon for custom responses [skip ci]

This commit is contained in:
ivan 2016-10-11 20:48:35 -03:00
parent b306d1cd9b
commit 23ccc17a85
3 changed files with 21 additions and 3 deletions

View File

@ -28,7 +28,7 @@ class LanguageSelector extends React.Component {
return {
className: this.getClass(),
items: this.getLanguageList(),
selectedIndex: languages.map((key) => codeLanguages[key]).indexOf(this.getPropLanguage()),
selectedIndex: this.getSelectedIndex(),
onChange: this.changeLanguage.bind(this)
};
}
@ -52,6 +52,12 @@ class LanguageSelector extends React.Component {
});
}
getSelectedIndex() {
let selectedIndex = languages.map((key) => codeLanguages[key]).indexOf(this.getPropLanguage());
return (selectedIndex != -1) ? selectedIndex : undefined;
}
getPropLanguage() {
let language = this.props.language;

View File

@ -2,8 +2,9 @@ import React from 'react';
import {connect} from 'react-redux';
import i18n from 'lib-app/i18n';
import AdminDataActions from 'actions/admin-data-actions';
import Icon from 'core-components/icon';
import Header from 'core-components/header';
import Listing from 'core-components/listing';
import Loading from 'core-components/loading';
@ -60,7 +61,14 @@ class AdminPanelCustomResponses extends React.Component {
getItems() {
return this.props.items.map((item) => {
return {
content: item.name
content: (
<span>
{item.name}
<span className="admin-panel-custom-responses__item-flag">
<Icon name={(item.language != 'en') ? item.language : 'us'}/>
</span>
</span>
)
};
});
}

View File

@ -2,4 +2,8 @@
&__loading {
height: 300px;
}
&__item-flag {
float: right;
}
}