Fix conflicts

This commit is contained in:
Pierre Burgy 2017-08-17 10:11:41 +02:00
commit 40bb048072
247 changed files with 471 additions and 8959 deletions

1
.gitignore vendored
View File

@ -92,6 +92,7 @@ results
build
node_modules
.node_history
package-lock.json
############################

View File

@ -91,6 +91,7 @@ results
build
node_modules
.node_history
package-lock.json
############################

View File

@ -0,0 +1,3 @@
{
"languages": ["en", "fr"]
}

View File

@ -1,44 +0,0 @@
<ifModule mod_rewrite.c>
#######################################################################
# GENERAL #
#######################################################################
# Make apache follow sym links to files
Options +FollowSymLinks
# If somebody opens a folder, hide all files from the resulting folder list
IndexIgnore */*
#######################################################################
# REWRITING #
#######################################################################
# Enable rewriting
RewriteEngine On
# If its not HTTPS
RewriteCond %{HTTPS} off
# Comment out the RewriteCond above, and uncomment the RewriteCond below if you're using a load balancer (e.g. CloudFlare) for SSL
# RewriteCond %{HTTP:X-Forwarded-Proto} !https
# Redirect to the same URL with https://, ignoring all further rules if this one is in effect
RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [R,L]
# If we get to here, it means we are on https://
# If the file with the specified name in the browser doesn't exist
RewriteCond %{REQUEST_FILENAME} !-f
# and the directory with the specified name in the browser doesn't exist
RewriteCond %{REQUEST_FILENAME} !-d
# and we are not opening the root already (otherwise we get a redirect loop)
RewriteCond %{REQUEST_FILENAME} !\/$
# Rewrite all requests to the root
RewriteRule ^(.*) /
</ifModule>

View File

@ -1,66 +0,0 @@
##
# Put this file in /etc/nginx/conf.d folder and make sure
# you have line 'include /etc/nginx/conf.d/*.conf;'
# in your main nginx configuration file
##
##
# Redirect to the same URL with https://
##
server {
listen 80;
# Type your domain name below
server_name example.com;
return 301 https://$server_name$request_uri;
}
##
# HTTPS configurations
##
server {
listen 443;
# Type your domain name below
server_name example.com;
ssl on;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/server.key;
# Use only TSL protocols for more secure
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# Always serve index.html for any request
location / {
# Set path
root /var/www/;
try_files $uri /index.html;
}
##
# If you want to use Node/Rails/etc. API server
# on the same port (443) config Nginx as a reverse proxy.
# For security reasons use a firewall like ufw in Ubuntu
# and deny port 3000/tcp.
##
# location /api/ {
#
# proxy_pass http://localhost:3000;
# proxy_http_version 1.1;
# proxy_set_header X-Forwarded-Proto https;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
#
# }
}

View File

@ -6,12 +6,6 @@
*/
import 'babel-polyfill';
/* eslint-disable import/no-unresolved */
// Load the manifest.json file and the .htaccess file
import '!file?name=[name].[ext]!./manifest.json';
import 'file?name=[name].[ext]!./.htaccess';
/* eslint-enable import/no-unresolved */
// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
@ -25,7 +19,7 @@ import NotificationProvider from 'containers/NotificationProvider';
import configureStore from './store';
// Import i18n messages
import { translationMessages } from './i18n';
import { translationMessages, languages } from './i18n';
// Import the CSS reset, which HtmlWebpackPlugin transfers to the build folder
import 'sanitize.css/sanitize.css';
@ -115,34 +109,30 @@ import { pluginLoaded, updatePlugin } from './containers/App/actions';
* @param params
*/
const registerPlugin = (plugin) => {
const formattedPlugin = plugin;
// Add routes
// Initial list of routes
const homeRoute = rootRoute.childRoutes[0];
const pluginsRoute = _.find(homeRoute.childRoutes, { name: 'plugins' });
// Create a new prefixed route for each plugin routes
if (plugin && plugin.routes) {
plugin.routes.forEach(route => {
if (formattedPlugin && formattedPlugin.routes) {
formattedPlugin.routes.forEach(route => {
pluginsRoute.childRoutes.push({
path: `/plugins/${plugin.id}${route.path}`,
name: `plugins_${plugin.id}_${route.name}`,
path: `/plugins/${formattedPlugin.id}${route.path}`,
name: `plugins_${formattedPlugin.id}_${route.name}`,
getComponent: route.getComponent,
});
});
}
// TMP
// setTimeout(() => {
// store.dispatch(showNotification('Plugin loaded!', 'success'));
// store.dispatch(showNotification('Oooooops!', 'warning'));
// store.dispatch(showNotification('An error occurred!', 'error'));
// store.dispatch(showNotification('Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis earum fugiat inventore iste. Accusantium cumque dolor ducimus esse ex fugiat natus nulla qui ratione ullam vero, voluptas voluptate? Officia, tempora!', 'info'));
// }, 500);
// Merge admin translation messages
_.merge(translationMessages, plugin.translationMessages);
_.merge(translationMessages, formattedPlugin.translationMessages);
store.dispatch(pluginLoaded(plugin));
formattedPlugin.leftMenuSections = formattedPlugin.leftMenuSections || [];
store.dispatch(pluginLoaded(formattedPlugin));
};
import { showNotification } from './containers/NotificationProvider/actions';
@ -176,11 +166,12 @@ window.Strapi = {
translationMessages: (translationMessagesUpdated) => {
render(_.merge({}, translationMessages, translationMessagesUpdated));
},
leftMenuLinks: (leftMenuLinksUpdated) => {
store.dispatch(updatePlugin(pluginId, 'leftMenuLinks', leftMenuLinksUpdated));
leftMenuSections: (leftMenuSectionsUpdated) => {
store.dispatch(updatePlugin(pluginId, 'leftMenuSections', leftMenuSectionsUpdated));
},
}),
router: browserHistory,
languages,
};
const dispatch = store.dispatch;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

View File

@ -1,11 +0,0 @@
// import Header from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<Header />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -5,12 +5,11 @@
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { defineMessages, FormattedMessage } from 'react-intl';
import styles from './styles.scss';
import LocaleToggle from 'containers/LocaleToggle';
import messages from './messages.json';
import { define } from '../../i18n';
define(messages);
defineMessages(messages);
class LeftMenuFooter extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {

View File

@ -1,11 +0,0 @@
// import LeftMenuFooter from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<LeftMenuFooter />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
// import LeftMenuHeader from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<LeftMenuHeader />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -7,21 +7,10 @@
import React from 'react';
import styles from './styles.scss';
import { Link } from 'react-router';
import LeftMenuSubLinkContainer from 'components/LeftMenuSubLinkContainer';
import _ from 'lodash';
class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
let subLinksContainer;
if (this.props.leftMenuLinks && this.props.leftMenuLinks.size) {
subLinksContainer = (
<LeftMenuSubLinkContainer
subLinks={this.props.leftMenuLinks}
destinationPrefix={this.props.destination}
/>
);
}
// We need to create our own active url checker,
// because of the two levels router.
const isLinkActive = _.startsWith(window.location.pathname.replace('/admin', ''), this.props.destination);
@ -32,7 +21,6 @@ class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer
<i className={`${styles.linkIcon} fa-${this.props.icon} fa`}></i>
<span className={styles.linkLabel}>{this.props.label}</span>
</Link>
{subLinksContainer}
</li>
);
}
@ -43,7 +31,7 @@ LeftMenuLink.propTypes = {
label: React.PropTypes.string,
destination: React.PropTypes.string,
isActive: React.PropTypes.bool,
leftMenuLinks: React.PropTypes.object,
leftMenuSections: React.PropTypes.object,
};
export default LeftMenuLink;

View File

@ -2,29 +2,27 @@
@import "../../styles/variables/variables";
.link {
padding-top: 1rem;
padding-bottom: 0.2rem;
padding-top: .8rem;
padding-bottom: 0.4rem;
padding-left: 1.6rem;
min-height: 4rem;
border-left: 0.4rem solid transparent;
min-height: 3.6rem;
border-left: 0.3rem solid transparent;
cursor: pointer;
color: $left-menu-link-color;
text-decoration: none;
display: block;
&:hover {
color: $white;
background: $left-menu-link-hover;
border-left: 0.4rem solid $strapi-blue;
}
&:hover {
color: $left-menu-link-color;
border-left: 0.3rem solid $strapi-blue;
text-decoration: none;
}
}
.linkActive {
border-left: 0.4rem solid $strapi-blue;
color: $white;
border-left: 0.3rem solid $strapi-blue;
}
.linkIcon {
@ -32,8 +30,9 @@
margin-right: 1.2rem;
vertical-align: middle;
font-size: 1.2rem;
width: 1.2rem;
padding-bottom: 0.4rem;
width: 1.4rem;
height: 1.2rem;
padding-bottom: 0.2rem;
text-align: center;
}

View File

@ -1,11 +0,0 @@
// import LeftMenuLink from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<LeftMenuLink />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -10,28 +10,55 @@ import styles from './styles.scss';
class LeftMenuLinkContainer extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
// Generate the list of sections
const linkSections = this.props.plugins.valueSeq().map(plugin => (
plugin.get('leftMenuSections').map((leftMenuSection, j) => {
const sectionlinks = leftMenuSection.get('links').map((sectionLink, k) => (
<LeftMenuLink
key={k}
icon={sectionLink.get('icon') || 'link'}
label={sectionLink.get('label')}
destination={`/plugins/${plugin.get('id')}/${sectionLink.get('destination')}`}
/>
));
return (
<div key={j}>
<p className={styles.title}>{leftMenuSection.get('name')}</p>
<ul className={styles.list}>
{sectionlinks}
</ul>
</div>
);
})
));
// List of links
let links = this.props.plugins.valueSeq().map((plugin) => (
let pluginsLinks = this.props.plugins.valueSeq().map((plugin) => (
<LeftMenuLink
key={plugin.get('id')}
icon={plugin.get('icon') || 'plug'}
label={plugin.get('name')}
destination={`/plugins/${plugin.get('id')}`}
leftMenuLinks={plugin.get('leftMenuLinks')}
/>
));
// Check if the plugins list is empty or not
if (!links.size) {
links = <span className={styles.noPluginsInstalled}>No plugins installed yet.</span>;
if (!pluginsLinks.size) {
pluginsLinks = <span className={styles.noPluginsInstalled}>No plugins installed yet.</span>;
}
return (
<div className={styles.leftMenuLinkContainer}>
{linkSections}
<div>
<p className={styles.title}>Plugins</p>
<ul className={styles.list}>
{links}
{pluginsLinks}
</ul>
</div>
<div>
<p className={styles.title}>General</p>
<ul className={styles.list}>
<LeftMenuLink
@ -51,6 +78,7 @@ class LeftMenuLinkContainer extends React.Component { // eslint-disable-line rea
/>
</ul>
</div>
</div>
);
}
}

View File

@ -2,24 +2,25 @@
@import "../../styles/variables/variables";
.leftMenuLinkContainer { /* stylelint-ignore */
padding-top: 1.4rem;
padding-top: .6rem;
}
.title {
padding-left: 2rem;
padding-right: 1.6rem;
padding-top: 1.2rem;
margin-bottom: 1rem;
margin-bottom: .6rem;
color: $left-menu-title-color;
text-transform: uppercase;
font-size: 1.1rem;
letter-spacing: .1rem;
letter-spacing: .2rem;
font-weight: 600;
}
.list {
list-style: none;
padding: 0;
margin-bottom: 2.2rem;
margin-bottom: 2rem;
}
.noPluginsInstalled {

View File

@ -1,11 +0,0 @@
// import LeftMenuLinkContainer from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<LeftMenuLinkContainer />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,28 +0,0 @@
/**
*
* LeftMenuLink
*
*/
import React from 'react';
import styles from './styles.scss';
import { Link } from 'react-router';
class LeftMenuSubLink extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<li className={styles.leftMenuLink}>
<Link className={styles.link} to={this.props.destination} activeClassName={styles.linkActive}>
<span className={styles.linkLabel}>{this.props.label}</span>
</Link>
</li>
);
}
}
LeftMenuSubLink.propTypes = {
label: React.PropTypes.string,
destination: React.PropTypes.string,
};
export default LeftMenuSubLink;

View File

@ -1,31 +0,0 @@
// Import
@import "../../styles/variables/variables";
.leftMenuLink { /* stylelint-ignore */
padding-top: 0.5rem;
padding-bottom: 0.2rem;
min-height: 3rem;
cursor: pointer;
font-size: 1.2rem;
}
.link {
color: $left-menu-link-color;
padding-left: 5.8rem;
text-decoration: none;
display: block;
&:hover {
color: $white;
text-decoration: none;
}
}
.linkActive {
color: $white;
}
.linkLabel {
display: inline-block;
padding-right: 1rem;
}

View File

@ -1,11 +0,0 @@
// import LeftMenuLink from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<LeftMenuSubLink />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,35 +0,0 @@
/**
*
* LeftMenuLinkContainer
*
*/
import React from 'react';
import LeftMenuSubLink from 'components/LeftMenuSubLink';
import styles from './styles.scss';
class LeftMenuSubLinkContainer extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
// List of links
let links = this.props.subLinks.map((subLink, i) => (
<LeftMenuSubLink
key={i}
label={subLink.get('label')}
destination={`${this.props.destinationPrefix}/${subLink.get('to')}`}
/>
));
return (
<ul className={styles.list}>
{links}
</ul>
);
}
}
LeftMenuSubLinkContainer.propTypes = {
subLinks: React.PropTypes.object,
destinationPrefix: React.PropTypes.string,
};
export default LeftMenuSubLinkContainer;

