1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 07:08:55 +00:00

multi select and fix image src

This commit is contained in:
Michael An
2019-06-29 11:24:18 +08:00
parent 6c0c0f8ef2
commit 859908df06
4 changed files with 12 additions and 8 deletions

View File

@@ -87,11 +87,13 @@ class FileParticipantDialog extends Component {
if (!selectedOption || selectedOption.length === 0) { if (!selectedOption || selectedOption.length === 0) {
return; return;
} }
seafileAPI.addFileParticipant(repoID, filePath, selectedOption.email).then((res) => { for (let i = 0; i < selectedOption.length; i++) {
this.props.onParticipantsChange(repoID, filePath); seafileAPI.addFileParticipant(repoID, filePath, selectedOption[i].email).then((res) => {
}).catch((error) => { this.props.onParticipantsChange(repoID, filePath);
this.handleError(error); }).catch((error) => {
}); this.handleError(error);
});
}
this.setState({ selectedOption: null }); this.setState({ selectedOption: null });
this.refs.userSelect.clearSelect(); this.refs.userSelect.clearSelect();
}; };
@@ -122,7 +124,7 @@ class FileParticipantDialog extends Component {
<div className="participant-add"> <div className="participant-add">
<UserSelect <UserSelect
ref="userSelect" ref="userSelect"
isMulti={false} isMulti={true}
className="participant-select" className="participant-select"
placeholder={gettext('Select users...')} placeholder={gettext('Select users...')}
onSelectChange={this.handleSelectChange} onSelectChange={this.handleSelectChange}

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { Tooltip } from 'reactstrap'; import { Tooltip } from 'reactstrap';
import ModalPortal from '../modal-portal'; import ModalPortal from '../modal-portal';
import FileParticipantDialog from '../dialog/file-participant-dialog'; import FileParticipantDialog from '../dialog/file-participant-dialog';
import { serviceURL, gettext } from '../../utils/constants'; import { gettext } from '../../utils/constants';
import '../../css/participants-list.css'; import '../../css/participants-list.css';
const propTypes = { const propTypes = {
@@ -37,7 +37,7 @@ class ParticipantsList extends React.Component {
return ( return (
<div className="participants mb-2 position-relative"> <div className="participants mb-2 position-relative">
{participants.map((item, index) => { {participants.map((item, index) => {
return <img src={serviceURL + item.avatar_url} className="avatar" alt="avatar" key={index} style={{left: index * -7 + 'px'}}/>; return <img src={item.avatar_url} className="avatar" alt="avatar" key={index} style={{left: index * -7 + 'px'}}/>;
})} })}
<span className="add-participants" style={{left: participants.length * 21, top: 8 }} onClick={this.toggleDialog} id="add-participant-icon"> <span className="add-participants" style={{left: participants.length * 21, top: 8 }} onClick={this.toggleDialog} id="add-participant-icon">
<i className="fas fa-plus-circle"></i> <i className="fas fa-plus-circle"></i>

View File

@@ -616,6 +616,7 @@ class MarkdownEditor extends React.Component {
this.listFileTags(); this.listFileTags();
this.listFileParticipants(); this.listFileParticipants();
window.showParticipants = true;
setTimeout(() => { setTimeout(() => {
let url = new URL(window.location.href); let url = new URL(window.location.href);
if (url.hash) { if (url.hash) {

View File

@@ -54,6 +54,7 @@ class FileParticipantsView(APIView):
for participant in participant_queryset: for participant in participant_queryset:
participant_info = get_user_common_info(participant.username) participant_info = get_user_common_info(participant.username)
participant_info['avatar_url'] = request.build_absolute_uri(participant_info['avatar_url'])
participant_list.append(participant_info) participant_list.append(participant_info)
except Exception as e: except Exception as e:
logger.error(e) logger.error(e)