Ivan - Add article preview [skip ci]
This commit is contained in:
parent
a193acd51a
commit
1174be9e02
|
@ -9,6 +9,7 @@ import DateTransformer from 'lib-core/date-transformer';
|
||||||
|
|
||||||
import Header from 'core-components/header';
|
import Header from 'core-components/header';
|
||||||
import Loading from 'core-components/loading';
|
import Loading from 'core-components/loading';
|
||||||
|
import Button from 'core-components/button';
|
||||||
|
|
||||||
class AdminPanelViewArticle extends React.Component {
|
class AdminPanelViewArticle extends React.Component {
|
||||||
|
|
||||||
|
@ -22,6 +23,10 @@ class AdminPanelViewArticle extends React.Component {
|
||||||
loading: true
|
loading: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
state = {
|
||||||
|
editable: false
|
||||||
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if(SessionStore.getItem('topics')) {
|
if(SessionStore.getItem('topics')) {
|
||||||
this.props.dispatch(ArticlesActions.initArticles());
|
this.props.dispatch(ArticlesActions.initArticles());
|
||||||
|
@ -45,20 +50,37 @@ class AdminPanelViewArticle extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderArticle(article) {
|
renderArticle(article) {
|
||||||
return (
|
return (this.state.editable) ? this.renderArticleEdit(article) : this.renderArticlePreview(article);
|
||||||
<div className="admin-panel-view-article__article">
|
}
|
||||||
<Header title={article.title}/>
|
|
||||||
|
|
||||||
<div className="admin-panel-view-article__content">
|
renderArticlePreview(article) {
|
||||||
<div dangerouslySetInnerHTML={{__html: article.content}}/>
|
return (
|
||||||
|
<div className="admin-panel-view-article__content">
|
||||||
|
<div className="admin-panel-view-article__edit-button">
|
||||||
|
<Button size="medium" onClick={this.onEditClick.bind(this)}>{i18n('EDIT')}</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="admin-panel-view-article__last-edited">
|
|
||||||
{i18n('LAST_EDITED_IN', {date: DateTransformer.transformToString(article.lastEdited)})}
|
<div className="admin-panel-view-article__article">
|
||||||
|
<Header title={article.title}/>
|
||||||
|
|
||||||
|
<div className="admin-panel-view-article__article-content">
|
||||||
|
<div dangerouslySetInnerHTML={{__html: article.content}}/>
|
||||||
|
</div>
|
||||||
|
<div className="admin-panel-view-article__last-edited">
|
||||||
|
{i18n('LAST_EDITED_IN', {date: DateTransformer.transformToString(article.lastEdited)})}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderArticleEdit(article) {
|
||||||
|
//add form
|
||||||
|
return (
|
||||||
|
<div></div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
findArticle() {
|
findArticle() {
|
||||||
let article = null;
|
let article = null;
|
||||||
|
|
||||||
|
@ -70,6 +92,12 @@ class AdminPanelViewArticle extends React.Component {
|
||||||
|
|
||||||
return article;
|
return article;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onEditClick() {
|
||||||
|
this.setState({
|
||||||
|
editable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect((store) => {
|
export default connect((store) => {
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
.admin-panel-view-article {
|
.admin-panel-view-article {
|
||||||
|
|
||||||
|
&__edit-button {
|
||||||
|
text-align: left;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
&__last-edited {
|
&__last-edited {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
|
@ -87,6 +87,7 @@ export default {
|
||||||
'ADD_NEW_ARTICLE': 'Add new article',
|
'ADD_NEW_ARTICLE': 'Add new article',
|
||||||
'ADD_ARTICLE': 'Add article',
|
'ADD_ARTICLE': 'Add article',
|
||||||
'LAST_EDITED_IN': 'Last edited in {date}',
|
'LAST_EDITED_IN': 'Last edited in {date}',
|
||||||
|
'EDIT': 'Edit',
|
||||||
|
|
||||||
//VIEW DESCRIPTIONS
|
//VIEW DESCRIPTIONS
|
||||||
'CREATE_TICKET_DESCRIPTION': 'This is a form for creating tickets. Fill the form and send us your issues/doubts/suggestions. Our support system will answer it as soon as possible.',
|
'CREATE_TICKET_DESCRIPTION': 'This is a form for creating tickets. Fill the form and send us your issues/doubts/suggestions. Our support system will answer it as soon as possible.',
|
||||||
|
|
Loading…
Reference in New Issue