Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #206, show authors, issues & articles editors in Dialog boxes on admin site #217

Merged
merged 9 commits into from
Oct 5, 2017
Next Next commit
fix for #206, add scroll to author & article pages
  • Loading branch information
flakybot2077 committed Sep 25, 2017
commit 7dea9bf315c6402ace78f06352240224cd68bf8b
13 changes: 12 additions & 1 deletion src/components/editor/EditorArticleController.jsx
Original file line number Diff line number Diff line change
@@ -119,6 +119,17 @@ export default class EditorArticleController extends FalcorController {
// The update wasn't due to a change in article
this.debouncedHandleFormStateChanges();
}
// scroll to article editor once page loads
const { hash } = window.location;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, you have good knowledge of ES6 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the comments. Didn't find the Router code at first glance, thanks for pointing me to it! Will update later tonight or tomorrow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, just write a comment on the PR when you're ready for another review

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even better, if we're trying to enforce the Zenhub workflow I just did what I should've done and moved the issue and PR back to in progress, and when you're ready for review just move them back into Review/QA

if (hash) {
setTimeout(() => {
const id = hash.replace('#', '');
const element = document.getElementById(id);
if (element) {
element.scrollIntoView();
}
}, 0);
}
}

handleSaveChanges(event) {
@@ -349,7 +360,7 @@ export default class EditorArticleController extends FalcorController {
}

return (
<div style={styles.innerPaper}>
<div style={styles.innerPaper} id="article-editor">
<h2>Article Editor: {article.title}</h2>
<Divider />
<TextField
4 changes: 2 additions & 2 deletions src/components/editor/EditorArticleListController.jsx
Original file line number Diff line number Diff line change
@@ -65,14 +65,14 @@ export default class EditorArticleListController extends FalcorController {

clickSearchSuggestion(article) {
const page = this.props.params.page;
const path = `/articles/page/${page}/slug/${article.slug}`;
const path = `/articles/page/${page}/slug/${article.slug}#article-editor`;
browserHistory.push(path);
}

createListElement(article) {
const page = this.props.params.page;
return (
<Link to={`/articles/page/${page}/slug/${article.slug}`} key={article.slug}>
<Link to={`/articles/page/${page}/slug/${article.slug}#article-editor`} key={article.slug}>
<ListItem
primaryText={article.title}
secondaryText={
13 changes: 12 additions & 1 deletion src/components/editor/EditorAuthorController.jsx
Original file line number Diff line number Diff line change
@@ -127,6 +127,17 @@ export default class EditorAuthorController extends FalcorController {
// The update wasn't due to a change in article
this.debouncedHandleFormStateChanges();
}
// scroll to author profile once page loads
const { hash } = window.location;
if (hash) {
setTimeout(() => {
const id = hash.replace('#', '');
const element = document.getElementById(id);
if (element) {
element.scrollIntoView();
}
}, 0);
}
}

handleSaveChanges(event) {
@@ -245,7 +256,7 @@ export default class EditorAuthorController extends FalcorController {
}

return (
<div style={styles.authorProfile}>
<div style={styles.authorProfile} id="author-profile">
<h3>Author Profile: {this.state.name}</h3>
<Divider />
<form onSubmit={this.handleSaveChanges}>
2 changes: 1 addition & 1 deletion src/components/editor/EditorAuthorListController.jsx
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ export default class EditorAuthorListController extends FalcorController {
}

handleClickAuthor(author) {
browserHistory.push(`/authors/${author.slug}`);
browserHistory.push(`/authors/${author.slug}#author-profile`);
}

handleCreateAuthorChange() {