mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 15:53:28 +00:00
fix language select style (#5693)
* fix language select style * fix this.tabItemClick bug
This commit is contained in:
@@ -50,6 +50,7 @@ export default class SeahubSelect extends React.Component {
|
|||||||
isClearable: PropTypes.bool,
|
isClearable: PropTypes.bool,
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
classNamePrefix: PropTypes.string,
|
classNamePrefix: PropTypes.string,
|
||||||
|
className: PropTypes.string,
|
||||||
form: PropTypes.string,
|
form: PropTypes.string,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
menuPortalTarget: PropTypes.string,
|
menuPortalTarget: PropTypes.string,
|
||||||
@@ -79,7 +80,8 @@ export default class SeahubSelect extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { options, onChange, value, isSearchable, placeholder, isMulti, menuPosition, isClearable, noOptionsMessage,
|
const { options, onChange, value, isSearchable, placeholder, isMulti, menuPosition, isClearable, noOptionsMessage,
|
||||||
classNamePrefix, innerRef, isDisabled, form } = this.props;
|
classNamePrefix, innerRef, isDisabled, form, className } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
value={value}
|
value={value}
|
||||||
@@ -88,6 +90,7 @@ export default class SeahubSelect extends React.Component {
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
options={options}
|
options={options}
|
||||||
isMulti={isMulti}
|
isMulti={isMulti}
|
||||||
|
className={className}
|
||||||
classNamePrefix={classNamePrefix}
|
classNamePrefix={classNamePrefix}
|
||||||
styles={MenuSelectStyle}
|
styles={MenuSelectStyle}
|
||||||
components={{ Option, MenuList, ClearIndicator }}
|
components={{ Option, MenuList, ClearIndicator }}
|
||||||
|
@@ -28,16 +28,9 @@ class DirentDetail extends React.Component {
|
|||||||
direntType: '',
|
direntType: '',
|
||||||
direntDetail: '',
|
direntDetail: '',
|
||||||
folderDirent: null,
|
folderDirent: null,
|
||||||
fileParticipantList: [],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
if (this.props.direntDetailPanelTab) {
|
|
||||||
this.tabItemClick(this.props.direntDetailPanelTab);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
let { dirent, path, repoID } = this.props;
|
let { dirent, path, repoID } = this.props;
|
||||||
this.loadDirentInfo(dirent, path, repoID);
|
this.loadDirentInfo(dirent, path, repoID);
|
||||||
@@ -48,9 +41,6 @@ class DirentDetail extends React.Component {
|
|||||||
if (this.props.dirent !== nextProps.dirent) {
|
if (this.props.dirent !== nextProps.dirent) {
|
||||||
this.loadDirentInfo(dirent, path, repoID);
|
this.loadDirentInfo(dirent, path, repoID);
|
||||||
}
|
}
|
||||||
if (this.props.direntDetailPanelTab) {
|
|
||||||
this.tabItemClick(this.props.direntDetailPanelTab);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDirentInfo = (dirent, path, repoID) => {
|
loadDirentInfo = (dirent, path, repoID) => {
|
||||||
@@ -90,7 +80,6 @@ class DirentDetail extends React.Component {
|
|||||||
let errMessage = Utils.getErrorMsg(error);
|
let errMessage = Utils.getErrorMsg(error);
|
||||||
toaster.danger(errMessage);
|
toaster.danger(errMessage);
|
||||||
});
|
});
|
||||||
this.listParticipants(repoID, direntPath);
|
|
||||||
} else {
|
} else {
|
||||||
seafileAPI.getDirInfo(repoID, direntPath).then(res => {
|
seafileAPI.getDirInfo(repoID, direntPath).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -104,16 +93,6 @@ class DirentDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
listParticipants = (repoID, filePath) => {
|
|
||||||
seafileAPI.listFileParticipants(repoID, filePath).then((res) => {
|
|
||||||
this.setState({ fileParticipantList: res.data.participant_list });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onParticipantsChange = (repoID, filePath) => {
|
|
||||||
this.listParticipants(repoID, filePath);
|
|
||||||
};
|
|
||||||
|
|
||||||
renderHeader = (smallIconUrl, direntName) => {
|
renderHeader = (smallIconUrl, direntName) => {
|
||||||
return (
|
return (
|
||||||
<div className="detail-header">
|
<div className="detail-header">
|
||||||
|
@@ -8,10 +8,6 @@ const {
|
|||||||
|
|
||||||
class LanguageSetting extends React.Component {
|
class LanguageSetting extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
onSelectChange = (selectedItem) => {
|
onSelectChange = (selectedItem) => {
|
||||||
// selectedItem: {value: '...', label: '...'}
|
// selectedItem: {value: '...', label: '...'}
|
||||||
location.href = `${siteRoot}i18n/?lang=${selectedItem.value}`;
|
location.href = `${siteRoot}i18n/?lang=${selectedItem.value}`;
|
||||||
@@ -30,7 +26,7 @@ class LanguageSetting extends React.Component {
|
|||||||
<h3 className="setting-item-heading">{gettext('Language Setting')}</h3>
|
<h3 className="setting-item-heading">{gettext('Language Setting')}</h3>
|
||||||
<SeahubSelect
|
<SeahubSelect
|
||||||
className='language-selector'
|
className='language-selector'
|
||||||
defaultValue={{value: currentLang.langCode, label: currentLang.langName}}
|
value={{value: currentLang.langCode, label: currentLang.langName}}
|
||||||
options={options}
|
options={options}
|
||||||
onChange={this.onSelectChange}
|
onChange={this.onSelectChange}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user