diff --git a/framework/core/js/forum/src/components/EditUserModal.js b/framework/core/js/forum/src/components/EditUserModal.js new file mode 100644 index 000000000..6f7cbb96b --- /dev/null +++ b/framework/core/js/forum/src/components/EditUserModal.js @@ -0,0 +1,131 @@ +import Modal from 'flarum/components/Modal'; +import Button from 'flarum/components/Button'; +import GroupBadge from 'flarum/components/GroupBadge'; +import Group from 'flarum/models/Group'; + +/** + * The `EditUserModal` component displays a modal dialog with a login form. + */ +export default class EditUserModal extends Modal { + constructor(...args) { + super(...args); + + const user = this.props.user; + + this.username = m.prop(user.username() || ''); + this.email = m.prop(user.email() || ''); + this.setPassword = m.prop(false); + this.password = m.prop(user.password() || ''); + this.groups = {}; + + app.store.all('groups') + .filter(group => [Group.GUEST_ID, Group.MEMBER_ID].indexOf(group.id()) === -1) + .forEach(group => this.groups[group.id()] = m.prop(user.groups().indexOf(group) !== -1)); + } + + className() { + return 'EditUserModal Modal--small'; + } + + title() { + return 'Edit User'; + } + + content() { + return ( +