From 6109e1ac730619c44d9a7ffb1c5c9ace64678095 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Jan 2017 01:42:48 -0300 Subject: [PATCH] Ivan - Add article list for no user system [skip ci] --- client/src/app-components/topic-viewer.js | 2 +- client/src/app/Routes.js | 1 + .../dashboard-article-page.js | 33 +++++++++++++++---- .../dashboard-article-page.scss | 4 +++ .../dashboard-list-articles-page.js | 33 +++++++++++++++---- .../dashboard-list-articles-page.scss | 4 +++ .../main/main-home/main-home-page-portal.js | 2 +- 7 files changed, 64 insertions(+), 15 deletions(-) diff --git a/client/src/app-components/topic-viewer.js b/client/src/app-components/topic-viewer.js index 2009da8c..d54164ff 100644 --- a/client/src/app-components/topic-viewer.js +++ b/client/src/app-components/topic-viewer.js @@ -105,7 +105,7 @@ class TopicViewer extends React.Component { {article.title} - + {(this.props.editable) ? : null} ); } diff --git a/client/src/app/Routes.js b/client/src/app/Routes.js index 70bcdcad..192fd723 100644 --- a/client/src/app/Routes.js +++ b/client/src/app/Routes.js @@ -70,6 +70,7 @@ export default ( + diff --git a/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.js b/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.js index f5d8b509..27062bf6 100644 --- a/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.js +++ b/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.js @@ -1,5 +1,6 @@ import React from 'react'; import _ from 'lodash'; +import classNames from 'classnames'; import {connect} from 'react-redux'; import ArticlesActions from 'actions/articles-actions'; @@ -10,6 +11,7 @@ import DateTransformer from 'lib-core/date-transformer'; import Header from 'core-components/header'; import Loading from 'core-components/loading'; import BreadCrumb from 'core-components/breadcrumb'; +import Widget from 'core-components/widget'; class DashboardArticlePage extends React.Component { @@ -32,12 +34,20 @@ class DashboardArticlePage extends React.Component { } render() { + let Wrapper = 'div'; + + if(_.startsWith(this.props.location.pathname, '/article/')) { + Wrapper = Widget; + } + return ( -
-
- -
- {(this.props.loading) ? : this.renderContent()} +
+ +
+ +
+ {(this.props.loading) ? : this.renderContent()} +
); } @@ -62,6 +72,15 @@ class DashboardArticlePage extends React.Component {
); } + + getClass() { + let classes = { + 'dashboard-article-page': true, + 'dashboard-article-page_wrapped': _.startsWith(this.props.location.pathname, '/article/') + }; + + return classNames(classes); + } findArticle() { let article = null; @@ -91,11 +110,11 @@ class DashboardArticlePage extends React.Component { let article = this.findArticle(); let topic = this.findTopic(); let items = [ - {content: i18n('ARTICLES'), url: '/dashboard/articles'} + {content: i18n('ARTICLES'), url: (_.startsWith(this.props.location.pathname, '/article/')) ? '/articles' : '/dashboard/articles'} ]; if(topic && topic.name) { - items.push({content: topic.name, url: '/dashboard/articles'}); + items.push({content: topic.name, url: (_.startsWith(this.props.location.pathname, '/article/')) ? '/articles' : '/dashboard/articles'}); } if(article && article.title) { diff --git a/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.scss b/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.scss index b165a2cd..aa91618e 100644 --- a/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.scss +++ b/client/src/app/main/dashboard/dashboard-article/dashboard-article-page.scss @@ -5,4 +5,8 @@ text-align: right; margin-top: 20px; } + + &_wrapped { + padding: 0 15px; + } } \ No newline at end of file diff --git a/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.js b/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.js index da942c22..f7c434e8 100644 --- a/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.js +++ b/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.js @@ -1,4 +1,5 @@ import React from 'react'; +import classNames from 'classnames'; import {connect} from 'react-redux'; import _ from 'lodash'; import {Link} from 'react-router'; @@ -9,6 +10,7 @@ import ArticlesActions from 'actions/articles-actions'; import Header from 'core-components/header'; import SearchBox from 'core-components/search-box'; +import Widget from 'core-components/widget'; class DashboardListArticlesPage extends React.Component { @@ -22,18 +24,28 @@ class DashboardListArticlesPage extends React.Component { } render() { + let Wrapper = 'div'; + + if(this.props.location.pathname == '/articles') { + Wrapper = Widget; + } + return ( -
-
- - {(!this.state.showSearchResults) ? this.renderArticleList() : this.renderSearchResults()} +
+ +
+ + {(!this.state.showSearchResults) ? this.renderArticleList() : this.renderSearchResults()} +
); } renderArticleList() { + let articlePath = (this.props.location.pathname == '/articles') ? '/article/' : '/dashboard/article/'; + return ( - + ); } @@ -53,7 +65,7 @@ class DashboardListArticlesPage extends React.Component { return (
- {item.title} + {item.title}
{content}
{item.topic}
@@ -61,6 +73,15 @@ class DashboardListArticlesPage extends React.Component { ); } + getClass() { + let classes = { + 'dashboard-list-articles-page': true, + 'dashboard-list-articles-page_wrapped': (this.props.location.pathname == '/articles') + }; + + return classNames(classes); + } + onSearch(query) { this.setState({ results: SearchBox.searchQueryInList(this.getArticles(), query, this.isQueryInTitle.bind(this), this.isQueryInContent.bind(this)), diff --git a/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.scss b/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.scss index 418797af..709461c1 100644 --- a/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.scss +++ b/client/src/app/main/dashboard/dashboard-list-articles/dashboard-list-articles-page.scss @@ -29,4 +29,8 @@ text-transform: uppercase; } } + + &_wrapped { + padding: 0 15px; + } } \ No newline at end of file diff --git a/client/src/app/main/main-home/main-home-page-portal.js b/client/src/app/main/main-home/main-home-page-portal.js index 3935e0d7..a27916de 100644 --- a/client/src/app/main/main-home/main-home-page-portal.js +++ b/client/src/app/main/main-home/main-home-page-portal.js @@ -61,7 +61,7 @@ class MainHomePagePortal extends React.Component { icon: 'book', color: 'blue', buttonText: (this.props.type === 'complete') ? i18n('VIEW_ARTICLES') : null, - onButtonClick: () => browserHistory.push('/view-articles') + onButtonClick: () => browserHistory.push('/articles') }; }