View File

@ -1,28 +0,0 @@
// Import
@import "../../styles/variables/variables";
.leftMenuLinkContainer { /* stylelint-ignore */
padding-top: 2.2rem;
}
.title {
//min-height: 3rem;
padding-left: 1.6rem;
padding-right: 1.6rem;
margin-bottom: 1rem;
color: $left-menu-title-color;
text-transform: uppercase;
}
.list {
list-style: none;
padding: 0;
margin-bottom: 0.9rem;
}
.noPluginsInstalled {
color: $white;
padding-left: 1.6rem;
padding-right: 1.6rem;
font-weight: 300;
}

View File

@ -1,11 +0,0 @@
// import LeftMenuLinkContainer from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<LeftMenuLinkContainer />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,10 +1,11 @@
/**
*
* Notification
*
*/
*
* Notification
*
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import styles from './styles.scss';
@ -44,7 +45,7 @@ class Notification extends React.Component { // eslint-disable-line react/prefer
<icon className={`ion ${options.icon} ${styles.notificationIcon}`}></icon>
<p className={styles.notificationContent}>
<span className={styles.notificationTitle}>{options.title}: </span>
<span>{this.props.notification.message}</span>
<span><FormattedMessage id={this.props.notification.message} /></span>
</p>
<icon className={`ion ion-ios-close-empty pull-right ${styles.notificationClose}`} onClick={this.onCloseClicked}></icon>
</li>

View File

@ -1,11 +0,0 @@
// import Notification from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<Notification />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
// import NotificationsContainer from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<NotificationsContainer />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
// import Plugin from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<Plugin />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
// import PluginHeader from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<PluginHeader />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -18,7 +18,7 @@ class PluginHeaderActions extends React.Component { // eslint-disable-line react
onClick={action.onClick}
disabled={action.disabled}
>
<FormattedMessage {...action.label} />
<FormattedMessage id={action.label} />
</button>
));

