mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 19:01:42 +00:00
optimize code
This commit is contained in:
@@ -10,10 +10,9 @@ class LeaveGroupDialog extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
dismissGroup = () => {
|
leaveGroup = () => {
|
||||||
let that = this;
|
|
||||||
seafileAPI.quitGroup(this.props.groupID, username).then((res)=> {
|
seafileAPI.quitGroup(this.props.groupID, username).then((res)=> {
|
||||||
that.props.onGroupChanged();
|
this.props.onGroupChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,11 +21,11 @@ class LeaveGroupDialog extends React.Component {
|
|||||||
<Modal isOpen={true} toggle={this.props.toggleLeaveGroupDialog}>
|
<Modal isOpen={true} toggle={this.props.toggleLeaveGroupDialog}>
|
||||||
<ModalHeader toggle={this.props.toggleLeaveGroupDialog}>{gettext('Leave Group')}</ModalHeader>
|
<ModalHeader toggle={this.props.toggleLeaveGroupDialog}>{gettext('Leave Group')}</ModalHeader>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<span>{gettext('Really want to leave this group?')}</span>
|
<p>{gettext('Really want to leave this group?')}</p>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button color="secondary" onClick={this.props.toggleLeaveGroupDialog}>{gettext('Cancel')}</Button>
|
<Button color="secondary" onClick={this.props.toggleLeaveGroupDialog}>{gettext('Cancel')}</Button>
|
||||||
<Button color="primary" onClick={this.dismissGroup}>{gettext('Leave')}</Button>
|
<Button color="primary" onClick={this.leaveGroup}>{gettext('Leave')}</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
@@ -61,7 +61,7 @@ class GroupView extends React.Component {
|
|||||||
showManageMembersDialog: false,
|
showManageMembersDialog: false,
|
||||||
groupMembers: [],
|
groupMembers: [],
|
||||||
isShowDetails: false,
|
isShowDetails: false,
|
||||||
showLeaveGroupDialog: false,
|
isLeaveGroupDialogOpen: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ class GroupView extends React.Component {
|
|||||||
|
|
||||||
toggleLeaveGroupDialog = () => {
|
toggleLeaveGroupDialog = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showLeaveGroupDialog: !this.state.showLeaveGroupDialog,
|
isLeaveGroupDialogOpen: !this.state.isLeaveGroupDialogOpen,
|
||||||
showGroupDropdown: false,
|
showGroupDropdown: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ class GroupView extends React.Component {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="path-tool">
|
<div className="path-tool">
|
||||||
{ (isShowSettingIcon) &&
|
{ isShowSettingIcon &&
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<a href="#" className="sf2-icon-cog1 action-icon group-top-action-icon" title="Settings" id="settings"
|
<a href="#" className="sf2-icon-cog1 action-icon group-top-action-icon" title="Settings" id="settings"
|
||||||
onClick={this.toggleGroupDropdown}></a>
|
onClick={this.toggleGroupDropdown}></a>
|
||||||
@@ -576,7 +576,7 @@ class GroupView extends React.Component {
|
|||||||
isOwner={this.state.isOwner}
|
isOwner={this.state.isOwner}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{this.state.showLeaveGroupDialog &&
|
{this.state.isLeaveGroupDialogOpen &&
|
||||||
<LeaveGroupDialog
|
<LeaveGroupDialog
|
||||||
toggleLeaveGroupDialog={this.toggleLeaveGroupDialog}
|
toggleLeaveGroupDialog={this.toggleLeaveGroupDialog}
|
||||||
groupID={this.props.groupID}
|
groupID={this.props.groupID}
|
||||||
|
Reference in New Issue
Block a user