1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 13:24:52 +00:00

Merge branch '7.0'

This commit is contained in:
plt
2019-06-11 17:34:17 +08:00
47 changed files with 1052 additions and 162 deletions

View File

@@ -210,7 +210,7 @@ class NoticeItem extends React.Component {
<li onClick={this.onNoticeItemClick} className={noticeItem.seen ? 'read' : 'unread'}>
<div className="notice-item">
<div className="main-info">
<img src={avatar_url} width="32" height="32" className="avatar" />
<img src={avatar_url} width="32" height="32" className="avatar" alt=""/>
<p className="brief" dangerouslySetInnerHTML={{__html: notice}}></p>
</div>
<p className="time">{moment(noticeItem.time).fromNow()}</p>

View File

@@ -7,7 +7,7 @@ export const MENU_HIDE = 'REACT_CONTEXTMENU_HIDE';
export function dispatchGlobalEvent(eventName, opts, target = window) {
// Compatibale with IE
// Compatibale with IE
// @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
let event;

View File

@@ -1,4 +1,4 @@
import React, { Fragment } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody, ModalFooter, Alert } from 'reactstrap';
import { gettext, repoPasswordMinLength } from '../../utils/constants';
@@ -79,30 +79,30 @@ class ChangeRepoPasswordDialog extends React.Component {
submitBtnDisabled: true
});
seafileAPI.changeEncryptedRepoPassword(this.props.repoID, oldPassword, newPassword)
.then(() => {
this.props.toggleDialog();
toaster.success(gettext('Successfully changed library password.'));
}).catch((error) => {
let errorMsg = '';
if (error.response) {
if (error.response.data) {
.then(() => {
this.props.toggleDialog();
toaster.success(gettext('Successfully changed library password.'));
}).catch((error) => {
let errorMsg = '';
if (error.response) {
if (error.response.data) {
errorMsg = error.response.data.error_msg;
} else {
} else {
errorMsg = gettext('Error');
}
} else {
}
} else {
errorMsg = gettext('Please check the network.');
}
this.setState({
errorMsg: errorMsg,
submitBtnDisabled: false
});
});
}
this.setState({
errorMsg: errorMsg,
submitBtnDisabled: false
});
});
}
render() {
const { repoID, repoName, toggleDialog } = this.props;
const { repoName, toggleDialog } = this.props;
return (
<Modal isOpen={true} centered={true} style={{height: 'auto'}}>
@@ -121,7 +121,7 @@ class ChangeRepoPasswordDialog extends React.Component {
</form>
</ModalBody>
<ModalFooter>
<button className="btn btn-primary" disabled={this.state.submitBtnDisabled} onClick={this.formSubmit}>{gettext('Submit')}</button>
<button className="btn btn-primary" disabled={this.state.submitBtnDisabled} onClick={this.formSubmit}>{gettext('Submit')}</button>
</ModalFooter>
</Modal>
);

View File

@@ -307,7 +307,7 @@ class GenerateShareLink extends React.Component {
}
</dd>
</FormGroup>
{!sharedLinkInfo.is_dir && ( //just for file
{!sharedLinkInfo.is_dir && sharedLinkInfo.permissions.can_download &&( //just for file
<FormGroup className="mb-0">
<dt className="text-secondary font-weight-normal">{gettext('Direct Download Link:')}</dt>
<dd className="d-flex">

View File

@@ -0,0 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import { mediaUrl } from '../utils/constants';
class EmptyTip extends React.Component {
render() {
return (
<div className="empty-tip">
<img src={`${mediaUrl}img/no-items-tip.png`} alt="" width="140" height="140" className="no-items-img-tip" />
{this.props.children}
</div>
);
}
}
export default EmptyTip;

View File

@@ -162,7 +162,7 @@ class RepoListItem extends React.Component {
<span className="icon far fa-folder tree-node-icon"></span>
</i>
</div>
</div>
</div>
{this.state.isShowChildren && (
<TreeListView
repo={this.props.repo}

View File

@@ -90,19 +90,19 @@ class TreeViewItem extends React.Component {
<div className="file-chooser-item">
<div className={`${node.path === '/'? 'hide': ''}`}>
<div className={`${(isCurrentRepo && isCurrentPath) ? 'item-active' : ''} item-info`} onClick={this.onItemClick}>
<div className="item-text">
<span className="name user-select-none ellipsis">{node.object && node.object.name}</span>
<div className="item-text">
<span className="name user-select-none ellipsis">{node.object && node.object.name}</span>
</div>
<div className="item-left-icon">
{
node.object.type !== 'file' &&
<span className={`icon item-toggle fa ${node.isExpanded ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
}
<i className="tree-node-icon">
<span className={`icon far ${node.object.type === 'dir' ? 'fa-folder' : 'fa-file'}`}></span>
</i>
</div>
</div>
<div className="item-left-icon">
{
node.object.type !== 'file' &&
<span className={`icon item-toggle fa ${node.isExpanded ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
}
<i className="tree-node-icon">
<span className={`icon far ${node.object.type === 'dir' ? 'fa-folder' : 'fa-file'}`}></span>
</i>
</div>
</div>
</div>
{node.isExpanded && this.renderChildren()}
</div>

View File

@@ -234,7 +234,7 @@ class MainSideNav extends React.Component {
</Link>
</li>
{canInvitePeople &&
<li className="nav-item">
<li className="nav-item">
<Link className={`nav-link ellipsis ${this.getActiveClass('invitations')}`} to={siteRoot + 'invitations/'} title={gettext('Invite People')} onClick={() => this.tabItemClick('invitations')}>
<span className="sf2-icon-invite" aria-hidden="true"></span>
<span className="nav-text">{gettext('Invite People')}</span>

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import MediaQuery from 'react-responsive';
import CommonToolbar from './common-toolbar';
import { Button } from 'reactstrap';
import { gettext } from '../../utils/constants';
import { gettext, canAddGroup } from '../../utils/constants';
const propTypes = {
searchPlaceholder: PropTypes.string,
@@ -24,18 +24,20 @@ class GroupsToolbar extends React.Component {
<div className="main-panel-north border-left-show">
<div className="cur-view-toolbar">
<span title="Side Nav Menu" onClick={onShowSidePanel} className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none"></span>
<div className="operation">
<MediaQuery query="(min-width: 768px)">
<Button color="btn btn-secondary operation-item" onClick={this.props.toggleAddGroupModal}>
<i className="fas fa-plus-square text-secondary mr-1"></i>{gettext('New Group')}
</Button>
</MediaQuery>
<MediaQuery query="(max-width: 767.8px)">
<Button color="btn btn-secondary operation-item my-1" onClick={this.props.toggleAddGroupModal}>
<i className="fas fa-plus-square text-secondary mr-1"></i>{gettext('New Group')}
</Button>
</MediaQuery>
</div>
{canAddGroup && (
<div className="operation">
<MediaQuery query="(min-width: 768px)">
<Button color="btn btn-secondary operation-item" onClick={this.props.toggleAddGroupModal}>
<i className="fas fa-plus-square text-secondary mr-1"></i>{gettext('New Group')}
</Button>
</MediaQuery>
<MediaQuery query="(max-width: 767.8px)">
<Button color="btn btn-secondary operation-item my-1" onClick={this.props.toggleAddGroupModal}>
<i className="fas fa-plus-square text-secondary mr-1"></i>{gettext('New Group')}
</Button>
</MediaQuery>
</div>
)}
</div>
<CommonToolbar searchPlaceholder={this.props.searchPlaceholder} onSearchedClick={onSearchedClick}/>
</div>

View File

@@ -235,7 +235,7 @@ class WikiMarkdownViewer extends React.Component {
return <Loading />;
}
// In dir-column-file repoID is one of props, width is 100%; In wiki-viewer repoID is not props, width isn't 100%
let contentClassName = `${this.props.repoID ? contentClass + ' w-100' : contentClass}`
let contentClassName = `${this.props.repoID ? contentClass + ' w-100' : contentClass}`;
return (
<div ref={this.markdownContainer} className="wiki-page-container" onScroll={this.onScrollHandler.bind(this)}>
<div className={contentClassName}>