mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
Ivan - Fix issues with release block 2 part 2
This commit is contained in:
parent
e27e0c66de
commit
cbc4c15101
@ -54,6 +54,7 @@ class ArticlesList extends React.Component {
|
|||||||
<div key={index}>
|
<div key={index}>
|
||||||
<TopicViewer
|
<TopicViewer
|
||||||
{...topic}
|
{...topic}
|
||||||
|
id={topic.id * 1}
|
||||||
editable={this.props.editable}
|
editable={this.props.editable}
|
||||||
onChange={this.retrieveArticles.bind(this)}
|
onChange={this.retrieveArticles.bind(this)}
|
||||||
articlePath={this.props.articlePath} />
|
articlePath={this.props.articlePath} />
|
||||||
@ -68,7 +69,7 @@ class ArticlesList extends React.Component {
|
|||||||
renderAddTopicButton() {
|
renderAddTopicButton() {
|
||||||
return (
|
return (
|
||||||
<div className="articles-list__add-topic-button">
|
<div className="articles-list__add-topic-button">
|
||||||
<Button onClick={() => ModalContainer.openModal(<TopicEditModal addForm/>)} type="secondary" className="articles-list__add">
|
<Button onClick={() => ModalContainer.openModal(<TopicEditModal addForm onChange={this.retrieveArticles.bind(this)} />)} type="secondary" className="articles-list__add">
|
||||||
<Icon name="plus-circle" size="2x" className="articles-list__add-icon"/> {i18n('ADD_TOPIC')}
|
<Icon name="plus-circle" size="2x" className="articles-list__add-icon"/> {i18n('ADD_TOPIC')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,7 +24,7 @@ class TopicEditModal extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
values: this.props.defaultValues || {title: ''}
|
values: this.props.defaultValues || {title: '', icon: 'address-card', color: '#ff6900'}
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -56,7 +56,13 @@ class TopicEditModal extends React.Component {
|
|||||||
icon: this.state.values['icon'],
|
icon: this.state.values['icon'],
|
||||||
iconColor: this.state.values['color']
|
iconColor: this.state.values['color']
|
||||||
}
|
}
|
||||||
}).then(this.context.closeModal);
|
}).then(() => {
|
||||||
|
this.context.closeModal();
|
||||||
|
|
||||||
|
if(this.props.onChange) {
|
||||||
|
this.props.onChange();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onFormChange(form) {
|
onFormChange(form) {
|
||||||
|
@ -30,10 +30,20 @@ class TopicViewer extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
articles: this.props.articles,
|
articles: this.props.articles.sort((a, b) => {
|
||||||
|
return (a.position*1) - (b.position*1);
|
||||||
|
}),
|
||||||
currentDraggedId: 0
|
currentDraggedId: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
this.setState({
|
||||||
|
articles: nextProps.articles.sort((a, b) => {
|
||||||
|
return (a.position*1) - (b.position*1);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="topic-viewer">
|
<div className="topic-viewer">
|
||||||
@ -90,6 +100,7 @@ class TopicViewer extends React.Component {
|
|||||||
renderEditModal() {
|
renderEditModal() {
|
||||||
let props = {
|
let props = {
|
||||||
topicId: this.props.id,
|
topicId: this.props.id,
|
||||||
|
onChange: this.props.onChange,
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
title: this.props.name,
|
title: this.props.name,
|
||||||
icon: this.props.icon,
|
icon: this.props.icon,
|
||||||
@ -106,6 +117,7 @@ class TopicViewer extends React.Component {
|
|||||||
let props = {
|
let props = {
|
||||||
topicId: this.props.id,
|
topicId: this.props.id,
|
||||||
position: this.props.articles.length,
|
position: this.props.articles.length,
|
||||||
|
onChange: this.props.onChange,
|
||||||
topicName: this.props.name
|
topicName: this.props.name
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -231,7 +243,7 @@ class TopicViewer extends React.Component {
|
|||||||
path: '/article/edit',
|
path: '/article/edit',
|
||||||
data: {
|
data: {
|
||||||
articleId: id,
|
articleId: id,
|
||||||
position: index
|
position: index + 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class AdminPanelViewArticle extends React.Component {
|
|||||||
|
|
||||||
_.forEach(this.props.topics, (topic) => {
|
_.forEach(this.props.topics, (topic) => {
|
||||||
if(!article) {
|
if(!article) {
|
||||||
article = _.find(topic.articles, {id: this.props.params.articleId * 1});
|
article = _.find(topic.articles, {id: this.props.params.articleId});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -120,6 +120,7 @@ class AdminPanelViewArticle extends React.Component {
|
|||||||
API.call({
|
API.call({
|
||||||
path: '/article/edit',
|
path: '/article/edit',
|
||||||
data: {
|
data: {
|
||||||
|
articleId: this.findArticle().id,
|
||||||
title: form.title,
|
title: form.title,
|
||||||
content: form.content
|
content: form.content
|
||||||
}
|
}
|
||||||
|
@ -69,16 +69,16 @@ class AdminPanelListUsers extends React.Component {
|
|||||||
value: i18n('TICKETS'),
|
value: i18n('TICKETS'),
|
||||||
className: 'admin-panel-list-users__table-tickets col-md-2',
|
className: 'admin-panel-list-users__table-tickets col-md-2',
|
||||||
order: true,
|
order: true,
|
||||||
onOrderUp: this.orderByTickets.bind(this, false),
|
onOrderUp: this.orderByTickets.bind(this, 0),
|
||||||
onOrderDown: this.orderByTickets.bind(this, true)
|
onOrderDown: this.orderByTickets.bind(this, 1)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'signupDate',
|
key: 'signupDate',
|
||||||
value: i18n('SIGNUP_DATE'),
|
value: i18n('SIGNUP_DATE'),
|
||||||
className: 'admin-panel-list-users__table-date col-md-2',
|
className: 'admin-panel-list-users__table-date col-md-2',
|
||||||
order: true,
|
order: true,
|
||||||
onOrderUp: this.orderById.bind(this, false),
|
onOrderUp: this.orderById.bind(this, 0),
|
||||||
onOrderDown: this.orderById.bind(this, true)
|
onOrderDown: this.orderById.bind(this, 1)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ class AdminPanelListUsers extends React.Component {
|
|||||||
pages: result.data.pages,
|
pages: result.data.pages,
|
||||||
users: result.data.users,
|
users: result.data.users,
|
||||||
orderBy: result.data.orderBy,
|
orderBy: result.data.orderBy,
|
||||||
desc: result.data.desc,
|
desc: (result.data.desc === '1'),
|
||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,12 @@ class AdminPanelViewUser extends React.Component {
|
|||||||
userId: this.props.params.userId
|
userId: this.props.params.userId
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
browserHistory.push('/admin/panel/user/list-users');
|
API.call({
|
||||||
|
path: '/user/ban',
|
||||||
|
data: {
|
||||||
|
email: this.state.email
|
||||||
|
}
|
||||||
|
}).then(() => browserHistory.push('/admin/panel/users/list-users'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class DashboardArticlePage extends React.Component {
|
|||||||
|
|
||||||
_.forEach(this.props.topics, (topic) => {
|
_.forEach(this.props.topics, (topic) => {
|
||||||
if(!article) {
|
if(!article) {
|
||||||
article = _.find(topic.articles, {id: this.props.params.articleId * 1});
|
article = _.find(topic.articles, {id: this.props.params.articleId});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class DashboardArticlePage extends React.Component {
|
|||||||
let topicFound = {};
|
let topicFound = {};
|
||||||
|
|
||||||
_.forEach(this.props.topics, (topic) => {
|
_.forEach(this.props.topics, (topic) => {
|
||||||
if(_.find(topic.articles, {id: this.props.params.articleId * 1})) {
|
if(_.find(topic.articles, {id: this.props.params.articleId})) {
|
||||||
topicFound = topic;
|
topicFound = topic;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
let month = ["", "Jan", "Feb", "Mar", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
let month = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
transformToString (date) {
|
transformToString (date) {
|
||||||
|
@ -21,14 +21,9 @@ class EditArticleController extends Controller {
|
|||||||
$article = Article::getDataStore(Controller::request('articleId'));
|
$article = Article::getDataStore(Controller::request('articleId'));
|
||||||
|
|
||||||
if (Controller::request('topicId')) {
|
if (Controller::request('topicId')) {
|
||||||
$currentArticleTopic = $article->topic;
|
|
||||||
$newArticleTopic = Topic::getDataStore(Controller::request('topicId'));
|
$newArticleTopic = Topic::getDataStore(Controller::request('topicId'));
|
||||||
|
|
||||||
if (!$newArticleTopic->isNull() /*&& $currentArticleTopic->ownArticleList->remove($article)*/) {
|
if (!$newArticleTopic->isNull()) {
|
||||||
/*$newArticleTopic->ownArticleList->add($article);
|
|
||||||
|
|
||||||
$currentArticleTopic->store();
|
|
||||||
$newArticleTopic->store();*/
|
|
||||||
$article->topic = $newArticleTopic;
|
$article->topic = $newArticleTopic;
|
||||||
} else {
|
} else {
|
||||||
Response::respondError(ERRORS::INVALID_TOPIC);
|
Response::respondError(ERRORS::INVALID_TOPIC);
|
||||||
|
@ -20,6 +20,7 @@ class Topic extends DataStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'icon' => $this->icon,
|
'icon' => $this->icon,
|
||||||
'iconColor' => $this->iconColor,
|
'iconColor' => $this->iconColor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user