mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
fix tab highlight (#2551)
This commit is contained in:
@@ -35,11 +35,19 @@ class App extends Component {
|
|||||||
draftCounts: 0,
|
draftCounts: 0,
|
||||||
draftList:[],
|
draftList:[],
|
||||||
isLoadingDraft: true,
|
isLoadingDraft: true,
|
||||||
|
currentTab: 'dashboard',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
// e.g. from http://127.0.0.1:8000/drafts/reviews/
|
||||||
|
// get reviews
|
||||||
|
// TODO: need refactor later
|
||||||
|
let href = window.location.href.split('/');
|
||||||
this.getDrafts();
|
this.getDrafts();
|
||||||
|
this.setState({
|
||||||
|
currentTab: href[href.length - 2]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getDrafts = () => {
|
getDrafts = () => {
|
||||||
@@ -71,19 +79,23 @@ class App extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
tabItemClick = (param) => {
|
||||||
|
this.setState({
|
||||||
|
currentTab: param
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let href = window.location.href.split('/');
|
render() {
|
||||||
let currentTab = href[href.length - 2];
|
let { currentTab } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<SidePanel isSidePanelClosed={this.state.isSidePanelClosed} onCloseSidePanel={this.onCloseSidePanel} currentTab={currentTab} draftCounts={this.state.draftCounts} />
|
<SidePanel isSidePanelClosed={this.state.isSidePanelClosed} onCloseSidePanel={this.onCloseSidePanel} currentTab={currentTab} tabItemClick={this.tabItemClick} draftCounts={this.state.draftCounts} />
|
||||||
|
|
||||||
<MainPanel onShowSidePanel={this.onShowSidePanel}>
|
<MainPanel onShowSidePanel={this.onShowSidePanel}>
|
||||||
<Router>
|
<Router>
|
||||||
<FilesActivities path={siteRoot + 'dashboard'} />
|
<FilesActivities path={siteRoot + 'dashboard'} />
|
||||||
<DraftsView path={siteRoot + 'drafts'} currentTab={currentTab}>
|
<DraftsView path={siteRoot + 'drafts'} tabItemClick={this.tabItemClick} currentTab={currentTab}>
|
||||||
<DraftContent path='/' getDrafts={this.getDrafts}
|
<DraftContent path='/' getDrafts={this.getDrafts}
|
||||||
isLoadingDraft={this.state.isLoadingDraft}
|
isLoadingDraft={this.state.isLoadingDraft}
|
||||||
draftList={this.state.draftList}
|
draftList={this.state.draftList}
|
||||||
|
@@ -9,18 +9,18 @@ import { canViewOrg } from '../utils/constants';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentTab: PropTypes.string.isRequired,
|
currentTab: PropTypes.string.isRequired,
|
||||||
|
tabItemClick: PropTypes.func.isRequired,
|
||||||
|
draftCounts: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MainSideNav extends React.Component {
|
class MainSideNav extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
let currentTab = this.props.currentTab || '';
|
|
||||||
this.state = {
|
this.state = {
|
||||||
groupsExtended: false,
|
groupsExtended: false,
|
||||||
sharedExtended: false,
|
sharedExtended: false,
|
||||||
closeSideBar:false,
|
closeSideBar:false,
|
||||||
groupItems: [],
|
groupItems: [],
|
||||||
currentTab: currentTab,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.listHeight = 24; //for caculate tabheight
|
this.listHeight = 24; //for caculate tabheight
|
||||||
@@ -53,9 +53,7 @@ class MainSideNav extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tabItemClick = (param) => {
|
tabItemClick = (param) => {
|
||||||
this.setState({
|
this.props.tabItemClick(param);
|
||||||
currentTab: param
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSharedGroups() {
|
renderSharedGroups() {
|
||||||
@@ -65,7 +63,7 @@ class MainSideNav extends React.Component {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<ul className={`grp-list ${this.state.groupsExtended ? 'side-panel-slide' : 'side-panel-slide-up'}`} style={style}>
|
<ul className={`grp-list ${this.state.groupsExtended ? 'side-panel-slide' : 'side-panel-slide-up'}`} style={style}>
|
||||||
<li className={this.state.currentTab === 'groups' ? 'tab-cur' : ''}>
|
<li className={this.props.currentTab === 'groups' ? 'tab-cur' : ''}>
|
||||||
<a href={siteRoot + '#groups/'} onClick={() => this.tabItemClick('groups')}>
|
<a href={siteRoot + '#groups/'} onClick={() => this.tabItemClick('groups')}>
|
||||||
<span className="sharp" aria-hidden="true">#</span>
|
<span className="sharp" aria-hidden="true">#</span>
|
||||||
{gettext('All Groups')}
|
{gettext('All Groups')}
|
||||||
@@ -73,7 +71,7 @@ class MainSideNav extends React.Component {
|
|||||||
</li>
|
</li>
|
||||||
{this.state.groupItems.map(item => {
|
{this.state.groupItems.map(item => {
|
||||||
return (
|
return (
|
||||||
<li key={item.id} className={this.state.currentTab === item.id ? 'tab-cur' : ''}>
|
<li key={item.id} className={this.props.currentTab === item.id ? 'tab-cur' : ''}>
|
||||||
<a href={siteRoot + '#group/' + item.id + '/'} className="ellipsis" onClick={() => this.tabItemClick(item.id)}>
|
<a href={siteRoot + '#group/' + item.id + '/'} className="ellipsis" onClick={() => this.tabItemClick(item.id)}>
|
||||||
<span className="sharp" aria-hidden="true">#</span>
|
<span className="sharp" aria-hidden="true">#</span>
|
||||||
{item.name}
|
{item.name}
|
||||||
@@ -96,19 +94,19 @@ class MainSideNav extends React.Component {
|
|||||||
let style = {height: height};
|
let style = {height: height};
|
||||||
return (
|
return (
|
||||||
<ul className={`${this.state.sharedExtended ? 'side-panel-slide' : 'side-panel-slide-up'}`} style={style} >
|
<ul className={`${this.state.sharedExtended ? 'side-panel-slide' : 'side-panel-slide-up'}`} style={style} >
|
||||||
<li className={this.state.currentTab === 'share-admin-libs' ? 'tab-cur' : ''}>
|
<li className={this.props.currentTab === 'share-admin-libs' ? 'tab-cur' : ''}>
|
||||||
<Link to={siteRoot + 'share-admin-libs/'} className="ellipsis" title={gettext('Libraries')} onClick={() => this.tabItemClick('share-admin-libs')}>
|
<Link to={siteRoot + 'share-admin-libs/'} className="ellipsis" title={gettext('Libraries')} onClick={() => this.tabItemClick('share-admin-libs')}>
|
||||||
<span aria-hidden="true" className="sharp">#</span>
|
<span aria-hidden="true" className="sharp">#</span>
|
||||||
{gettext('Libraries')}
|
{gettext('Libraries')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className={this.state.currentTab === 'share-admin-folders' ? 'tab-cur' : ''}>
|
<li className={this.props.currentTab === 'share-admin-folders' ? 'tab-cur' : ''}>
|
||||||
<Link to={siteRoot + 'share-admin-folders/'} className="ellipsis" title={gettext('Folders')} onClick={() => this.tabItemClick('share-admin-folders')}>
|
<Link to={siteRoot + 'share-admin-folders/'} className="ellipsis" title={gettext('Folders')} onClick={() => this.tabItemClick('share-admin-folders')}>
|
||||||
<span aria-hidden="true" className="sharp">#</span>
|
<span aria-hidden="true" className="sharp">#</span>
|
||||||
{gettext('Folders')}
|
{gettext('Folders')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className={this.state.currentTab === 'share-admin-share-links' ? 'tab-cur' : ''}>
|
<li className={this.props.currentTab === 'share-admin-share-links' || this.props.currentTab == 'share-admin-upload-links' ? 'tab-cur' : ''}>
|
||||||
<Link to={siteRoot + 'share-admin-share-links/'} className="ellipsis" title={gettext('Links')} onClick={() => this.tabItemClick('share-admin-share-links')}>
|
<Link to={siteRoot + 'share-admin-share-links/'} className="ellipsis" title={gettext('Links')} onClick={() => this.tabItemClick('share-admin-share-links')}>
|
||||||
<span aria-hidden="true" className="sharp">#</span>
|
<span aria-hidden="true" className="sharp">#</span>
|
||||||
{gettext('Links')}
|
{gettext('Links')}
|
||||||
@@ -124,20 +122,20 @@ class MainSideNav extends React.Component {
|
|||||||
<div className="side-nav-con">
|
<div className="side-nav-con">
|
||||||
<h3 className="sf-heading">Files</h3>
|
<h3 className="sf-heading">Files</h3>
|
||||||
<ul className="side-tabnav-tabs">
|
<ul className="side-tabnav-tabs">
|
||||||
<li className={`tab ${this.state.currentTab === 'my-libs' ? 'tab-cur' : ''}`}>
|
<li className={`tab ${this.props.currentTab === 'my-libs' ? 'tab-cur' : ''}`}>
|
||||||
<a href={ siteRoot + '#my-libs' } className="ellipsis" title={gettext('My Libraries')} onClick={() => this.tabItemClick('my-libs')}>
|
<a href={ siteRoot + '#my-libs' } className="ellipsis" title={gettext('My Libraries')} onClick={() => this.tabItemClick('my-libs')}>
|
||||||
<span className="sf2-icon-user" aria-hidden="true"></span>
|
<span className="sf2-icon-user" aria-hidden="true"></span>
|
||||||
{gettext('My Libraries')}
|
{gettext('My Libraries')}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className={`tab ${this.state.currentTab === 'shared-libs' ? 'tab-cur' : ''}`}>
|
<li className={`tab ${this.props.currentTab === 'shared-libs' ? 'tab-cur' : ''}`}>
|
||||||
<Link to={siteRoot + 'shared-libs/'} className="ellipsis" title={gettext('Shared with me')} onClick={() => this.tabItemClick('shared-libs')}>
|
<Link to={siteRoot + 'shared-libs/'} className="ellipsis" title={gettext('Shared with me')} onClick={() => this.tabItemClick('shared-libs')}>
|
||||||
<span className="sf2-icon-share" aria-hidden="true"></span>
|
<span className="sf2-icon-share" aria-hidden="true"></span>
|
||||||
{gettext('Shared with me')}
|
{gettext('Shared with me')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{ canViewOrg &&
|
{ canViewOrg &&
|
||||||
<li className={`tab ${this.state.currentTab === 'org' ? 'tab-cur' : ''}`} onClick={() => this.tabItemClick('org')}>
|
<li className={`tab ${this.props.currentTab === 'org' ? 'tab-cur' : ''}`} onClick={() => this.tabItemClick('org')}>
|
||||||
<a href={ siteRoot + '#org/' } className="ellipsis" title={gettext('Shared with all')}>
|
<a href={ siteRoot + '#org/' } className="ellipsis" title={gettext('Shared with all')}>
|
||||||
<span className="sf2-icon-organization" aria-hidden="true"></span>
|
<span className="sf2-icon-organization" aria-hidden="true"></span>
|
||||||
{gettext('Shared with all')}
|
{gettext('Shared with all')}
|
||||||
@@ -156,25 +154,25 @@ class MainSideNav extends React.Component {
|
|||||||
|
|
||||||
<h3 className="sf-heading">Tools</h3>
|
<h3 className="sf-heading">Tools</h3>
|
||||||
<ul className="side-tabnav-tabs">
|
<ul className="side-tabnav-tabs">
|
||||||
<li className={`tab ${this.state.currentTab === 'starred' ? 'tab-cur' : ''}`}>
|
<li className={`tab ${this.props.currentTab === 'starred' ? 'tab-cur' : ''}`}>
|
||||||
<Link to={siteRoot + 'starred/'} title={gettext('Favorites')} onClick={() => this.tabItemClick('starred')}>
|
<Link to={siteRoot + 'starred/'} title={gettext('Favorites')} onClick={() => this.tabItemClick('starred')}>
|
||||||
<span className="sf2-icon-star" aria-hidden="true"></span>
|
<span className="sf2-icon-star" aria-hidden="true"></span>
|
||||||
{gettext('Favorites')}
|
{gettext('Favorites')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className={`tab ${this.state.currentTab === 'dashboard' ? 'tab-cur' : ''}`}>
|
<li className={`tab ${this.props.currentTab === 'dashboard' ? 'tab-cur' : ''}`}>
|
||||||
<Link to={siteRoot + 'dashboard/'} title={gettext('Acitivities')} onClick={() => this.tabItemClick('dashboard')}>
|
<Link to={siteRoot + 'dashboard/'} title={gettext('Acitivities')} onClick={() => this.tabItemClick('dashboard')}>
|
||||||
<span className="sf2-icon-clock" aria-hidden="true"></span>
|
<span className="sf2-icon-clock" aria-hidden="true"></span>
|
||||||
{gettext('Acitivities')}
|
{gettext('Acitivities')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className={`tab ${this.state.currentTab === 'linked-devices' ? 'tab-cur' : ''}`}>
|
<li className={`tab ${this.props.currentTab === 'linked-devices' ? 'tab-cur' : ''}`}>
|
||||||
<Link to={siteRoot + 'linked-devices/'} title={gettext('Linked Devices')} onClick={() => this.tabItemClick('linked-devices')}>
|
<Link to={siteRoot + 'linked-devices/'} title={gettext('Linked Devices')} onClick={() => this.tabItemClick('linked-devices')}>
|
||||||
<span className="sf2-icon-monitor" aria-hidden="true"></span>
|
<span className="sf2-icon-monitor" aria-hidden="true"></span>
|
||||||
{gettext('Linked Devices')}
|
{gettext('Linked Devices')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className={`tab ${this.state.currentTab === 'drafts' ? 'tab-cur' : ''}`} onClick={() => this.tabItemClick('drafts')}>
|
<li className={`tab ${this.props.currentTab === 'drafts' || this.props.currentTab === 'reviews' ? 'tab-cur' : ''}`} onClick={() => this.tabItemClick('drafts')}>
|
||||||
<Link to={siteRoot + 'drafts/'} title={gettext('Drafts')}>
|
<Link to={siteRoot + 'drafts/'} title={gettext('Drafts')}>
|
||||||
<span className="sf2-icon-edit" aria-hidden="true"></span>
|
<span className="sf2-icon-edit" aria-hidden="true"></span>
|
||||||
{gettext('Drafts')} {this.props.draftCounts === 0 ? '' : <Badge color="info" pill>{this.props.draftCounts}</Badge>}
|
{gettext('Drafts')} {this.props.draftCounts === 0 ? '' : <Badge color="info" pill>{this.props.draftCounts}</Badge>}
|
||||||
|
@@ -31,7 +31,7 @@ class Reviewers extends React.Component {
|
|||||||
let reviewers = '';
|
let reviewers = '';
|
||||||
|
|
||||||
this.props.item.reviewers.map(item => {
|
this.props.item.reviewers.map(item => {
|
||||||
reviewers = reviewers + ' and ' + item.user_name
|
reviewers = reviewers + ' and ' + item.user_name;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -45,9 +45,9 @@ class Reviewers extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className='position-relative reviewer-list'>
|
<div className='position-relative reviewer-list'>
|
||||||
<span id={'reviewers' + items.id}>
|
<span id={'reviewers' + items.id}>
|
||||||
{items.reviewers.map((item, index) => (
|
{items.reviewers.map((item, index) => (
|
||||||
<img key={index} id={'reviewer-tip' + '-' + items.id + '-' + index} className="avatar avatar-sm reviewer-avatar" src={item.avatar_url} />
|
<img key={index} id={'reviewer-tip' + '-' + items.id + '-' + index} className="avatar avatar-sm reviewer-avatar" src={item.avatar_url} alt={item.user_name} />
|
||||||
))}
|
))}
|
||||||
</span>
|
</span>
|
||||||
<Tooltip placement="bottom-end" isOpen={this.state.reviewerTipOpen} target={'reviewers' + items.id} toggle={this.toggle}>
|
<Tooltip placement="bottom-end" isOpen={this.state.reviewerTipOpen} target={'reviewers' + items.id} toggle={this.toggle}>
|
||||||
{reviewerList}
|
{reviewerList}
|
||||||
@@ -112,7 +112,7 @@ class ReviewListItem extends React.Component {
|
|||||||
<td className="name a-simulate" style={{width: '26%'}} onClick={this.onReviewsClick}>{fileName}</td>
|
<td className="name a-simulate" style={{width: '26%'}} onClick={this.onReviewsClick}>{fileName}</td>
|
||||||
<td className='library' style={{width: '25%'}}>{item.draft_origin_repo_name}</td>
|
<td className='library' style={{width: '25%'}}>{item.draft_origin_repo_name}</td>
|
||||||
<td className="update" style={{width: '20%'}}>{localTime}</td>
|
<td className="update" style={{width: '20%'}}>{localTime}</td>
|
||||||
<td className="author" style={{width: '10%'}}><img className="avatar avatar-sm avatar-with-tooltip" id={'tip-' + item.id} src={item.author.avatar_url} /></td>
|
<td className="author" style={{width: '10%'}}><img className="avatar avatar-sm avatar-with-tooltip" id={'tip-' + item.id} src={item.author.avatar_url} alt={item.user_name} /></td>
|
||||||
<td className="reviewer" style={{width: '15%'}}><Reviewers item={item}/></td>
|
<td className="reviewer" style={{width: '15%'}}><Reviewers item={item}/></td>
|
||||||
<Tooltip placement="bottom-end" isOpen={this.state.authorTipOpen} target={'tip-' + item.id} toggle={this.toggle}>
|
<Tooltip placement="bottom-end" isOpen={this.state.authorTipOpen} target={'tip-' + item.id} toggle={this.toggle}>
|
||||||
{item.author.user_name}
|
{item.author.user_name}
|
||||||
@@ -124,4 +124,8 @@ class ReviewListItem extends React.Component {
|
|||||||
|
|
||||||
ReviewListItem.propTypes = propTypes;
|
ReviewListItem.propTypes = propTypes;
|
||||||
|
|
||||||
|
Reviewers.propTypes = {
|
||||||
|
item: PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default ReviewListItem;
|
export default ReviewListItem;
|
||||||
|
@@ -8,18 +8,20 @@ import ReviewListItem from './review-list-item';
|
|||||||
const propTypes = {
|
const propTypes = {
|
||||||
isItemFreezed: PropTypes.bool.isRequired,
|
isItemFreezed: PropTypes.bool.isRequired,
|
||||||
itemsList: PropTypes.array.isRequired,
|
itemsList: PropTypes.array.isRequired,
|
||||||
|
getReviewList: PropTypes.func.isRequired,
|
||||||
|
activeTab: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReviewListView extends React.Component {
|
class ReviewListView extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.toggle = this.toggle.bind(this);
|
this.toggle = this.toggle.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle(tab) {
|
toggle(tab) {
|
||||||
if (this.props.activeTab !== tab) {
|
if (this.props.activeTab !== tab) {
|
||||||
this.props.getReviewList(tab)
|
this.props.getReviewList(tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ class ReviewListView extends React.Component {
|
|||||||
<NavLink
|
<NavLink
|
||||||
className={classnames({ active: this.props.activeTab === 'open' })}
|
className={classnames({ active: this.props.activeTab === 'open' })}
|
||||||
onClick={() => { this.toggle('open');}}
|
onClick={() => { this.toggle('open');}}
|
||||||
>
|
>
|
||||||
{gettext('Open')}
|
{gettext('Open')}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</NavItem>
|
</NavItem>
|
||||||
@@ -40,7 +42,7 @@ class ReviewListView extends React.Component {
|
|||||||
<NavLink
|
<NavLink
|
||||||
className={classnames({ active: this.props.activeTab === 'finished' })}
|
className={classnames({ active: this.props.activeTab === 'finished' })}
|
||||||
onClick={() => { this.toggle('finished');}}
|
onClick={() => { this.toggle('finished');}}
|
||||||
>
|
>
|
||||||
{gettext('Published')}
|
{gettext('Published')}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</NavItem>
|
</NavItem>
|
||||||
@@ -48,7 +50,7 @@ class ReviewListView extends React.Component {
|
|||||||
<NavLink
|
<NavLink
|
||||||
className={classnames({ active: this.props.activeTab === 'closed' })}
|
className={classnames({ active: this.props.activeTab === 'closed' })}
|
||||||
onClick={() => { this.toggle('closed');}}
|
onClick={() => { this.toggle('closed');}}
|
||||||
>
|
>
|
||||||
{gettext('Closed')}
|
{gettext('Closed')}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</NavItem>
|
</NavItem>
|
||||||
@@ -67,11 +69,11 @@ class ReviewListView extends React.Component {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{ items && items.map((item) => {
|
{ items && items.map((item) => {
|
||||||
return (
|
return (
|
||||||
<ReviewListItem
|
<ReviewListItem
|
||||||
key={item.id}
|
key={item.id}
|
||||||
item={item}
|
item={item}
|
||||||
isItemFreezed={this.props.isItemFreezed}
|
isItemFreezed={this.props.isItemFreezed}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@@ -8,6 +8,8 @@ const propTypes = {
|
|||||||
isSidePanelClosed: PropTypes.bool.isRequired,
|
isSidePanelClosed: PropTypes.bool.isRequired,
|
||||||
currentTab: PropTypes.string.isRequired,
|
currentTab: PropTypes.string.isRequired,
|
||||||
onCloseSidePanel: PropTypes.func.isRequired,
|
onCloseSidePanel: PropTypes.func.isRequired,
|
||||||
|
tabItemClick: PropTypes.func.isRequired,
|
||||||
|
draftCounts: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
class SidePanel extends React.Component {
|
class SidePanel extends React.Component {
|
||||||
@@ -19,7 +21,7 @@ class SidePanel extends React.Component {
|
|||||||
<Logo onCloseSidePanel={this.props.onCloseSidePanel}/>
|
<Logo onCloseSidePanel={this.props.onCloseSidePanel}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="side-panel-center">
|
<div className="side-panel-center">
|
||||||
<MainSideNav currentTab={this.props.currentTab} draftCounts={this.props.draftCounts}/>
|
<MainSideNav tabItemClick={this.props.tabItemClick} currentTab={this.props.currentTab} draftCounts={this.props.draftCounts}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="side-panel-footer">
|
<div className="side-panel-footer">
|
||||||
<SideNavFooter />
|
<SideNavFooter />
|
||||||
|
@@ -202,7 +202,7 @@ class EditorUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goReviewPage() {
|
goReviewPage() {
|
||||||
window.location.href = serviceUrl + '/drafts/review/' + reviewID
|
window.location.href = serviceUrl + '/drafts/review/' + reviewID;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommentsNumber() {
|
getCommentsNumber() {
|
||||||
@@ -230,19 +230,19 @@ class EditorUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goDraftPage() {
|
goDraftPage() {
|
||||||
window.location.href = serviceUrl + '/lib/' + repoID + '/file' + draftFilePath + '?mode=edit'
|
window.location.href = serviceUrl + '/lib/' + repoID + '/file' + draftFilePath + '?mode=edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
createDraftFile() {
|
createDraftFile() {
|
||||||
return seafileAPI.createDraft(repoID, filePath).then(res => {
|
return seafileAPI.createDraft(repoID, filePath).then(res => {
|
||||||
window.location.href = serviceUrl + '/lib/' + res.data.origin_repo_id + '/file' + res.data.draft_file_path + '?mode=edit'
|
window.location.href = serviceUrl + '/lib/' + res.data.origin_repo_id + '/file' + res.data.draft_file_path + '?mode=edit';
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createFileReview() {
|
createFileReview() {
|
||||||
return seafileAPI.createFileReview(repoID, filePath).then(res => {
|
return seafileAPI.createFileReview(repoID, filePath).then(res => {
|
||||||
window.location.href = serviceUrl + '/drafts/review/' + res.data.id;
|
window.location.href = serviceUrl + '/drafts/review/' + res.data.id;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,11 +2,17 @@ import React from 'react';
|
|||||||
import { siteRoot, gettext } from '../../utils/constants';
|
import { siteRoot, gettext } from '../../utils/constants';
|
||||||
import editUtilties from '../../utils/editor-utilties';
|
import editUtilties from '../../utils/editor-utilties';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import Toast from '../../components/toast';
|
import Toast from '../../components/toast';
|
||||||
import Loading from '../../components/loading';
|
import Loading from '../../components/loading';
|
||||||
import DraftListView from '../../components/draft-list-view/draft-list-view';
|
import DraftListView from '../../components/draft-list-view/draft-list-view';
|
||||||
import DraftListMenu from '../../components/draft-list-view/draft-list-menu';
|
import DraftListMenu from '../../components/draft-list-view/draft-list-menu';
|
||||||
|
|
||||||
|
const propTypes = {
|
||||||
|
updateDraftsList: PropTypes.func.isRequired,
|
||||||
|
isLoadingDraft: PropTypes.bool.isRequired,
|
||||||
|
draftList: PropTypes.arrayOf(PropTypes.object),
|
||||||
|
};
|
||||||
|
|
||||||
class DraftContent extends React.Component {
|
class DraftContent extends React.Component {
|
||||||
|
|
||||||
@@ -131,4 +137,6 @@ class DraftContent extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DraftContent.propTypes = propTypes;
|
||||||
|
|
||||||
export default DraftContent;
|
export default DraftContent;
|
||||||
|
@@ -9,21 +9,13 @@ const propTypes = {
|
|||||||
PropTypes.array,
|
PropTypes.array,
|
||||||
PropTypes.object
|
PropTypes.object
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
|
tabItemClick: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DraftsView extends React.Component {
|
class DraftsView extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
currentTab: this.props.currentTab
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
tabItemClick = (param) => {
|
tabItemClick = (param) => {
|
||||||
this.setState({
|
this.props.tabItemClick(param);
|
||||||
currentTab: param
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -31,13 +23,13 @@ class DraftsView extends React.Component {
|
|||||||
<div className="cur-view-container">
|
<div className="cur-view-container">
|
||||||
<div className="cur-view-path">
|
<div className="cur-view-path">
|
||||||
<ul className="tab-tabs-nav">
|
<ul className="tab-tabs-nav">
|
||||||
<li className={`tab ${this.state.currentTab === 'drafts' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('drafts')}>
|
<li className={`tab ${this.props.currentTab === 'drafts' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('drafts')}>
|
||||||
<Link className='a' to={siteRoot + 'drafts'} title={gettext('Drafts')}>
|
<Link className='a' to={siteRoot + 'drafts/'} title={gettext('Drafts')}>
|
||||||
{gettext('Drafts')}
|
{gettext('Drafts')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className={`tab ${this.state.currentTab === 'reviews' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('reviews')}>
|
<li className={`tab ${this.props.currentTab === 'reviews' ? 'ui-state-active': ''}`} onClick={() => this.tabItemClick('reviews')}>
|
||||||
<Link className='a' to={siteRoot + 'drafts/reviews'} title={gettext('reviews')}>
|
<Link className='a' to={siteRoot + 'drafts/reviews/'} title={gettext('reviews')}>
|
||||||
{gettext('Reviews')}
|
{gettext('Reviews')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { gettext } 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 ReviewListView from '../../components/review-list-view/review-list-view';
|
import ReviewListView from '../../components/review-list-view/review-list-view';
|
||||||
@@ -22,7 +21,7 @@ class ReviewContent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getReviewList = (reviewStatus) => {
|
getReviewList = (reviewStatus) => {
|
||||||
this.setState({isLoadingReviews: true})
|
this.setState({isLoadingReviews: true});
|
||||||
seafileAPI.listReviews(reviewStatus).then(res => {
|
seafileAPI.listReviews(reviewStatus).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
reviewsList: res.data.data,
|
reviewsList: res.data.data,
|
||||||
|
Reference in New Issue
Block a user