View File

@ -1,11 +0,0 @@
// import PluginHeaderActions from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<PluginHeaderActions />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(false);
});
});

View File

@ -14,7 +14,7 @@ class PluginHeaderTitle extends React.Component { // eslint-disable-line react/p
return (
<div className={styles.pluginHeaderTitle}>
<h1 className={styles.pluginHeaderTitleName}>
<FormattedMessage {...this.props.title} />
<FormattedMessage id={this.props.title} />
</h1>
<p className={styles.pluginHeaderTitleDescription}>
<FormattedMessage {...this.props.description} />

View File

@ -1,11 +0,0 @@
// import PluginHeaderTitle from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<PluginHeaderTitle />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,29 +0,0 @@
import Toggle from '../index';
import expect from 'expect';
import { shallow } from 'enzyme';
import { IntlProvider, defineMessages } from 'react-intl';
import React from 'react';
describe('<Toggle />', () => {
it('should contain default text', () => {
const defaultEnMessage = 'someContent';
const defaultDeMessage = 'someOtherContent';
const messages = defineMessages({
en: {
id: 'app.components.LocaleToggle.en',
defaultMessage: defaultEnMessage,
},
de: {
id: 'app.components.LocaleToggle.en',
defaultMessage: defaultDeMessage,
},
});
const renderedComponent = shallow(
<IntlProvider locale="en">
<Toggle values={['en', 'de']} messages={messages} />
</IntlProvider>
);
expect(renderedComponent.contains(<Toggle values={['en', 'de']} messages={messages} />)).toEqual(true);
});
});

View File

@ -1,24 +0,0 @@
import ToggleOption from '../index';
import expect from 'expect';
import { shallow } from 'enzyme';
import { IntlProvider, defineMessages } from 'react-intl';
import React from 'react';
describe('<ToggleOption />', () => {
it('should render default language messages', () => {
const defaultEnMessage = 'someContent';
const message = defineMessages({
enMessage: {
id: 'app.components.LocaleToggle.en',
defaultMessage: defaultEnMessage,
},
});
const renderedComponent = shallow(
<IntlProvider locale="en">
<ToggleOption value="en" message={message.enMessage} />
</IntlProvider>
);
expect(renderedComponent.contains(<ToggleOption value="en" message={message.enMessage} />)).toEqual(true);
});
});

View File

@ -27,7 +27,6 @@ export class App extends React.Component { // eslint-disable-line react/prefer-s
<div>
<NotificationsContainer onHideNotification={this.props.onHideNotification} notifications={this.props.notifications}></NotificationsContainer>
<div className={styles.container}>
<div className={styles.baseline}></div>
{React.Children.toArray(this.props.children)}
</div>
</div>

View File

@ -9,17 +9,3 @@
.container {
display: block;
}
.baseline {
display: none;
z-index: 100001;
opacity: .2;
position: absolute;
top:0; left:0;
width: 100%;
height: 500%;
min-height: 100%;
//background: url('../../assets/images/baseline-18.png');
background: url('../../assets/images/baseline-20.png');
pointer-events: none;
}

View File

@ -1,16 +0,0 @@
import { fromJS } from 'immutable';
import expect from 'expect';
import { selectLocationState } from 'containers/App/selectors';
describe('selectLocationState', () => {
it('should select the route as a plain JS object', () => {
const route = fromJS({
locationBeforeTransitions: null,
});
const mockedState = fromJS({
route,
});
expect(selectLocationState()(mockedState)).toEqual(route.toJS());
});
});

View File

@ -1,11 +0,0 @@
// import ComingSoonPage from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<ComingSoonPage />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(false);
});
});

