Skip to content
Snippets Groups Projects
Commit e519f64b authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

News page shows full names and can change editor

parent 90a4625e
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ export const getUserData = () => (
motivation_about: motivationAbout,
motivation_profession: motivationProfession,
motivation_exercise: motivationExercise,
full_name,
signed,
groups,
role,
......@@ -36,7 +37,7 @@ export const getUserData = () => (
dispatch({
type: GET_USERDATA,
payload: {
id, joinDate, nick, motivationAbout, motivationProfession, motivationExercise, signed, groups, role, permission
id, joinDate, nick, motivationAbout, motivationProfession, motivationExercise, full_name, signed, groups, role, permission
},
});
} catch (e) {
......
......@@ -39,11 +39,11 @@ export const postNews = ({ title, author, text }) => (
}
);
export const editNews = ({ id, title, editedBy, text }) => (
export const editNews = ({ id, title, text, updated_by}) => (
async (dispatch) => {
try {
const response = await axios.patch(`/api/v1/news/${id}/`, {
author: editedBy,
updated_by,
title,
text,
});
......
......@@ -14,7 +14,7 @@ class EditNewsForm extends Component {
render() {
const { id, title, text } = this.props.selectedNews;
const editedBy = this.props.user.id;
const updated_by = this.props.user.id;
return (
<Modal
open={this.state.showModal}
......@@ -63,7 +63,7 @@ class EditNewsForm extends Component {
color='green'
onClick={() => {
this.props.editNews({
id, title, text, editedBy,
id, title, text, updated_by,
});
this.setState({ showModal: false });
this.props.clearWrite();
......
......@@ -29,7 +29,9 @@ class News extends Component {
{ this.props.user.role === 'Staff' ?
<Grid.Column floated='right' width={4}>
<EditNewsForm
onClick={() => this.props.setSelectedNews(item)}
onClick={() => {
this.props.setSelectedNews(item)
}}
/>
<Button
compact
......@@ -54,9 +56,9 @@ class News extends Component {
<p> Szerkesztve: {moment(item.updated_at).format('LLLL')}</p>
</Grid.Column>
<Grid.Column floated='right' width={5}>
<p> Írta: <strong>{item.author_name}</strong></p>
<p> Írta: <strong>{item.author}</strong></p>
{/* TODO get the edited by name */}
<p> Szerkesztette: {item.author_name}</p>
<p> Szerkesztette: {item.last_update_by}</p>
</Grid.Column>
</Grid.Row>
</Grid>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment