mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 15:38:15 +00:00
adjust style
This commit is contained in:
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
|||||||
import { siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle } from '../utils/constants';
|
import { siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle } from '../utils/constants';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
onCloseSidePanel: PropTypes.func.isRequired,
|
onCloseSidePanel: PropTypes.func,
|
||||||
|
showCloseSidePanelIcon: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
class Logo extends React.Component {
|
class Logo extends React.Component {
|
||||||
@@ -18,13 +19,15 @@ class Logo extends React.Component {
|
|||||||
<a href={siteRoot} id="logo">
|
<a href={siteRoot} id="logo">
|
||||||
<img src={mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" />
|
<img src={mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" />
|
||||||
</a>
|
</a>
|
||||||
<a
|
{this.props.showCloseSidePanelIcon &&
|
||||||
className="sf2-icon-x1 sf-popover-close side-panel-close action-icon d-md-none"
|
<a
|
||||||
onClick={this.closeSide}
|
className="sf2-icon-x1 sf-popover-close side-panel-close action-icon d-md-none"
|
||||||
title="Close"
|
onClick={this.closeSide}
|
||||||
aria-label="Close"
|
title="Close"
|
||||||
>
|
aria-label="Close"
|
||||||
</a>
|
>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
@media (min-width: 768px){
|
|
||||||
.old-history-header {
|
.old-history-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -10,20 +9,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.old-history-main {
|
.old-history-main {
|
||||||
padding-top: 16px;
|
padding: 16px 10% 0;
|
||||||
margin: 0 8.333333%;
|
|
||||||
display: inline !important;
|
display: inline !important;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 1px;
|
min-height: 1px;
|
||||||
padding-right: .9375rem;
|
|
||||||
padding-left: .9375rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.old-history-main .go-back {
|
.old-history-main .go-back {
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
float: left;
|
float: left;
|
||||||
|
margin-left: -20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.old-history-main .go-back:hover {
|
.old-history-main .go-back:hover {
|
||||||
@@ -79,4 +76,16 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
.old-history-more-operation i {
|
||||||
|
color: #999;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-history-more-operation a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-history-more-operation i:hover {
|
||||||
|
color: #666;
|
||||||
|
}
|
@@ -186,8 +186,6 @@ class FileHistory extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onCloseSidePanel = () => {}
|
|
||||||
|
|
||||||
onSearchedClick = (selectedItem) => {
|
onSearchedClick = (selectedItem) => {
|
||||||
if (selectedItem.is_dir === true) {
|
if (selectedItem.is_dir === true) {
|
||||||
let url = siteRoot + 'library/' + selectedItem.repo_id + '/' + selectedItem.repo_name + selectedItem.path;
|
let url = siteRoot + 'library/' + selectedItem.repo_id + '/' + selectedItem.repo_name + selectedItem.path;
|
||||||
@@ -205,7 +203,7 @@ class FileHistory extends React.Component {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<div id="header" className="old-history-header">
|
<div id="header" className="old-history-header">
|
||||||
<div className="logo">
|
<div className="logo">
|
||||||
<Logo onCloseSidePanel={this.onCloseSidePanel} />
|
<Logo showCloseSidePanelIcon={false}/>
|
||||||
</div>
|
</div>
|
||||||
<div className='toolbar'>
|
<div className='toolbar'>
|
||||||
<CommonToolbar onSearchedClick={this.onSearchedClick} />
|
<CommonToolbar onSearchedClick={this.onSearchedClick} />
|
||||||
@@ -226,10 +224,10 @@ class FileHistory extends React.Component {
|
|||||||
<table className="commit-list">
|
<table className="commit-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="25%" >{gettext('Time')}</th>
|
<th width="40%" >{gettext('Time')}</th>
|
||||||
<th width="25%" >{gettext('Modifier')}</th>
|
<th width="30%" >{gettext('Modifier')}</th>
|
||||||
<th width="20%" >{gettext('Size')}</th>
|
<th width="25%" >{gettext('Size')}</th>
|
||||||
<th width="30%" >{gettext('Operation')}</th>
|
<th width="5%" ></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@@ -4,6 +4,7 @@ import moment from 'moment';
|
|||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { gettext, siteRoot, filePath, historyRepoID } from '../../utils/constants';
|
import { gettext, siteRoot, filePath, historyRepoID } from '../../utils/constants';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
|
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
||||||
|
|
||||||
moment.locale(window.app.config.lang);
|
moment.locale(window.app.config.lang);
|
||||||
|
|
||||||
@@ -49,24 +50,27 @@ class HistoryItem extends React.Component {
|
|||||||
let diffUrl = `${siteRoot}repo/text_diff/${historyRepoID}/?commit=${item.commit_id}&p=${filePath}`;
|
let diffUrl = `${siteRoot}repo/text_diff/${historyRepoID}/?commit=${item.commit_id}&p=${filePath}`;
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
|
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} className={this.state.active ? 'tr-highlight' : ''}>
|
||||||
<td>
|
<td>
|
||||||
<time datetime={item.time} is="relative-time" title={moment(item.ctime).format('llll')}>{moment(item.ctime).fromNow()}</time>
|
<time datetime={item.time} is="relative-time" title={moment(item.ctime).format('llll')}>{moment(item.ctime).fromNow()}</time>
|
||||||
{this.props.index === 0 && gettext('(current version)')}
|
{this.props.index === 0 && gettext('(current version)')}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img className="avatar" src={item.creator_avatar_url}></img>{' '}
|
<img className="avatar" src={item.creator_avatar_url} alt=''></img>{' '}
|
||||||
<a href={userProfileURL} target='_blank' className="username">{item.creator_name}</a>
|
<a href={userProfileURL} target='_blank' className="username">{item.creator_name}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{Utils.bytesToSize(item.size)}</td>
|
<td>{Utils.bytesToSize(item.size)}</td>
|
||||||
<td>
|
<td>
|
||||||
{this.state.active &&
|
{this.state.active &&
|
||||||
<span className="attr-action-icon">
|
<MoreMenu
|
||||||
{this.props.index !== 0 && <a href="#" onClick={this.onItemRestore}>{gettext('Restore')}</a>}
|
index={this.props.index}
|
||||||
{this.props.canDownload && <a href={downloadUrl}>{gettext('Download')}</a>}
|
downloadUrl={downloadUrl}
|
||||||
{this.props.canCompare && <a href={viewUrl}>{gettext('View')}</a>}
|
viewUrl={viewUrl}
|
||||||
<a href={diffUrl}>{gettext('Diff')}</a>
|
diffUrl={diffUrl}
|
||||||
</span>
|
onItemRestore={this.onItemRestore}
|
||||||
|
canDownload={this.props.canDownload}
|
||||||
|
canCompare={this.props.canCompare}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -77,4 +81,53 @@ class HistoryItem extends React.Component {
|
|||||||
|
|
||||||
HistoryItem.propTypes = propTypes;
|
HistoryItem.propTypes = propTypes;
|
||||||
|
|
||||||
|
|
||||||
|
const MoreMenuPropTypes = {
|
||||||
|
index: PropTypes.number.isRequired,
|
||||||
|
downloadUrl: PropTypes.string.isRequired,
|
||||||
|
viewUrl: PropTypes.string.isRequired,
|
||||||
|
diffUrl: PropTypes.string.isRequired,
|
||||||
|
onItemRestore: PropTypes.func.isRequired,
|
||||||
|
canDownload: PropTypes.bool.isRequired,
|
||||||
|
canCompare: PropTypes.bool.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
class MoreMenu extends React.PureComponent {
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
dropdownOpen: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
dropdownToggle = () => {
|
||||||
|
this.setState({ dropdownOpen: !this.state.dropdownOpen });
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { index, downloadUrl, viewUrl, diffUrl, onItemRestore, canCompare, canDownload } = this.props;
|
||||||
|
return (
|
||||||
|
<Dropdown isOpen={this.state.dropdownOpen} toggle={this.dropdownToggle} direction="down" className="mx-1 old-history-more-operation">
|
||||||
|
<DropdownToggle
|
||||||
|
tag='i'
|
||||||
|
className='fa fa-ellipsis-v'
|
||||||
|
title={gettext('More Operations')}
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-expanded={this.state.dropdownOpen}
|
||||||
|
>
|
||||||
|
</DropdownToggle>
|
||||||
|
<DropdownMenu className="drop-list" right={true}>
|
||||||
|
{index !== 0 && <a href="#" onClick={onItemRestore}><DropdownItem>{gettext('Restore')}</DropdownItem></a>}
|
||||||
|
{canDownload && <a href={downloadUrl}><DropdownItem>{gettext('Download')}</DropdownItem></a>}
|
||||||
|
<a href={viewUrl}><DropdownItem>{gettext('View')}</DropdownItem></a>
|
||||||
|
{canCompare && <a href={diffUrl}><DropdownItem>{gettext('Diff')}</DropdownItem></a>}
|
||||||
|
</DropdownMenu>
|
||||||
|
</Dropdown>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MoreMenu.propTypes = MoreMenuPropTypes;
|
||||||
|
|
||||||
export default HistoryItem;
|
export default HistoryItem;
|
||||||
|
Reference in New Issue
Block a user