View File

@ -1,11 +0,0 @@
// import Content from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<Content />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
// import HomePage from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<HomePage />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
// import LeftMenu from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<LeftMenu />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -8,7 +8,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { selectLocale } from '../LanguageProvider/selectors';
import { changeLocale } from '../LanguageProvider/actions';
import { appLocales } from '../../i18n';
import { languages } from '../../i18n';
import { createSelector } from 'reselect';
import styles from './styles.scss';
import Toggle from 'components/Toggle';
@ -16,11 +16,11 @@ import Toggle from 'components/Toggle';
export class LocaleToggle extends React.Component { // eslint-disable-line
render() {
const messages = {};
appLocales.forEach(locale => { messages[locale] = locale.toUpperCase(); });
languages.forEach(locale => { messages[locale] = locale.toUpperCase(); });
return (
<div className={styles.localeToggle}>
<Toggle values={appLocales} messages={messages} onToggle={this.props.onLocaleToggle} />
<Toggle values={languages} messages={messages} onToggle={this.props.onLocaleToggle} />
</div>
);
}

View File

@ -1,60 +0,0 @@
import LocaleToggle, { mapDispatchToProps } from '../index';
import { changeLocale } from '../../LanguageProvider/actions';
import LanguageProvider from '../../LanguageProvider';
import expect from 'expect';
import { shallow, mount } from 'enzyme';
import configureStore from '../../../store';
import React from 'react';
import { Provider } from 'react-redux';
import { browserHistory } from 'react-router';
import { translationMessages } from '../../../i18n';
describe('<LocaleToggle />', () => {
let store;
before(() => {
store = configureStore({}, browserHistory);
});
it('should render the default language messages', () => {
const renderedComponent = shallow(
<Provider store={store}>
<LanguageProvider messages={translationMessages}>
<LocaleToggle />
</LanguageProvider>
</Provider>
);
expect(renderedComponent.contains(<LocaleToggle />)).toEqual(true);
});
it('should present the default `en` english language option', () => {
const renderedComponent = mount(
<Provider store={store}>
<LanguageProvider messages={translationMessages}>
<LocaleToggle />
</LanguageProvider>
</Provider>
);
expect(renderedComponent.contains(<option value="en">EN</option>)).toEqual(true);
});
describe('mapDispatchToProps', () => {
describe('onLocaleToggle', () => {
it('should be injected', () => {
const dispatch = expect.createSpy();
const result = mapDispatchToProps(dispatch);
expect(result.onLocaleToggle).toExist();
});
it('should dispatch changeLocale when called', () => {
const dispatch = expect.createSpy();
const result = mapDispatchToProps(dispatch);
const locale = 'de';
const evt = { target: { value: locale } };
result.onLocaleToggle(evt);
expect(dispatch).toHaveBeenCalledWith(changeLocale(locale));
});
});
});
});

View File

@ -10,15 +10,13 @@
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { defineMessages, FormattedMessage } from 'react-intl';
import styles from './styles.scss';
import { Link } from 'react-router';
import messages from './messages.json';
import { define } from '../../i18n';
define(messages);
defineMessages(messages);
export default class NotFound extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div className={styles.notFound}>

View File

@ -1,24 +0,0 @@
import expect from 'expect';
import {
showNotification,
} from '../actions';
import {
SHOW_NOTIFICATION,
} from '../constants';
describe('NotificationProvider actions', () => {
describe('Default Action', () => {
it('has a type of SHOW_NOTIFICATION', () => {
const message = 'Well done!';
const status = 'success';
const expected = {
type: SHOW_NOTIFICATION,
message,
status,
id: 1,
};
expect(showNotification(expected.message, expected.status)).toEqual(expected);
});
});
});

View File

@ -1,11 +0,0 @@
// import NotificationProvider from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<NotificationProvider />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
import expect from 'expect';
import notificationProviderReducer from '../reducer';
import { fromJS } from 'immutable';
describe('notificationProviderReducer', () => {
it('returns the initial state', () => {
expect(notificationProviderReducer(undefined, {})).toEqual(fromJS({
notifications: [],
}));
});
});

View File

@ -1,11 +0,0 @@
// import { selectNotificationProviderDomain } from '../selectors';
// import { fromJS } from 'immutable';
import expect from 'expect';
// const selector = selectNotificationProviderDomain();
describe('selectNotificationProviderDomain', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -1,11 +0,0 @@
// import PluginPage from '../index';
import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
describe('<PluginPage />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true);
});
});

