Skip to content

Commit

Permalink
Merge pull request #431 from Datawheel/refactor-flatten
Browse files Browse the repository at this point in the history
[CMS] Everything is a Multi-lingual Topic
  • Loading branch information
davelandry committed Feb 13, 2019
2 parents ca92271 + 2953709 commit 0cccafa
Show file tree
Hide file tree
Showing 101 changed files with 5,340 additions and 3,817 deletions.
6 changes: 3 additions & 3 deletions packages/cms/app/components/Loading.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
top: 0;
width: 100%;
z-index: 100;
& .pt-non-ideal-state-visual {
& .bp3-non-ideal-state-visual {
max-width: 200px;
width: 100%;
& .pt-progress-meter {
& .bp3-progress-meter {
background-color: var(--accent);
}
}
& .pt-non-ideal-state-title {
& .bp3-non-ideal-state-title {
color: var(--foreground);
}
}
20 changes: 10 additions & 10 deletions packages/cms/app/pages/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import libs from "../../src/utils/libs";
class Profile extends Component {

getChildContext() {
const {formatters, profile, router} = this.props;
const {formatters, locale, profile, router} = this.props;
const {variables} = profile;
return {
formatters: formatters.reduce((acc, d) => {
Expand All @@ -18,21 +18,19 @@ class Profile extends Component {
return acc;
}, {}),
router,
variables
variables,
locale
};
}

render() {
const {sections, title} = this.props.profile;
const {topics, title} = this.props.profile;
return (
<div id="Profile">
<h1 dangerouslySetInnerHTML={{__html: title}} />
{sections.map(section => {
const {id, topics} = section;
return <div key={id}>
<h2 dangerouslySetInnerHTML={{__html: section.title}} />
{ topics.map(topic => <Topic key={topic.slug} contents={topic} />) }
</div>;
{topics.map(topic => {
const {slug} = topic;
return <Topic key={slug} contents={topic} />;
})}
</div>
);
Expand All @@ -42,16 +40,18 @@ class Profile extends Component {

Profile.childContextTypes = {
formatters: PropTypes.object,
locale: PropTypes.string,
router: PropTypes.object,
variables: PropTypes.object
};

Profile.need = [
fetchData("profile", "/api/profile/<pslug>/<pid>"),
fetchData("profile", "/api/profile/<pslug>/<pid>?locale=<i18n.locale>"),
fetchData("formatters", "/api/formatters")
];

export default connect(state => ({
formatters: state.data.formatters,
locale: state.i18n.locale,
profile: state.data.profile
}))(Profile);
10 changes: 8 additions & 2 deletions packages/cms/app/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ import Bar from "./pages/Bar";
export default function RouteCreate() {
return (
<Route path="/" component={App} history={browserHistory}>
<IndexRoute component={Search} />
<IndexRoute component={Builder} />
{/*
<Route path="/cms-profile/:profileSlug" component={Builder} />
<Route path="/cms-profile/:profileSlug/:topicSlug" component={Builder} />
<Route path="/cms-story/:storySlug" component={Builder} />
<Route path="/cms-story/:storySlug/:storytopicSlug" component={Builder} />
*/}
<Route path="/profile/:pslug/:pid" component={Profile} />
<Route path="/cms" component={Builder} />
<Route path="/search" component={Search} />
<Route path="/bar" component={Bar} />
</Route>
);
Expand Down
1 change: 1 addition & 0 deletions packages/cms/db/author_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/author_content");
1 change: 1 addition & 0 deletions packages/cms/db/profile_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/profile_content");
1 change: 0 additions & 1 deletion packages/cms/db/profile_footnote.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/cms/db/profile_stat.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/cms/db/section.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/cms/db/section_description.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/cms/db/section_subtitle.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/cms/db/story_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/story_content");
1 change: 1 addition & 0 deletions packages/cms/db/story_description_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/story_description_content");
1 change: 1 addition & 0 deletions packages/cms/db/story_footnote_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/story_footnote_content");
1 change: 1 addition & 0 deletions packages/cms/db/storytopic_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/storytopic_content");
1 change: 1 addition & 0 deletions packages/cms/db/storytopic_description_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/storytopic_description_content");
1 change: 1 addition & 0 deletions packages/cms/db/storytopic_stat_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/storytopic_stat_content");
1 change: 1 addition & 0 deletions packages/cms/db/storytopic_subtitle_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/storytopic_subtitle_content");
1 change: 1 addition & 0 deletions packages/cms/db/topic_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/topic_content");
1 change: 1 addition & 0 deletions packages/cms/db/topic_description_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/topic_description_content");
1 change: 1 addition & 0 deletions packages/cms/db/topic_stat_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/topic_stat_content");
1 change: 1 addition & 0 deletions packages/cms/db/topic_subtitle_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../src/db/topic_subtitle_content");
Loading

0 comments on commit 0cccafa

Please sign in to comment.