mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 13:24:52 +00:00
rewrite path and path-tool
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
import React, { Fragment } from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import RepoPath from './repo-path';
|
|
||||||
import RepoTool from './repo-tool';
|
|
||||||
|
|
||||||
const propTypes = {
|
|
||||||
libraryType: PropTypes.string.isRequired,
|
|
||||||
currentGroup: PropTypes.object,
|
|
||||||
};
|
|
||||||
|
|
||||||
class CurGroupPath extends React.Component {
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let { libraryType, currentGroup } = this.props;
|
|
||||||
return (
|
|
||||||
<Fragment>
|
|
||||||
<RepoPath libraryType={libraryType} currentGroup={currentGroup}/>
|
|
||||||
<RepoTool libraryType={libraryType} currentGroup={currentGroup}/>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CurGroupPath.propTypes = propTypes;
|
|
||||||
|
|
||||||
export default CurGroupPath;
|
|
@@ -1,37 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import {gettext, siteRoot} from '../../utils/constants';
|
|
||||||
|
|
||||||
const propTypes = {
|
|
||||||
currentGroup: PropTypes.object, // for group
|
|
||||||
libraryType: PropTypes.string.isRequired, //for my-library, shared width me, shared whith all, groups
|
|
||||||
};
|
|
||||||
|
|
||||||
class RepoPath extends React.Component {
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let { libraryType, currentGroup } = this.props;
|
|
||||||
if (libraryType === 'group' && currentGroup) {
|
|
||||||
return (
|
|
||||||
<div className="path-container">
|
|
||||||
<a href={`${siteRoot}groups/`}>{gettext("Groups")}</a>
|
|
||||||
<span className="path-split">/</span>
|
|
||||||
<span>{currentGroup.name}</span>
|
|
||||||
{currentGroup.parent_group_id !== 0 && (
|
|
||||||
<span className="address-book-group-icon icon-building" title={gettext("This is a special group representing a department.")}></span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="path-container">
|
|
||||||
<span>{libraryType}</span>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RepoPath.propTypes = propTypes;
|
|
||||||
|
|
||||||
export default RepoPath;
|
|
@@ -1,31 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { gettext, username } from '../../utils/constants';
|
|
||||||
|
|
||||||
const propTypes = {
|
|
||||||
currentGroup: PropTypes.object, // for group
|
|
||||||
libraryType: PropTypes.string.isRequired, //for my-library, shared width me, shared whith all, groups
|
|
||||||
};
|
|
||||||
|
|
||||||
class RepoTool extends React.Component {
|
|
||||||
|
|
||||||
render() {
|
|
||||||
if (this.props.libraryType === 'group' && this.props.currentGroup) {
|
|
||||||
let currentGroup = this.props.currentGroup;
|
|
||||||
let isShowSettingIcon = !(currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1);
|
|
||||||
return (
|
|
||||||
<div className="path-tool">
|
|
||||||
{isShowSettingIcon && (
|
|
||||||
<a href="#" className="sf2-icon-cog1 op-icon group-top-op-icon" title={gettext("Settings")} id="group-settings-icon" aria-label={gettext("Settings")}></a>
|
|
||||||
)}
|
|
||||||
<a href="#" className="sf2-icon-user2 op-icon group-top-op-icon" title={gettext("Members")} id="group-members-icon" aria-label={gettext("Members")}></a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RepoTool.propTypes = propTypes;
|
|
||||||
|
|
||||||
export default RepoTool;
|
|
@@ -77,11 +77,9 @@ class ShareRepoListView extends React.Component {
|
|||||||
<tr>
|
<tr>
|
||||||
<th width="18%"><span className="sr-only">{gettext("Library Type")}</span></th>
|
<th width="18%"><span className="sr-only">{gettext("Library Type")}</span></th>
|
||||||
<th width="68%">
|
<th width="68%">
|
||||||
<Fragment>
|
|
||||||
{gettext("Sort:")} {/* TODO: sort */}
|
{gettext("Sort:")} {/* TODO: sort */}
|
||||||
{gettext("name")}<a className="table-sort-op mobile-table-sort-op by-name" href="#"> <span className="sort-icon icon-caret-down hide"></span></a>
|
{gettext("name")}<a className="table-sort-op mobile-table-sort-op by-name" href="#"> <span className="sort-icon icon-caret-down hide"></span></a>
|
||||||
{gettext("last update")}<a className="table-sort-op mobile-table-sort-op by-time" href="#"> <span className="sort-icon icon-caret-up"></span></a>
|
{gettext("last update")}<a className="table-sort-op mobile-table-sort-op by-time" href="#"> <span className="sort-icon icon-caret-up"></span></a>
|
||||||
</Fragment>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="14%"><span className="sr-only">{gettext("Actions")}</span></th>
|
<th width="14%"><span className="sr-only">{gettext("Actions")}</span></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
import React,{ Fragment } from 'react';
|
import React,{ Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { gettext, username, loginUrl } from '../../utils/constants';
|
import { gettext, siteRoot, username, loginUrl } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import Loading from '../../components/loading';
|
import Loading from '../../components/loading';
|
||||||
import ModalPortal from '../../components/modal-portal';
|
import ModalPortal from '../../components/modal-portal';
|
||||||
import Group from '../../models/group';
|
import Group from '../../models/group';
|
||||||
import RepoInfo from '../../models/repoInfo';
|
import RepoInfo from '../../models/repoInfo';
|
||||||
import CommonToolbar from '../../components/toolbar/common-toolbar';
|
import CommonToolbar from '../../components/toolbar/common-toolbar';
|
||||||
import CurRepoPath from '../../components/cur-repo-path/';
|
|
||||||
import CreateRepoDialog from '../../components/dialog/create-repo-dialog';
|
import CreateRepoDialog from '../../components/dialog/create-repo-dialog';
|
||||||
import CreateDepartmentRepoDialog from '../../components/dialog/create-department-repo-dialog';
|
import CreateDepartmentRepoDialog from '../../components/dialog/create-department-repo-dialog';
|
||||||
import ShareRepoListView from '../../components/share-repo-list-view/share-repo-list-view';
|
import ShareRepoListView from '../../components/share-repo-list-view/share-repo-list-view';
|
||||||
@@ -181,7 +180,8 @@ class GroupView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { errMessage, emptyTip } = this.state;
|
let { errMessage, emptyTip, currentGroup } = this.state;
|
||||||
|
let isShowSettingIcon = !(currentGroup && currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1);
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className="main-panel-north">
|
<div className="main-panel-north">
|
||||||
@@ -199,7 +199,24 @@ class GroupView extends React.Component {
|
|||||||
<div className="main-panel-center">
|
<div className="main-panel-center">
|
||||||
<div className="cur-view-container">
|
<div className="cur-view-container">
|
||||||
<div className="cur-view-path">
|
<div className="cur-view-path">
|
||||||
<CurRepoPath libraryType={this.state.libraryType} currentGroup={this.state.currentGroup}/>
|
{currentGroup && (
|
||||||
|
<Fragment>
|
||||||
|
<div className="path-container">
|
||||||
|
<a href={`${siteRoot}groups/`}>{gettext("Groups")}</a>
|
||||||
|
<span className="path-split">/</span>
|
||||||
|
<span>{currentGroup.name}</span>
|
||||||
|
{currentGroup.parent_group_id !== 0 && (
|
||||||
|
<span className="address-book-group-icon icon-building" title={gettext("This is a special group representing a department.")}></span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="path-tool">
|
||||||
|
{isShowSettingIcon && (
|
||||||
|
<a href="#" className="sf2-icon-cog1 op-icon group-top-op-icon" title={gettext("Settings")} aria-label={gettext("Settings")}></a>
|
||||||
|
)}
|
||||||
|
<a href="#" className="sf2-icon-user2 op-icon group-top-op-icon" title={gettext("Members")} aria-label={gettext("Members")}></a>
|
||||||
|
</div>
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="cur-view-content">
|
<div className="cur-view-content">
|
||||||
{this.state.isLoading && <Loading />}
|
{this.state.isLoading && <Loading />}
|
||||||
|
Reference in New Issue
Block a user