Merge branch 'master' into feat/modal/add_position
This commit is contained in:
commit
ac9e7c3e12
65 changed files with 982 additions and 934 deletions
45
.eslintrc
45
.eslintrc
|
|
@ -31,38 +31,53 @@
|
|||
"jsx": true
|
||||
},
|
||||
"globals": {
|
||||
"document": false,
|
||||
"window": false,
|
||||
"global": false,
|
||||
"require": false,
|
||||
"expect": false,
|
||||
"should": false,
|
||||
"chai": false,
|
||||
"sinon": false,
|
||||
"Power2": false,
|
||||
"Sine": false,
|
||||
"__DEVELOPMENT__": false
|
||||
},
|
||||
"rules": {
|
||||
"max-len": [0],
|
||||
"new-cap": ["warn", {"capIsNewExceptions": [
|
||||
"Immutable",
|
||||
"Map",
|
||||
"List",
|
||||
"Set",
|
||||
"OrderedSet",
|
||||
"Range",
|
||||
"Moment",
|
||||
"Linker",
|
||||
"Moment"
|
||||
]}],
|
||||
"comma-dangle": ["warn", "always-multiline"], // disallow or enforce trailing commas
|
||||
"curly": ["warn", "multi-or-nest"], // specify curly brace conventions for all control statements
|
||||
"indent": ["warn", 2, {"SwitchCase": 1}], // this option sets a specific tab width for your code (off by default)
|
||||
"indent": ["warn", 2, {
|
||||
"SwitchCase": 1,
|
||||
"MemberExpression": 1,
|
||||
"FunctionDeclaration": {"parameters": "first"},
|
||||
"FunctionExpression": {"parameters": "first"},
|
||||
"CallExpression": {"arguments": 1}
|
||||
}], // this option sets a specific tab width for your code (off by default)
|
||||
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }], // enforce one true brace style (off by default)
|
||||
"key-spacing": ["warn", {"beforeColon": false, "afterColon": true}], // enforces spacing between keys and values in object literal properties
|
||||
"quotes": ["warn", "single", "avoid-escape"], // specify whether double or single quotes should be used
|
||||
"keyword-spacing": ["warn", {"before": true, "after": true}], // require a space after certain keywords (off by default)
|
||||
"no-underscore-dangle": [0],
|
||||
"import/no-extraneous-dependencies": [0], // because broken
|
||||
"import/no-unresolved": [0], // because broken
|
||||
"import/extensions": [0],
|
||||
"import/prefer-default-export": [0],
|
||||
"global-require": [0],
|
||||
"linebreak-style": "off",
|
||||
// React
|
||||
//"computed-property-spacing": ["warn", "never"], // disallow spaces inside computed properties
|
||||
"react/jsx-indent-props": ["warn", 2]
|
||||
"react/jsx-indent-props": ["warn", 2],
|
||||
"react/forbid-prop-types": [0],
|
||||
"react/no-unescaped-entities": [0],
|
||||
"react/no-unused-prop-types": [0], // because broken
|
||||
"react/sort-comp": [1, {
|
||||
"order": [
|
||||
"static-methods",
|
||||
"lifecycle",
|
||||
"/^on.+$/",
|
||||
"everything-else",
|
||||
"/^render.+$/",
|
||||
"render"
|
||||
]
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable import/imports-first */
|
||||
import jquery from 'jquery';
|
||||
global.$ = jquery;
|
||||
global.jQuery = jquery;
|
||||
|
|
|
|||
16
package.json
16
package.json
|
|
@ -12,8 +12,8 @@
|
|||
"copy-mocks": "node scripts/copy-mocks.js",
|
||||
"renderer": "node ./renderer/renderer.js",
|
||||
"clean": "./node_modules/.bin/rimraf ./build integration/main.css integration/static && echo --- Cleaned ---",
|
||||
"lint": "eslint src",
|
||||
"lint-fix": "eslint src --fix",
|
||||
"lint": "eslint --ext .js --ext .jsx src webpack stories",
|
||||
"lint-fix": "npm run lint -- --fix",
|
||||
"test": "jest --coverage",
|
||||
"test-watch": "jest --watch",
|
||||
"e2e-test": "./node_modules/.bin/nightwatch",
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
"@kadira/storybook-addon-knobs": "^1.4.1",
|
||||
"babel-cli": "<6.3.0",
|
||||
"babel-core": "<6.3.0",
|
||||
"babel-eslint": "^6.0.0",
|
||||
"babel-eslint": "^7.1.0",
|
||||
"babel-loader": "~6.2.1",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-plugin-transform-es2015-modules-umd": "^6.8.0",
|
||||
|
|
@ -88,11 +88,11 @@
|
|||
"copy-webpack-plugin": "^2.1.3",
|
||||
"css-loader": "^0.23.0",
|
||||
"enzyme": "^2.3.0",
|
||||
"eslint": "^2.5.3",
|
||||
"eslint-config-airbnb": "^6.2.0",
|
||||
"eslint-plugin-import": "^1.10.2",
|
||||
"eslint-plugin-jsx-a11y": "^1.5.5",
|
||||
"eslint-plugin-react": "^4.2.3",
|
||||
"eslint": "^3.9.1",
|
||||
"eslint-config-airbnb": "^12.0.0",
|
||||
"eslint-plugin-import": "^1.16.0",
|
||||
"eslint-plugin-jsx-a11y": "^2.2.3",
|
||||
"eslint-plugin-react": "^6.5.0",
|
||||
"extract-text-webpack-plugin": "^0.9.1",
|
||||
"file-loader": "^0.8.4",
|
||||
"html-webpack-plugin": "^2.15.0",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
/* eslint-disable jsx-a11y/href-no-hash */
|
||||
import React from 'react';
|
||||
import paths from 'constants/paths';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
const Footer = () => (
|
||||
<footer className="footer">
|
||||
<div className="col-md-1"></div>
|
||||
<div className="col-md-1" />
|
||||
<div className="col-md-3">
|
||||
<small>
|
||||
<a href="#">Crédits</a>
|
||||
|
|
@ -20,7 +21,7 @@ const Footer = () => (
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div className="col-md-1"></div>
|
||||
<div className="col-md-1" />
|
||||
</footer>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable jsx-a11y/href-no-hash */
|
||||
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import paths from 'constants/paths';
|
||||
|
|
@ -6,12 +8,12 @@ const ConnectedUserMenu = ({ user, onLogOut }) => (
|
|||
<li className="dropdown">
|
||||
<a href="#" className="dropdown-toggle" data-toggle="dropdown">
|
||||
{user.name}
|
||||
<b className="caret"></b>
|
||||
<b className="caret" />
|
||||
</a>
|
||||
<ul className="dropdown-menu">
|
||||
<li><Link to={paths.getFor.user(user)}>Profil</Link></li>
|
||||
<li className="divider"></li>
|
||||
<li><a onClick={onLogOut}>Déconnexion</a></li>
|
||||
<li className="divider" />
|
||||
<li><a href="#" onClick={onLogOut}>Déconnexion</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ import cssModules from 'react-css-modules';
|
|||
import { Navbar, Nav, NavItem } from 'react-bootstrap';
|
||||
import { LinkContainer, IndexLinkContainer } from 'react-router-bootstrap';
|
||||
|
||||
import paths from 'constants/paths';
|
||||
|
||||
import ConnectedUserMenu from './';
|
||||
|
||||
import paths from 'constants/paths';
|
||||
import logoImg from './images/logo_header.png';
|
||||
import styles from './Header.css';
|
||||
|
||||
const renderUserMenu = (isConnected) => (
|
||||
const renderUserMenu = isConnected => (
|
||||
isConnected
|
||||
? <ConnectedUserMenu />
|
||||
: [
|
||||
|
|
@ -25,7 +26,7 @@ const Header = () => (
|
|||
<Navbar.Brand>
|
||||
<IndexLinkContainer to="/" styleName="logo">
|
||||
<NavItem>
|
||||
<img src={logoImg} />
|
||||
<img alt="Brand Logo" src={logoImg} />
|
||||
</NavItem>
|
||||
</IndexLinkContainer>
|
||||
</Navbar.Brand>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import React from 'react';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { storiesOf, action, linkTo } from '@kadira/storybook';
|
||||
import { withKnobs, text, boolean, number } from '@kadira/storybook-addon-knobs';
|
||||
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import { curry } from 'ramda';
|
||||
import axios from 'axios';
|
||||
import Config from 'Config';
|
||||
|
|
@ -13,4 +15,3 @@ export const getStatements = () => get('statements');
|
|||
export const getPublicFiguresAutocomplete = typed => get(`autocomplete/public_figure/${typed}`);
|
||||
export const getSubjectsAutocomplete = typed => get(`autocomplete/subject/${typed}`);
|
||||
export const getPositions = subjectId => get(`subjects/${subjectId}/positions`);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
require('bootstrap-loader');
|
||||
import moment from 'moment';
|
||||
import 'bootstrap-loader';
|
||||
|
||||
const locale = 'fr';
|
||||
|
||||
|
|
@ -18,5 +18,6 @@ moment.locale(locale, {
|
|||
if (process.env.NODE_ENV !== 'production') { // DEBUG/DEV MODE
|
||||
const Immutable = require('immutable');
|
||||
const installDevTools = require('immutable-devtools').default;
|
||||
|
||||
installDevTools(Immutable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import AddStatementModal from 'components/AddStatementModal';
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import AddSubjectFrom from './AddSubjectForm';
|
|||
|
||||
const SubjectStep = ({ selected, onSelection }) => (
|
||||
<Well>
|
||||
<<<<<<< HEAD
|
||||
<FormGroup controlId="subjectSelect" validationState={selected && !selected.customOption ? 'success' : undefined}>
|
||||
<ControlLabel>Quel est le sujet qui fait débat ?</ControlLabel>
|
||||
{(!selected || !selected.customOption) &&
|
||||
|
|
@ -16,6 +17,11 @@ const SubjectStep = ({ selected, onSelection }) => (
|
|||
onChange={onSelection}
|
||||
onCancel={() => onSelection(null)}
|
||||
/>}
|
||||
=======
|
||||
<FormGroup controlId="subjectSelect" validationState={!!selected ? 'success' : undefined}>
|
||||
<ControlLabel>Quel est le sujet qui fait débat ?</ControlLabel>
|
||||
<SubjectAutocompleteInput selected={selected} onSelection={onSelection} />
|
||||
>>>>>>> master
|
||||
</FormGroup>
|
||||
</Well>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import {
|
||||
getAddStatementPublicFigure, getAddStatementSubject, getAddStatementPosition,
|
||||
getAddStatementEvidenceUrl, getAddStatementEvidenceFile
|
||||
getAddStatementEvidenceUrl, getAddStatementEvidenceFile,
|
||||
} from 'store/selectors';
|
||||
import {
|
||||
onAddStatementPublicFigureSelection, onAddStatementSubjectSelection, onAddStatementPositionSelection,
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
import React, { PropTypes } from 'react';
|
||||
|
||||
const getText = nb => {
|
||||
const getText = (nb) => {
|
||||
if (nb === 0)
|
||||
return "Aucun sujet actif";
|
||||
return 'Aucun sujet actif';
|
||||
else if (nb > 1)
|
||||
return nb + "sujets actifs";
|
||||
return `${nb}sujets actifs`;
|
||||
|
||||
return "1 sujet actif";
|
||||
return '1 sujet actif';
|
||||
};
|
||||
|
||||
const AssociatedSubjects = ({ publicFigure }) => (
|
||||
<h6 style={{ color: "#f21e40 !important" }}>{getText(publicFigure.nbActiveSubjects)}</h6>
|
||||
<h6 style={{ color: '#f21e40 !important' }}>{getText(publicFigure.nbActiveSubjects)}</h6>
|
||||
);
|
||||
|
||||
AssociatedSubjects.propTypes = {
|
||||
publicFigure: PropTypes.object.isRequired
|
||||
publicFigure: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default AssociatedSubjects;
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
import React from 'react';
|
||||
import { storiesOf, action, linkTo } from '@kadira/storybook';
|
||||
import Identity from './';
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import CSSModules from 'react-css-modules';
|
||||
import cssModules from 'react-css-modules';
|
||||
import Statement from './Statement';
|
||||
import LastStatementsStyle from './LastStatements.css';
|
||||
import connect from './connector';
|
||||
|
|
@ -32,4 +32,4 @@ class LastStatements extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default connect(CSSModules(LastStatements, LastStatementsStyle));
|
||||
export default connect(cssModules(LastStatements, LastStatementsStyle));
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import React, { Component, PropTypes } from 'react';
|
||||
import { head, of, compose, when, prop, not, isNil } from 'ramda';
|
||||
import React, {Component, PropTypes} from 'react';
|
||||
import {head, of, compose, when, prop, not, isNil} from 'ramda';
|
||||
import Typeahead from 'react-bootstrap-typeahead';
|
||||
import { getPublicFiguresAutocomplete } from 'api/debats';
|
||||
import { flattenAttributes } from 'api/jsonApiParser';
|
||||
import {getPublicFiguresAutocomplete} from 'api/debats';
|
||||
import {flattenAttributes} from 'api/jsonApiParser';
|
||||
import PublicFigureAvatar from 'components/PublicFigureAvatar';
|
||||
import { makeCancelable } from 'helpers/promises';
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const PublicFigureAvatar = ({ publicFigure }) => (
|
|||
<div
|
||||
styleName="wrapper"
|
||||
style={{
|
||||
backgroundImage: !!publicFigure.picture
|
||||
backgroundImage: publicFigure.picture
|
||||
? `url(${publicFigure.picture.url})`
|
||||
: undefined,
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
import React from 'react';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
import { storiesOf, action, linkTo } from '@kadira/storybook';
|
||||
import { withKnobs, text, boolean, number } from '@kadira/storybook-addon-knobs';
|
||||
import withReadme from 'storybook-readme/with-readme';
|
||||
|
|
@ -13,7 +13,6 @@ const parseSubjects = raw => pipe(
|
|||
)
|
||||
)(raw.data);
|
||||
|
||||
|
||||
class SubjectAutocompleteInput extends Component {
|
||||
|
||||
static propTypes = {
|
||||
|
|
@ -57,6 +56,24 @@ class SubjectAutocompleteInput extends Component {
|
|||
|
||||
onSelection = compose(this.props.onSelection, head);
|
||||
|
||||
loadSuggestions = (typed) => {
|
||||
if (this.props.selected) this.props.onSelection(null);
|
||||
if (typed.length) {
|
||||
getSubjectsAutocomplete(typed)
|
||||
.then((response) => {
|
||||
this.setState({
|
||||
suggestions: flattenAttributes(response.data.data),
|
||||
});
|
||||
}); }
|
||||
};
|
||||
|
||||
renderMenuItemChildren = (typeaheadProps, subject) => (
|
||||
<div>
|
||||
<p>{subject.title} </p>
|
||||
<small>{take(100)(subject.presentation)}</small>
|
||||
</div>
|
||||
);
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Typeahead
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
const Empty = () => <span />;
|
||||
export default Empty;
|
||||
|
|
@ -3,8 +3,8 @@ export default {
|
|||
subjects: '/s',
|
||||
publicFigures: '/p',
|
||||
getFor: {
|
||||
subject: (s) => `/s/${s.slug}`,
|
||||
publicFigure: (pf) => `/p/${pf.slug}`,
|
||||
subject: s => `/s/${s.slug}`,
|
||||
publicFigure: pf => `/p/${pf.slug}`,
|
||||
},
|
||||
manual: '/guide',
|
||||
about: '/about',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { pipe, always } from 'ramda';
|
||||
import { pipe } from 'ramda';
|
||||
|
||||
const print = message => x => {
|
||||
if (!!message) console.warn(message);
|
||||
const print = message => (x) => {
|
||||
if (message) console.warn(message);
|
||||
return x;
|
||||
};
|
||||
|
||||
const printWithPrefix = (prefix) => (x) => {
|
||||
const printWithPrefix = prefix => (x) => {
|
||||
console.warn('-------------------------------');
|
||||
console.warn(`---- ${prefix}: `, x);
|
||||
return x;
|
||||
|
|
@ -16,5 +16,5 @@ const printAfter = printWithPrefix('AFTER');
|
|||
|
||||
export const withConsole = (f, message) => pipe(printBefore, print(message), f, printAfter);
|
||||
|
||||
export const log = x => { console.log(x); return x; }; /* eslint no-console: 0 */
|
||||
export const warn = x => { console.warn(x); return x; }; /* eslint no-console: 0 */
|
||||
export const log = (x) => { console.log(x); return x; }; /* eslint no-console: 0 */
|
||||
export const warn = (x) => { console.warn(x); return x; }; /* eslint no-console: 0 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { complement } from 'ramda';
|
||||
|
||||
export const hasWindow = () => (typeof window !== 'undefined');
|
||||
export const isClientSide = hasWindow;
|
||||
export const isServerSide = complement(hasWindow);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
import 'react-hot-loader/patch'; // https://github.com/gaearon/redux-devtools/commit/64f58b7010a1b2a71ad16716eb37ac1031f93915
|
||||
import 'babel-polyfill';
|
||||
|
||||
// First boot side effects
|
||||
import './boot.js';
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { AppContainer } from 'react-hot-loader';
|
||||
|
|
@ -11,6 +8,10 @@ import { match } from 'react-router';
|
|||
|
||||
// Styles
|
||||
import 'styles/_main.css';
|
||||
|
||||
// First boot side effects
|
||||
import './boot.js';
|
||||
|
||||
// Redux
|
||||
import { store, history } from './store'; // Redux store
|
||||
import Root from './root'; // App root (Router, Provider, Hot reload ...
|
||||
|
|
@ -20,7 +21,7 @@ import routes from './routes'; // React-router routes
|
|||
const loadApplication = (DOMElementId) => {
|
||||
const DOMElement = document.getElementById(DOMElementId);
|
||||
|
||||
match({ history, routes, location }, () => {
|
||||
match({ history, routes }, () => {
|
||||
ReactDOM.render(
|
||||
<AppContainer>
|
||||
<Root store={store} history={history} />
|
||||
|
|
@ -13,12 +13,12 @@ const Contact = () => (
|
|||
<ul className="list-inline banner-social-buttons">
|
||||
<li>
|
||||
<a href="mailto:contact@debats.co" className="btn btn-default btn-lg">
|
||||
<i className="fa fa-envelope-o fa-fw"></i><span className="network-name"> Courriel</span>
|
||||
<i className="fa fa-envelope-o fa-fw" /><span className="network-name"> Courriel</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/debatsco" className="btn btn-default btn-lg">
|
||||
<i className="fa fa-twitter fa-fw"></i> <span className="network-name">Twitter</span>
|
||||
<i className="fa fa-twitter fa-fw" /> <span className="network-name">Twitter</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import styles from './Guide.css';
|
|||
|
||||
const Guide = () => (
|
||||
<div>
|
||||
<div className="col-md-1"></div>
|
||||
<div className="col-md-1" />
|
||||
<div className="col-md-10">
|
||||
<h1>Mode d'emploi</h1>
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ const Guide = () => (
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-1"></div>
|
||||
<div className="col-md-1" />
|
||||
</div>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import cssModules from 'react-css-modules';
|
||||
import HomeSubjects from './HomeSubjects';
|
||||
import LastStatements from 'components/LastStatements';
|
||||
import HomeSubjects from './HomeSubjects';
|
||||
import bgSrc from './images/intro-bg.jpg';
|
||||
import styles from './Home.css';
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ const Home = () => (
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-1"></div>
|
||||
<div className="col-md-1" />
|
||||
<div className="subjects-index col-md-7 subjects-home">
|
||||
<h1>Sujets d'actualité</h1>
|
||||
<table className="table">
|
||||
|
|
@ -30,7 +30,7 @@ const Home = () => (
|
|||
<div className="col-md-3 col-centered" style={{ textAlign: 'right' }} >
|
||||
<LastStatements />
|
||||
</div>
|
||||
<div className="col-md-1"></div>
|
||||
<div className="col-md-1" />
|
||||
</div>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import React, { PropTypes } from 'react';
|
||||
import paths from '../../../constants/paths';
|
||||
import cssModules from 'react-css-modules';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import paths from 'constants/paths';
|
||||
import PublicFigureAvatar from 'components/PublicFigureAvatar';
|
||||
import AssociatedSubjects from 'components/AssociatedSubjects';
|
||||
|
||||
import PublicFigureStyle from './PublicFigure.css';
|
||||
import cssModules from 'react-css-modules';
|
||||
|
||||
const PublicFigureInList = ({ publicFigure }) => (
|
||||
<table className="table">
|
||||
|
|
@ -16,7 +18,7 @@ const PublicFigureInList = ({ publicFigure }) => (
|
|||
<td>
|
||||
<PublicFigureAvatar publicFigure={publicFigure} />
|
||||
</td>
|
||||
<td style= {{ width: '33%' }}>
|
||||
<td style={{ width: '33%' }}>
|
||||
|
||||
<h2 className="figure-title" style={{ color: '#333333 !important' }}>
|
||||
<Link to={paths.getFor.subject(publicFigure)}>
|
||||
|
|
@ -34,8 +36,8 @@ const PublicFigureInList = ({ publicFigure }) => (
|
|||
</tr>
|
||||
</li>
|
||||
</ul>
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
|
||||
PublicFigureInList.propTypes = {
|
||||
|
|
@ -43,13 +45,3 @@ PublicFigureInList.propTypes = {
|
|||
};
|
||||
|
||||
export default cssModules(PublicFigureInList, PublicFigureStyle);
|
||||
|
||||
/*
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
$(".figure-presentation-text").shorten();
|
||||
|
||||
});
|
||||
</script>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
import LastStatements from 'components/LastStatements';
|
||||
import PublicFigureInList from './PublicFigureInList';
|
||||
import connect from './connector';
|
||||
import LastStatements from 'components/LastStatements';
|
||||
|
||||
class PublicFigures extends Component {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
import React from 'react';
|
||||
import { Route, IndexRoute } from 'react-router';
|
||||
|
||||
// Main Page
|
||||
import Main from 'Main/index';
|
||||
export default (
|
||||
<Route path="/" component={Main}>
|
||||
<IndexRoute
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/Home').default);
|
||||
}, 'home');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path="contact"
|
||||
name="contact"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/Contact').default);
|
||||
}, 'contact');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path="about"
|
||||
name="about"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/About').default);
|
||||
}, 'about');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path="guide"
|
||||
name="guide"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/Guide').default);
|
||||
}, 'guide');
|
||||
}}
|
||||
/>
|
||||
<Route path="s" name="subjects">
|
||||
<IndexRoute
|
||||
name="subjects.index"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/Subjects').default);
|
||||
}, 'subjects.index');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
name="subjects.page"
|
||||
path=":subjectSlug"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/Subject').default);
|
||||
}, 'subjects.page');
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path="p" name="publicFigures">
|
||||
<IndexRoute
|
||||
name="publicFigures.index"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/PublicFigures').default);
|
||||
}, 'publicFigures.index');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
name="publicFigures.page"
|
||||
path=":publicFigureSlug"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], require => {
|
||||
done(null, require('pages/publicFigure').default);
|
||||
}, 'publicFigures.page');
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
);
|
||||
82
src/routes/index.jsx
Normal file
82
src/routes/index.jsx
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
import React from 'react';
|
||||
import { Route, IndexRoute } from 'react-router';
|
||||
|
||||
// Main Page
|
||||
import Main from 'Main/index';
|
||||
|
||||
export default (
|
||||
<Route path="/" component={Main}>
|
||||
<IndexRoute
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/Home').default);
|
||||
}, 'home');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path="contact"
|
||||
name="contact"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/Contact').default);
|
||||
}, 'contact');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path="about"
|
||||
name="about"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/About').default);
|
||||
}, 'about');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path="guide"
|
||||
name="guide"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/Guide').default);
|
||||
}, 'guide');
|
||||
}}
|
||||
/>
|
||||
<Route path="s" name="subjects">
|
||||
<IndexRoute
|
||||
name="subjects.index"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/Subjects').default);
|
||||
}, 'subjects.index');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
name="subjects.page"
|
||||
path=":subjectSlug"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/Subject').default);
|
||||
}, 'subjects.page');
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path="p" name="publicFigures">
|
||||
<IndexRoute
|
||||
name="publicFigures.index"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/PublicFigures').default);
|
||||
}, 'publicFigures.index');
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
name="publicFigures.page"
|
||||
path=":publicFigureSlug"
|
||||
getComponent={(nextState, done) => {
|
||||
require.ensure([], (require) => {
|
||||
done(null, require('pages/publicFigure').default);
|
||||
}, 'publicFigures.page');
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
);
|
||||
|
|
@ -1,25 +1,25 @@
|
|||
import types from '../actions_types';
|
||||
|
||||
export const onAddStatementPublicFigureSelection = (id) => ({
|
||||
export const onAddStatementPublicFigureSelection = id => ({
|
||||
type: types.ADD_STATEMENT_PUBLIC_FIGURE_SELECTION,
|
||||
id
|
||||
id,
|
||||
});
|
||||
export const onAddStatementSubjectSelection = (id) => ({
|
||||
export const onAddStatementSubjectSelection = id => ({
|
||||
type: types.ADD_STATEMENT_SUBJECT_SELECTION,
|
||||
id
|
||||
id,
|
||||
});
|
||||
export const onAddStatementPositionSelection = (id) => ({
|
||||
export const onAddStatementPositionSelection = id => ({
|
||||
type: types.ADD_STATEMENT_POSITION_SELECTION,
|
||||
id
|
||||
id,
|
||||
});
|
||||
|
||||
export const onAddStatementUpdateEvidenceUrl = (url) => ({
|
||||
export const onAddStatementUpdateEvidenceUrl = url => ({
|
||||
type: types.ADD_STATEMENT_UPDATE_EVIDENCE_URL,
|
||||
url
|
||||
url,
|
||||
});
|
||||
export const onAddStatementUpdateEvidenceFile = (file) => ({
|
||||
export const onAddStatementUpdateEvidenceFile = file => ({
|
||||
type: types.ADD_STATEMENT_UPDATE_EVIDENCE_FILE,
|
||||
file
|
||||
file,
|
||||
});
|
||||
|
||||
export const onAddStatementValidate = () => ({
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ export default {
|
|||
ADD_STATEMENT_POSITION_SELECTION: 'ADD_STATEMENT_POSITION_SELECTION',
|
||||
ADD_STATEMENT_UPDATE_EVIDENCE_URL: 'ADD_STATEMENT_UPDATE_EVIDENCE_URL',
|
||||
ADD_STATEMENT_UPDATE_EVIDENCE_FILE: 'ADD_STATEMENT_UPDATE_EVIDENCE_FILE',
|
||||
ADD_STATEMENT_VALIDATE: 'ADD_STATEMENT_PUBLIC_FIGURE_SELECTION',
|
||||
ADD_STATEMENT_VALIDATE: 'ADD_STATEMENT_VALIDATE',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
import { routerReducer, routerMiddleware } from 'react-router-redux';
|
||||
import { routerReducer, routerMiddleware, syncHistoryWithStore } from 'react-router-redux';
|
||||
import { map } from 'ramda';
|
||||
import { isClientSide } from 'helpers/env';
|
||||
import rootSaga from './sagas';
|
||||
import { entitiesReducer, addStatementReducer } from './reducers';
|
||||
|
||||
import { useRouterHistory } from 'react-router';
|
||||
import { syncHistoryWithStore } from 'react-router-redux';
|
||||
import createHashHistory from 'history/lib/createHashHistory';
|
||||
import createMemoryHistory from 'history/lib/createMemoryHistory';
|
||||
|
||||
import rootSaga from './sagas';
|
||||
import { entitiesReducer, addStatementReducer } from './reducers';
|
||||
|
||||
// Build history
|
||||
const createHistory = isClientSide() ? createHashHistory : createMemoryHistory;
|
||||
// const browserHistory = useScroll(useRouterHistory(createHistory))();
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@ const isStatementComplete = allPass([
|
|||
either(
|
||||
compose(not, isNil, prop('evidenceUrl')),
|
||||
compose(not, isNil, prop('evidenceFile')),
|
||||
)
|
||||
),
|
||||
]);
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
const isPublicFigureMissing = complement(isPublicFigureChosen);
|
||||
const isSubjectMissing = complement(isSubjectChosen);
|
||||
const isPositionMissing = complement(isPositionChosen);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import actionsType from '../actions_types';
|
||||
import { map, compose, prop, merge, assoc, not, isNil, pipe, when } from 'ramda';
|
||||
const initialState = {};
|
||||
import { indexAndGroup } from 'api/jsonApiParser';
|
||||
import actionsType from '../actions_types';
|
||||
|
||||
const initialState = {};
|
||||
|
||||
const isNotNil = compose(not, isNil);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { identity } from 'ramda';
|
||||
import actionsTypes from '../actions_types';
|
||||
import { takeEvery } from 'redux-saga';
|
||||
import { call, put } from 'redux-saga/effects';
|
||||
import { getSubjects, getStatements, getPositions } from 'api/debats';
|
||||
|
||||
import actionsTypes from '../actions_types';
|
||||
|
||||
const getApiCallFor = (entityType, entityRequest) => {
|
||||
switch (entityType) {
|
||||
case 'statements': return getStatements;
|
||||
|
|
@ -41,9 +42,8 @@ function* fetchEntityIfNeeded(action) {
|
|||
export function* watchEntityAccess() {
|
||||
yield* takeEvery(actionsTypes.ENTITY_ACCESS, fetchEntityIfNeeded);
|
||||
}
|
||||
|
||||
function* fetchPositionsOfSubject(action) {
|
||||
if (!!action.id) {
|
||||
if (action.id) {
|
||||
// Call API
|
||||
const response = yield call(getPositions, action.id);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ import { watchEntityAccess, watchSubjectSelection } from './apiSaga';
|
|||
export default function* rootSaga() {
|
||||
yield [
|
||||
watchEntityAccess(),
|
||||
watchSubjectSelection()
|
||||
watchSubjectSelection(),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import { createSelector } from 'reselect';
|
|||
import { prop, propEq, find, pipe, dissoc, when, not, isNil, compose } from 'ramda';
|
||||
import { getPublicFigures, getSubjects, getPositions, enrichWithRelationships } from './entities';
|
||||
|
||||
import { withConsole } from 'helpers/debug';
|
||||
|
||||
const isNotNil = compose(not, isNil);
|
||||
|
||||
const getAddState = state => state.addStatement;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { curry, assoc, compose, when, take, path, is, map, isNil, always, values, propEq, ifElse, pipe, find } from 'ramda';
|
||||
|
||||
export const getSubjects = state => values(state.entities.subjects);
|
||||
export const getPositions = state => values(state.entities.positions);
|
||||
export const getStatements = state => values(state.entities.statements);
|
||||
export const getPublicFigures = state => values(state.entities['public-figures']);
|
||||
|
||||
import { withConsole, warn } from 'helpers/debug';
|
||||
|
||||
const getEntityByRef = curry(
|
||||
(sourceEntities, entityReference) => ifElse(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
/* eslint-disable import/export */ // since positions.js is an empty file
|
||||
export * from './positions';
|
||||
|
||||
export * from './publicFigures';
|
||||
export * from './statements';
|
||||
export * from './subjects';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import { values, pipe, compose, map, dissoc, prop } from 'ramda';
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import { values, pipe, compose, map, dissoc } from 'ramda';
|
||||
import { whenNotNil } from 'helpers/ramda-ext';
|
||||
import { createSelector } from 'reselect';
|
||||
import { enrichWithRelationships, getSubjects, getPublicFigures } from './entities';
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { values, pipe, map, compose, dissoc } from 'ramda';
|
|||
import { createSelector } from 'reselect';
|
||||
import { whenNotNil } from 'helpers/ramda-ext';
|
||||
import {
|
||||
enrichWithRelationship, getPublicFigures, getPositions, getSubjects, getStatements
|
||||
enrichWithRelationship, getPublicFigures, getPositions, getSubjects, getStatements,
|
||||
} from './entities';
|
||||
|
||||
const injectPublicFigure = enrichWithRelationship('publicFigure', 'public-figure');
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { values, pipe, compose, map, dissoc, propEq } from 'ramda';
|
||||
import { find, values, pipe, compose, map, dissoc, propEq } from 'ramda';
|
||||
import { createSelector } from 'reselect';
|
||||
import { whenNotNil } from 'helpers/ramda-ext';
|
||||
import { enrichWithRelationships, getPublicFigures, getPositions, getSubjects } from './entities';
|
||||
|
||||
import { withConsole } from 'helpers/debug';
|
||||
import { enrichWithRelationships, getPublicFigures, getPositions, getSubjects } from './entities';
|
||||
|
||||
export const getHomeSubjects = state => values(getSubjects(state));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
import { urlRegex } from './generic';
|
||||
|
||||
export const isValidEvidenceUrl = (tested) => urlRegex.test(tested);
|
||||
export const isValidEvidenceUrl = tested => urlRegex.test(tested);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const CONSTANTS = require('../webpack/constants');
|
||||
|
||||
const APP_PATH = CONSTANTS.APP_PATH;
|
||||
|
||||
const loaders = [
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const postcssHide = require('postcss-hide');
|
|||
|
||||
const CONSTANTS = require('./constants');
|
||||
|
||||
const makeMap = aPath => {
|
||||
const makeMap = (aPath) => {
|
||||
try {
|
||||
return webpackPostcssTools.makeVarMap(aPath);
|
||||
} catch (e) {
|
||||
|
|
@ -24,6 +24,7 @@ const makeMap = aPath => {
|
|||
|
||||
const map = makeMap('./src/styles/_constants.css');
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
module.exports = webpack => [
|
||||
postcssMixins({
|
||||
mixinsDir: path.join(CONSTANTS.APP_PATH, 'style', 'mixins'),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const path = require('path');
|
||||
|
||||
const CONSTANTS = require('./constants');
|
||||
|
||||
const APP_ROOT = CONSTANTS.APP_ROOT;
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ const path = require('path');
|
|||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const CONSTANTS = require('./constants');
|
||||
|
||||
const APP_ROOT = CONSTANTS.APP_ROOT;
|
||||
const SRC_FOLDER = CONSTANTS.SRC_FOLDER;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ const path = require('path');
|
|||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const CONSTANTS = require('./constants');
|
||||
|
||||
const APP_ROOT = CONSTANTS.APP_ROOT;
|
||||
const APP_PATH = CONSTANTS.APP_PATH;
|
||||
const SRC_FOLDER = CONSTANTS.SRC_FOLDER;
|
||||
|
|
@ -34,7 +35,7 @@ config.devtool = 'cheap-module-source-map';
|
|||
config.cache = false;
|
||||
config.debug = false;
|
||||
config.entry = `${APP_PATH}/index.js`;
|
||||
config.output.path = outputPath;;
|
||||
config.output.path = outputPath;
|
||||
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ const config = require('./webpack.base.config');
|
|||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
const CONSTANTS = require('./constants');
|
||||
|
||||
const APP_PATH = CONSTANTS.APP_PATH;
|
||||
const APP_NAME = CONSTANTS.APP_NAME;
|
||||
const SRC_FOLDER = CONSTANTS.SRC_FOLDER;
|
||||
|
|
@ -13,7 +14,7 @@ config.plugins.push(new HtmlWebpackPlugin({
|
|||
filename: 'index.html',
|
||||
}));
|
||||
|
||||
config.entry = `${APP_PATH}/index.js`;
|
||||
config.entry = `${APP_PATH}/index.jsx`;
|
||||
config.output = {
|
||||
filename: `${APP_NAME}.[name].[hash].js`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ const path = require('path');
|
|||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const CONSTANTS = require('./constants');
|
||||
|
||||
const APP_ROOT = CONSTANTS.APP_ROOT;
|
||||
const SRC_FOLDER = CONSTANTS.SRC_FOLDER;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue