PLT-7 adding loc feature to preview

Этот коммит содержится в:
=Corey Hulen
2016-01-22 09:27:27 -06:00
родитель da1d52d546
Коммит 058d6b2467
2 изменённых файлов: 43 добавлений и 37 удалений

Просмотреть файл

@@ -5,6 +5,7 @@ import {savePreferences} from '../../utils/client.jsx';
import SettingItemMin from '../setting_item_min.jsx'; import SettingItemMin from '../setting_item_min.jsx';
import SettingItemMax from '../setting_item_max.jsx'; import SettingItemMax from '../setting_item_max.jsx';
import Constants from '../../utils/constants.jsx'; import Constants from '../../utils/constants.jsx';
const PreReleaseFeatures = Constants.PRE_RELEASE_FEATURES;
import PreferenceStore from '../../stores/preference_store.jsx'; import PreferenceStore from '../../stores/preference_store.jsx';
import ManageLanguages from './manage_languages.jsx'; import ManageLanguages from './manage_languages.jsx';
import * as Utils from '../../utils/utils.jsx'; import * as Utils from '../../utils/utils.jsx';
@@ -294,44 +295,46 @@ export default class UserSettingsDisplay extends React.Component {
); );
} }
if (this.props.activeSection === 'languages') { if (Utils.isFeatureEnabled(PreReleaseFeatures.LOC_PREVIEW)) {
var inputs = []; if (this.props.activeSection === 'languages') {
inputs.push( var inputs = [];
<ManageLanguages inputs.push(
user={this.props.user} <ManageLanguages
key='languages-ui' user={this.props.user}
/> key='languages-ui'
); />
);
languagesSection = ( languagesSection = (
<SettingItemMax <SettingItemMax
title={'Language'} title={'Language'}
width='medium' width='medium'
inputs={inputs} inputs={inputs}
updateSection={(e) => { updateSection={(e) => {
this.updateSection(''); this.updateSection('');
e.preventDefault(); e.preventDefault();
}} }}
/> />
); );
} else { } else {
var locale = 'English'; var locale = 'English';
Utils.languages().forEach((l) => { Utils.languages().forEach((l) => {
if (l.value === this.props.user.locale) { if (l.value === this.props.user.locale) {
locale = l.name; locale = l.name;
} }
}); });
languagesSection = ( languagesSection = (
<SettingItemMin <SettingItemMin
title={'Language'} title={'Language'}
width='medium' width='medium'
describe={locale} describe={locale}
updateSection={() => { updateSection={() => {
this.updateSection('languages'); this.updateSection('languages');
}} }}
/> />
); );
}
} }
return ( return (
@@ -367,7 +370,6 @@ export default class UserSettingsDisplay extends React.Component {
{nameFormatSection} {nameFormatSection}
<div className='divider-dark'/> <div className='divider-dark'/>
{languagesSection} {languagesSection}
<div className='divider-dark'/>
</div> </div>
</div> </div>
); );

Просмотреть файл

@@ -451,6 +451,10 @@ export default {
EMBED_PREVIEW: { EMBED_PREVIEW: {
label: 'embed_preview', label: 'embed_preview',
description: 'Show preview snippet of links below message' description: 'Show preview snippet of links below message'
},
LOC_PREVIEW: {
label: 'loc_preview',
description: 'Show user language in display settings'
} }
}, },
OVERLAY_TIME_DELAY: 400, OVERLAY_TIME_DELAY: 400,