small bugfixes

This commit is contained in:
Cássio Zen 2016-10-10 16:10:55 -03:00
parent 2815a86e0c
commit ff0949e417
3 changed files with 22 additions and 18 deletions

View File

@ -60,7 +60,6 @@
"jest-cli": "^15.1.1",
"js-yaml": "^3.5.3",
"lint-staged": "^3.0.2",
"moment": "^2.11.2",
"node-sass": "^3.10.0",
"normalizr": "^2.0.0",
"npm-check": "^5.2.3",
@ -68,10 +67,7 @@
"postcss-import": "^8.1.2",
"postcss-loader": "^0.9.1",
"pre-commit": "^1.1.3",
"react": "^15.1.0",
"react-dom": "^15.1.0",
"react-hot-loader": "^3.0.0-beta.2",
"react-immutable-proptypes": "^1.6.0",
"react-lazy-load": "^3.0.3",
"react-pure-render": "^1.0.2",
"react-redux": "^4.4.0",
@ -105,9 +101,14 @@
"lodash": "^4.13.1",
"markup-it": "git+https://github.com/cassiozen/markup-it.git",
"material-design-icons": "^3.0.1",
"moment": "^2.11.2",
"normalize.css": "^4.2.0",
"pluralize": "^3.0.0",
"prismjs": "^1.5.1",
"react": "^15.1.0",
"react-dom": "^15.1.0",
"react-hot-loader": "^3.0.0-beta.2",
"react-immutable-proptypes": "^1.6.0",
"react-addons-css-transition-group": "^15.3.1",
"react-datetime": "^2.6.0",
"react-portal": "^2.2.1",

View File

@ -47,17 +47,17 @@ export default class GitHub {
}));
});
return Promise.all(promises);
}).then((entries) => ({
pagination: {},
entries
}).then(entries => ({
pagination: 0,
entries,
}));
}
// Will fetch the entire list of entries from github.
lookupEntry(collection, slug) {
return this.entries(collection).then((response) => (
response.entries.filter((entry) => entry.slug === slug)[0]
return this.entries(collection).then(response => (
response.entries.filter(entry => entry.slug === slug)[0]
));
}
@ -93,14 +93,14 @@ export default class GitHub {
}).then((entries) => {
return {
pagination: {},
entries
entries,
};
});
}
unpublishedEntry(collection, slug) {
return this.unpublishedEntries().then((response) => (
response.entries.filter((entry) => (
return this.unpublishedEntries().then(response => (
response.entries.filter(entry => (
entry.metaData && entry.metaData.collection === collection.get('name') && entry.slug === slug
))[0]
));

View File

@ -16,6 +16,9 @@ class UnpublishedListing extends React.Component {
};
requestPublish = (collection, slug, ownStatus) => {
console.log('HERE');
console.log(ownStatus);
console.log(status.last());
if (ownStatus !== status.last()) return;
if (window.confirm('Are you sure you want to publish this entry?')) {
this.props.handlePublish(collection, slug, ownStatus);
@ -39,12 +42,12 @@ class UnpublishedListing extends React.Component {
/* eslint-enable */
));
} else {
return <div>
{entries.map(entry => {
return (<div>
{entries.map((entry) => {
// Look for an "author" field. Fallback to username on backend implementation;
const author = entry.getIn(['data', 'author'], entry.getIn(['metaData', 'user']));
const timeStamp = moment(entry.getIn(['metaData', 'timeStamp'])).format('llll');
const link = `/editorialworkflow/${entry.getIn(['metaData', 'collection'])}/${entry.getIn(['metaData', 'status'])}/${entry.get('slug')}`;
const link = `/editorialworkflow/${ entry.getIn(['metaData', 'collection']) }/${ entry.getIn(['metaData', 'status']) }/${ entry.get('slug') }`;
const slug = entry.get('slug');
const ownStatus = entry.getIn(['metaData', 'status']);
const collection = entry.getIn(['metaData', 'collection']);
@ -56,7 +59,7 @@ class UnpublishedListing extends React.Component {
<span className={styles.cardHeading}><Link to={link}>{entry.getIn(['data', 'title'])}</Link> <small>by {author}</small></span>
<p className={styles.cardText}>Last updated: {timeStamp} by {entry.getIn(['metaData', 'user'])}</p>
{(ownStatus === status.last()) &&
<button className={styles.button} onClick={this.requestPublish.bind(this, collection, slug, status)}>Publish now</button>
<button className={styles.button} onClick={this.requestPublish.bind(this, collection, slug, ownStatus)}>Publish now</button>
}
</Card>
</div>
@ -65,7 +68,7 @@ class UnpublishedListing extends React.Component {
);
}
)}
</div>;
</div>);
}
};
@ -81,7 +84,7 @@ class UnpublishedListing extends React.Component {
<div className={styles.clear}>
<h1>Editorial Workflow</h1>
<div className={styles.container}>
{columns}
{columns}
</div>
</div>
);