1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-14 22:33:17 +00:00

activity op color (#3109)

This commit is contained in:
王健辉
2019-03-14 12:01:59 +08:00
committed by Daniel Pan
parent 9210a0dcfe
commit 0ab19cb898
2 changed files with 27 additions and 1 deletions

View File

@@ -3,4 +3,22 @@ table tr .activity-date {
}
table td .activity-detail {
display: inline;
}
td .op-color-orange {
background-color: #FFA94D;
padding: 5px 8px;
border-radius: 5px;
color: #FFF;
}
td .op-color-red {
background-color: #DC143C;
padding: 5px 8px;
border-radius: 5px;
color: #FFF;
}
td .op-color-green {
background-color: #8DC72E;
padding: 5px 8px;
border-radius: 5px;
color: #FFF;
}

View File

@@ -89,6 +89,7 @@ class ActivityItem extends Component {
render() {
let {item, index, items} = this.props;
let op, details;
let opColor = '';
let userProfileURL = `${siteRoot}profile/${encodeURIComponent(item.author_email)}/`;
let libURL = siteRoot + 'library/' + item.repo_id + '/' + encodeURIComponent(item.repo_name) + '/';
@@ -126,6 +127,7 @@ class ActivityItem extends Component {
let fileURL = `${siteRoot}lib/${item.repo_id}/file${Utils.encodePath(item.path)}`;
let fileLink = <a href={fileURL} target="_blank">{item.name}</a>;
op = gettext('Publish draft');
opColor = 'orange';
details = <td>{fileLink}<br />{smallLibLink}</td>;
} else if (item.obj_type == 'files') {
let fileURL = `${siteRoot}lib/${item.repo_id}/file${Utils.encodePath(item.path)}`;
@@ -148,19 +150,23 @@ class ActivityItem extends Component {
case 'create':
if (item.name.endsWith('(draft).md')) {
op = gettext('Created draft');
opColor = 'green';
details = <td>{fileLink}<br />{smallLibLink}</td>;
break;
}
op = gettext('Created file');
opColor = 'green';
details = <td>{fileLink}<br />{smallLibLink}</td>;
break;
case 'delete':
if (item.name.endsWith('(draft).md')) {
op = gettext('Deleted draft');
opColor = 'red';
details = <td>{item.name}<br />{smallLibLink}</td>;
break;
}
op = gettext('Deleted file');
opColor = 'red';
details = <td>{item.name}<br />{smallLibLink}</td>;
break;
case 'recover':
@@ -179,10 +185,12 @@ class ActivityItem extends Component {
case 'edit': // update
if (item.name.endsWith('(draft).md')) {
op = gettext('Updated draft');
opColor = 'orange';
details = <td>{fileLink}<br />{smallLibLink}</td>;
break;
}
op = gettext('Updated file');
opColor = 'orange';
details = <td>{fileLink}<br />{smallLibLink}</td>;
break;
}
@@ -234,7 +242,7 @@ class ActivityItem extends Component {
<td>
<a href={userProfileURL}>{item.author_name}</a>
</td>
<td><span className="activity-op">{op}</span></td>
<td><span className={`activity-op op-color-${opColor}`}>{op}</span></td>
{details}
<td className="text-secondary">
<time datetime={item.time} is="relative-time" title={moment(item.time).format('llll')}>{moment(item.time).fromNow()}</time>