Fixed group editing
• Fixed: - group editing dialog • Updated: - FileInput to take in file from props to state - GroupCreateModal, GroupCreate to take in groupId
This commit is contained in:
parent
10686f32ef
commit
e09265279d
@ -20,7 +20,7 @@ export default class FileInput extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
file: null,
|
file: this.props.file,
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOnChange = (e) => {
|
handleOnChange = (e) => {
|
||||||
|
@ -1,31 +1,34 @@
|
|||||||
import { defineMessages, injectIntl } from 'react-intl'
|
import { defineMessages, injectIntl } from 'react-intl'
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
|
||||||
import ModalLayout from './modal_layout'
|
import ModalLayout from './modal_layout'
|
||||||
import GroupCreate from '../../features/group_create'
|
import GroupCreate from '../../features/group_create'
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
title: { id: 'create_group', defaultMessage: 'Create group' },
|
title: { id: 'create_group', defaultMessage: 'Create group' },
|
||||||
|
update: { id: 'groups.form.update', defaultMessage: 'Update group' },
|
||||||
})
|
})
|
||||||
|
|
||||||
export default
|
export default
|
||||||
@injectIntl
|
@injectIntl
|
||||||
class GroupCreateModal extends ImmutablePureComponent {
|
class GroupCreateModal extends PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
|
groupId: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, onClose } = this.props
|
const { intl, onClose, groupId } = this.props
|
||||||
|
|
||||||
|
const title = intl.formatMessage(groupId ? messages.update : messages.title)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalLayout
|
<ModalLayout
|
||||||
title={intl.formatMessage(messages.title)}
|
title={title}
|
||||||
width={440}
|
width={440}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
>
|
>
|
||||||
<GroupCreate onCloseModal={onClose} />
|
<GroupCreate onCloseModal={onClose} params={{ id: groupId }} />
|
||||||
</ModalLayout>
|
</ModalLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@ const messages = defineMessages({
|
|||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
|
||||||
onOpenEditGroup(group) {
|
onOpenEditGroup(groupId) {
|
||||||
dispatch(closePopover())
|
dispatch(closePopover())
|
||||||
dispatch(openModal(MODAL_GROUP_CREATE, { group }))
|
dispatch(openModal(MODAL_GROUP_CREATE, { groupId }))
|
||||||
},
|
},
|
||||||
|
|
||||||
onOpenRemovedMembers(groupId) {
|
onOpenRemovedMembers(groupId) {
|
||||||
@ -54,7 +54,7 @@ class GroupOptionsPopover extends ImmutablePureComponent {
|
|||||||
updateOnProps = ['group']
|
updateOnProps = ['group']
|
||||||
|
|
||||||
handleEditGroup = () => {
|
handleEditGroup = () => {
|
||||||
this.props.onOpenEditGroup(this.props.group)
|
this.props.onOpenEditGroup(this.props.group.get('id'))
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOnOpenRemovedMembers = () => {
|
handleOnOpenRemovedMembers = () => {
|
||||||
|
@ -167,6 +167,7 @@ class GroupCreate extends ImmutablePureComponent {
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
title={intl.formatMessage(coverImage === null ? messages.coverImage : messages.coverImageChange)}
|
title={intl.formatMessage(coverImage === null ? messages.coverImage : messages.coverImageChange)}
|
||||||
onChange={this.handleCoverImageChange}
|
onChange={this.handleCoverImageChange}
|
||||||
|
file={group ? group.get('cover_image_url') : undefined}
|
||||||
width='340px'
|
width='340px'
|
||||||
height='145px'
|
height='145px'
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user