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