View File

@ -5,34 +5,54 @@
*
*/
import { addLocaleData, defineMessages } from 'react-intl';
import { addLocaleData } from 'react-intl';
import { reduce } from 'lodash';
import enTranslationMessages from './translations/en.json';
import frTranslationMessages from './translations/fr.json';
// Import config
import { languages } from '../../config/admin.json';
import enLocaleData from 'react-intl/locale-data/en';
import frLocaleData from 'react-intl/locale-data/fr';
addLocaleData(enLocaleData);
addLocaleData(frLocaleData);
const appLocales = [
'en',
'fr',
];
const translationMessages = {
en: enTranslationMessages,
fr: frTranslationMessages,
/**
* Try to require translation file.
*
* @param language {String}
*/
const requireTranslations = language => {
try {
return require(`./translations/${language}.json`); // eslint-disable-line global-require
} catch (error) {
console.error(`Unable to load "${language}" translation. Please make sure "${language}.json" file exists in "admin/public/app/translations" folder.`);
return false;
}
};
const define = messages => {
defineMessages(messages);
/**
* Try to require the language in `react-intl` locale data
* and add locale data if it has been found.
*
* @param language {String}
*/
const addLanguageLocaleData = language => {
try {
const localeData = require(`react-intl/locale-data/${language}`); // eslint-disable-line global-require
addLocaleData(localeData);
return true;
} catch (error) {
console.error(`It looks like the language "${language}" is not supported by "react-intl" module.`);
return false;
}
};
/**
* Dynamically generate `translationsMessages object`.
*/
const translationMessages = reduce(languages, (result, language) => {
const obj = result;
obj[language] = requireTranslations(language);
addLanguageLocaleData(language);
return obj;
}, {});
export {
appLocales,
define,
languages,
translationMessages,
};

View File

@ -1,33 +0,0 @@
{
"name": "React Boilerplate",
"icons": [
{
"src": "favicon.png",
"sizes": "48x48",
"type": "image/png",
"density": 1.0
},
{
"src": "favicon.png",
"sizes": "96x96",
"type": "image/png",
"density": 2.0
},
{
"src": "favicon.png",
"sizes": "144x144",
"type": "image/png",
"density": 3.0
},
{
"src": "favicon.png",
"sizes": "192x192",
"type": "image/png",
"density": 4.0
}
],
"start_url": "index.html",
"display": "standalone",
"orientation": "portrait",
"background_color": "#FFFFFF"
}

View File

@ -1,217 +1,146 @@
/* Webfont: Lato-Black */@font-face {
font-family: 'LatoWebBlack';
src: url('styles/fonts/lato/Lato-Black.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Black.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Black.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Black.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Black.ttf') format('truetype');
/* Lato (hairline, regular) */
@font-face {
font-family: Lato;
font-weight: 100;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-hairline/lato-hairline.woff2") format("woff2"), url("styles/fonts/lato/lato-hairline/lato-hairline.woff") format("woff");
}
/* Webfont: Lato-BlackItalic */@font-face {
font-family: 'LatoWebBlack';
src: url('styles/fonts/lato/Lato-BlackItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-BlackItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-BlackItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-BlackItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-BlackItalic.ttf') format('truetype');
/* Lato (hairline, italic) */
@font-face {
font-family: Lato;
font-weight: 100;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-hairline-italic/lato-hairline-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-hairline-italic/lato-hairline-italic.woff") format("woff");
}
/* Webfont: Lato-Bold */@font-face {
font-family: 'LatoWebBold';
src: url('styles/fonts/lato/Lato-Bold.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Bold.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Bold.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Bold.ttf') format('truetype');
/* Lato (thin, regular) */
@font-face {
font-family: Lato;
font-weight: 200;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-thin/lato-thin.woff2") format("woff2"), url("styles/fonts/lato/lato-thin/lato-thin.woff") format("woff");
}
/* Webfont: Lato-BoldItalic */@font-face {
font-family: 'LatoWebBold';
src: url('styles/fonts/lato/Lato-BoldItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-BoldItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-BoldItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-BoldItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-BoldItalic.ttf') format('truetype');
/* Lato (thin, italic) */
@font-face {
font-family: Lato;
font-weight: 200;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-thin-italic/lato-thin-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-thin-italic/lato-thin-italic.woff") format("woff");
}
/* Webfont: Lato-Hairline */@font-face {
font-family: 'LatoWebHairline';
src: url('styles/fonts/lato/Lato-Hairline.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Hairline.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Hairline.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Hairline.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Hairline.ttf') format('truetype');
/* Lato (light, regular) */
@font-face {
font-family: Lato;
font-weight: 300;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-light/lato-light.woff2") format("woff2"), url("styles/fonts/lato/lato-light/lato-light.woff") format("woff");
}
/* Webfont: Lato-HairlineItalic */@font-face {
font-family: 'LatoWebHairline';
src: url('styles/fonts/lato/Lato-HairlineItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-HairlineItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-HairlineItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-HairlineItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-HairlineItalic.ttf') format('truetype');
/* Lato (light, italic) */
@font-face {
font-family: Lato;
font-weight: 300;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-light-italic/lato-light-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-light-italic/lato-light-italic.woff") format("woff");
}
/* Webfont: Lato-Heavy */@font-face {
font-family: 'LatoWebHeavy';
src: url('styles/fonts/lato/Lato-Heavy.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Heavy.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Heavy.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Heavy.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Heavy.ttf') format('truetype');
/* Lato (normal, regular) */
@font-face {
font-family: Lato;
font-weight: 400;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-normal/lato-normal.woff2") format("woff2"), url("styles/fonts/lato/lato-normal/lato-normal.woff") format("woff");
}
/* Webfont: Lato-HeavyItalic */@font-face {
font-family: 'LatoWebHeavy';
src: url('styles/fonts/lato/Lato-HeavyItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-HeavyItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-HeavyItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-HeavyItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-HeavyItalic.ttf') format('truetype');
/* Lato (normal, italic) */
@font-face {
font-family: Lato;
font-weight: 400;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-normal-italic/lato-normal-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-normal-italic/lato-normal-italic.woff") format("woff");
}
/* Webfont: Lato-Italic */@font-face {
font-family: 'LatoWeb';
src: url('styles/fonts/lato/Lato-Italic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Italic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Italic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Italic.ttf') format('truetype');
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
}
/* Webfont: Lato-Light */@font-face {
font-family: 'LatoWebLight';
src: url('styles/fonts/lato/Lato-Light.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Light.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Light.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Light.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Light.ttf') format('truetype');
/* Lato (medium, regular) */
@font-face {
font-family: "Lato Medium";
font-weight: 400;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-medium/lato-medium.woff2") format("woff2"), url("styles/fonts/lato/lato-medium/lato-medium.woff") format("woff");
}
/* Webfont: Lato-LightItalic */@font-face {
font-family: 'LatoWebLight';
src: url('styles/fonts/lato/Lato-LightItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-LightItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-LightItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-LightItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-LightItalic.ttf') format('truetype');
/* Lato (medium, italic) */
@font-face {
font-family: "Lato Medium";
font-weight: 400;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-medium-italic/lato-medium-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-medium-italic/lato-medium-italic.woff") format("woff");
}
/* Webfont: Lato-Medium */@font-face {
font-family: 'LatoWebMedium';
src: url('styles/fonts/lato/Lato-Medium.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Medium.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Medium.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Medium.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Medium.ttf') format('truetype');
/* Lato (semibold, regular) */
@font-face {
font-family: Lato;
font-weight: 500;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-semibold/lato-semibold.woff2") format("woff2"), url("styles/fonts/lato/lato-semibold/lato-semibold.woff") format("woff");
}
/* Webfont: Lato-MediumItalic */@font-face {
font-family: 'LatoWebMedium';
src: url('styles/fonts/lato/Lato-MediumItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-MediumItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-MediumItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-MediumItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-MediumItalic.ttf') format('truetype');
/* Lato (semibold, italic) */
@font-face {
font-family: Lato;
font-weight: 500;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-semibold-italic/lato-semibold-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-semibold-italic/lato-semibold-italic.woff") format("woff");
}
/* Webfont: Lato-Regular */@font-face {
font-family: 'LatoWeb';
src: url('styles/fonts/lato/Lato-Regular.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Regular.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Regular.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Regular.ttf') format('truetype');
/* Lato (bold, regular) */
@font-face {
font-family: Lato;
font-weight: 600;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-bold/lato-bold.woff2") format("woff2"), url("styles/fonts/lato/lato-bold/lato-bold.woff") format("woff");
}
/* Webfont: Lato-Semibold */@font-face {
font-family: 'LatoWebSemibold';
src: url('styles/fonts/lato/Lato-Semibold.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Semibold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Semibold.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Semibold.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Semibold.ttf') format('truetype');
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
}
/* Webfont: Lato-SemiboldItalic */@font-face {
font-family: 'LatoWebSemibold';
src: url('styles/fonts/lato/Lato-SemiboldItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-SemiboldItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-SemiboldItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-SemiboldItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-SemiboldItalic.ttf') format('truetype');
/* Lato (bold, italic) */
@font-face {
font-family: Lato;
font-weight: 600;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-bold-italic/lato-bold-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-bold-italic/lato-bold-italic.woff") format("woff");
}
/* Webfont: Lato-Thin */@font-face {
font-family: 'LatoWebThin';
src: url('styles/fonts/lato/Lato-Thin.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-Thin.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-Thin.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Thin.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-Thin.ttf') format('truetype');
/* Lato (heavy, regular) */
@font-face {
font-family: Lato;
font-weight: 800;
font-style: normal;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-heavy/lato-heavy.woff2") format("woff2"), url("styles/fonts/lato/lato-heavy/lato-heavy.woff") format("woff");
}
/* Webfont: Lato-ThinItalic */@font-face {
font-family: 'LatoWebThin';
src: url('styles/fonts/lato/Lato-ThinItalic.eot'); /* IE9 Compat Modes */
src: url('styles/fonts/lato/Lato-ThinItalic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('styles/fonts/lato/Lato-ThinItalic.woff2') format('woff2'), /* Modern Browsers */
url('styles/fonts/lato/Lato-ThinItalic.woff') format('woff'), /* Modern Browsers */
url('styles/fonts/lato/Lato-ThinItalic.ttf') format('truetype');
/* Lato (heavy, italic) */
@font-face {
font-family: Lato;
font-weight: 800;
font-style: italic;
font-weight: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-heavy-italic/lato-heavy-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-heavy-italic/lato-heavy-italic.woff") format("woff");
}
/* Lato (black, regular) */
@font-face {
font-family: Lato;
font-weight: 900;
font-style: normal;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-black/lato-black.woff2") format("woff2"), url("styles/fonts/lato/lato-black/lato-black.woff") format("woff");
}
/* Lato (black, italic) */
@font-face {
font-family: Lato;
font-weight: 900;
font-style: italic;
text-rendering: optimizeLegibility;
src: url("styles/fonts/lato/lato-black-italic/lato-black-italic.woff2") format("woff2"), url("styles/fonts/lato/lato-black-italic/lato-black-italic.woff") format("woff");
}
@font-face {

Some files were not shown because too many files have changed in this diff Show More