diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/index.js
new file mode 100644
index 0000000000..e951d73204
--- /dev/null
+++ b/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/index.js
@@ -0,0 +1,87 @@
+/**
+*
+* RowLanguage
+*
+*/
+
+import React from 'react';
+import { find, get, join, isObject } from 'lodash';
+import { FormattedMessage } from 'react-intl';
+import PopUpWarning from 'components/PopUpWarning';
+// utils
+import getFlag, { formatLanguageLocale } from '../../utils/getFlag';
+
+class RowLanguage extends React.Component { // eslint-disable-line react/prefer-stateless-function
+ constructor(props) {
+ super(props);
+ this.state = {
+ showWarning: false,
+ };
+ }
+
+ deleteLanguage = () => {
+ this.setState({ showWarning: !this.state.showWarning });
+ this.props.handleLanguageDelete(this.props.name);
+ }
+
+ toggleWarning = () => this.setState({ showWarning: !this.state.showWarning });
+
+ render() {
+ // assign the target id the language name to prepare for delete
+ const deleteIcon = this.props.active ? '' : ; // eslint-disable-line jsx-a11y/no-static-element-interactions
+
+ // format the locale to
+ const defaultLanguageArray = formatLanguageLocale(this.props.name);
+ const flag = getFlag(defaultLanguageArray);
+ // retrieve language name from i18n translation
+ const languageObject = find(get(this.props.listLanguages, ['sections', '0', 'items', '0', 'items']), ['value', join(defaultLanguageArray, '_')]);
+ // apply i18n
+ const languageDisplay = isObject(languageObject) ? : '';
+
+ const languageLabel = this.props.active ?
+
+
+ :
+ // set the span's id with the language name to retrieve it
+
+ {(message) => (
+
+ )}
+ ;
+
+ return (
+
+
+
+
{this.props.name}
+
{languageLabel}
+
{deleteIcon}
+
+
+
+ );
+ }
+}
+
+RowLanguage.propTypes = {
+ active: React.PropTypes.bool,
+ changeDefaultLanguage: React.PropTypes.func.isRequired,
+ handleLanguageDelete: React.PropTypes.func.isRequired,
+ listLanguages: React.PropTypes.object.isRequired,
+ liStyles: React.PropTypes.object,
+ name: React.PropTypes.string.isRequired,
+};
+
+export default RowLanguage;
diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/tests/index.test.js b/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/tests/index.test.js
new file mode 100644
index 0000000000..becc7ee066
--- /dev/null
+++ b/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/tests/index.test.js
@@ -0,0 +1,11 @@
+// import RowLanguage from '../index';
+
+import expect from 'expect';
+// import { shallow } from 'enzyme';
+// import React from 'react';
+
+describe('', () => {
+ it('Expect to have unit tests specified', () => {
+ expect(true).toEqual(false);
+ });
+});
diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/Home/index.js b/packages/strapi-plugin-settings-manager/admin/src/containers/Home/index.js
index 4b150e89c4..5c012fa15b 100644
--- a/packages/strapi-plugin-settings-manager/admin/src/containers/Home/index.js
+++ b/packages/strapi-plugin-settings-manager/admin/src/containers/Home/index.js
@@ -10,14 +10,12 @@ import { bindActionCreators } from 'redux';
import { createStructuredSelector } from 'reselect';
import {
- find,
findIndex,
findKey,
forEach,
get,
isEmpty,
includes,
- isObject,
join,
map,
replace,
@@ -36,6 +34,7 @@ import HeaderNav from 'components/HeaderNav';
import List from 'components/List';
import RowDatabase from 'components/RowDatabase';
import SelectOptionLanguage from 'components/SelectOptionLanguage';
+import RowLanguage from 'components/RowLanguage';
// App selectors
import { makeSelectSections, makeSelectEnvironments } from 'containers/App/selectors';
@@ -231,7 +230,7 @@ export class Home extends React.Component { // eslint-disable-line react/prefer-
}
// retrieve the language to delete using the target id
- handleLanguageDelete = ({ target }) => this.props.languageDelete(target.id);
+ handleLanguageDelete = (languaToDelete) => this.props.languageDelete(languaToDelete);
handleDatabaseDelete = (dbName) => {
window.Strapi.notification.success('Deleting database');
@@ -242,45 +241,16 @@ export class Home extends React.Component { // eslint-disable-line react/prefer-
optionComponent = (props) => ;
// custom Row rendering for the component List with params slug === languages
- renderRowLanguage = (props, key, liStyles) => {
- // assign the target id the language name to prepare for delete
- const deleteIcon = props.active ? '' : ; // eslint-disable-line jsx-a11y/no-static-element-interactions
-
- // format the locale to
- const defaultLanguageArray = formatLanguageLocale(props.name);
- const flag = getFlag(defaultLanguageArray);
- // retrieve language name from i18n translation
- const languageObject = find(get(this.props.home.listLanguages, ['sections', '0', 'items', '0', 'items']), ['value', join(defaultLanguageArray, '_')]);
- // apply i18n
- const languageDisplay = isObject(languageObject) ? : '';
-
- const languageLabel = props.active ?
-
-
- :
- // set the span's id with the language name to retrieve it
-
- {(message) => (
-
- )}
- ;
-
- return (
-
-
-
-
{props.name}
-
{languageLabel}
-
{deleteIcon}
-
-
- )
- }
+ renderRowLanguage = (props, key, liStyles) => (
+
+ )
renderListTitle = () => {
const availableContentNumber = this.props.home.configsDisplay.sections.length;
diff --git a/packages/strapi-plugin-settings-manager/admin/src/translations/en.json b/packages/strapi-plugin-settings-manager/admin/src/translations/en.json
index b4c1d1b101..06c692a6c2 100644
--- a/packages/strapi-plugin-settings-manager/admin/src/translations/en.json
+++ b/packages/strapi-plugin-settings-manager/admin/src/translations/en.json
@@ -132,6 +132,7 @@
"popUpWarning.title": "Please confirm",
"popUpWarning.databases.delete.message": "Are you sure you want to delete this connection ?",
+ "popUpWarning.languages.delete.message": "Are you sure you want to delete this language ?",
"language.af": "Afrikaans",
"language.af_NA": "Afrikaans (Namibië)",
diff --git a/packages/strapi-plugin-settings-manager/admin/src/translations/fr.json b/packages/strapi-plugin-settings-manager/admin/src/translations/fr.json
index 94728578f9..43f6496cc0 100644
--- a/packages/strapi-plugin-settings-manager/admin/src/translations/fr.json
+++ b/packages/strapi-plugin-settings-manager/admin/src/translations/fr.json
@@ -131,6 +131,7 @@
"popUpWarning.title": "Merci de confirmer",
"popUpWarning.databases.delete.message": "Etes-vous sûre de vouloir supprimer cette connexion ?",
+ "popUpWarning.languages.delete.message": "Etes-vous sûre de vouloir supprimer ce language ?",
"language.af": "Afrikaans",
"language.af_NA": "Afrikaans (Namibië)",