mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 07:01:12 +00:00
Merge pull request #773 from haiwen/file-revision
get file history by days
This commit is contained in:
@@ -1197,6 +1197,7 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
#right-panel .hd,
|
#right-panel .hd,
|
||||||
.tabnav,
|
.tabnav,
|
||||||
.repo-file-list-topbar,
|
.repo-file-list-topbar,
|
||||||
|
.commit-list-topbar,
|
||||||
#dir-view .repo-op,
|
#dir-view .repo-op,
|
||||||
.wiki-top {
|
.wiki-top {
|
||||||
padding:9px 10px;
|
padding:9px 10px;
|
||||||
@@ -1217,6 +1218,7 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
#organization-repos .hd {
|
#organization-repos .hd {
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
.commit-list-topbar,
|
||||||
.repo-file-list-topbar {
|
.repo-file-list-topbar {
|
||||||
margin-bottom:0;
|
margin-bottom:0;
|
||||||
}
|
}
|
||||||
@@ -1836,9 +1838,13 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
.repo-file-list-not-show {
|
.repo-file-list-not-show {
|
||||||
padding-left:10px;
|
padding-left:10px;
|
||||||
}
|
}
|
||||||
|
.commit-list-inner-container .commit-list-topbar {
|
||||||
|
padding:8px 10px;
|
||||||
|
}
|
||||||
.repo-file-list-inner-container .repo-file-list-topbar {
|
.repo-file-list-inner-container .repo-file-list-topbar {
|
||||||
padding:8px 10px;
|
padding:8px 10px;
|
||||||
}
|
}
|
||||||
|
.commit-list-topbar .path,
|
||||||
.repo-file-list-topbar .path {
|
.repo-file-list-topbar .path {
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
line-height:25px;
|
line-height:25px;
|
||||||
|
@@ -7,19 +7,38 @@
|
|||||||
{% block main_panel %}
|
{% block main_panel %}
|
||||||
<h2>{{ u_filename }}{% trans "'s Version History" %}</h2>
|
<h2>{{ u_filename }}{% trans "'s Version History" %}</h2>
|
||||||
<p class="tip">{% trans "Tip:a new version will be generated after each modification, and you can restore the file to a previous version." %}</p>
|
<p class="tip">{% trans "Tip:a new version will be generated after each modification, and you can restore the file to a previous version." %}</p>
|
||||||
|
|
||||||
<p class="path">
|
|
||||||
{% trans 'Current Path:' %}
|
|
||||||
{% for name, link in zipped %}
|
|
||||||
{% if not forloop.last %}
|
|
||||||
<a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
|
|
||||||
{% else %}
|
|
||||||
<a href="{% url 'view_lib_file' repo.id path|urlencode %}" target="_blank" >{{ name }}</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</p>
|
|
||||||
<div class="commit-list-outer-container">
|
<div class="commit-list-outer-container">
|
||||||
<div class="commit-list-inner-container">
|
<div class="commit-list-inner-container">
|
||||||
|
<div class="commit-list-topbar">
|
||||||
|
<span class="path">
|
||||||
|
{% trans 'Current Path:' %}
|
||||||
|
{% for name, link in zipped %}
|
||||||
|
{% if not forloop.last %}
|
||||||
|
<a href="{% url 'view_common_lib_dir' repo.id link|urlencode|strip_slash %}">{{ name }}</a> /
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url 'view_lib_file' repo.id path|urlencode %}" target="_blank" >{{ name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="fright">
|
||||||
|
{% if days != 7 %}
|
||||||
|
<a href="?p={{path|urlencode}}&days=7">{% trans "a week" %}</a> /
|
||||||
|
{% else %}
|
||||||
|
{% trans "a week" %} /
|
||||||
|
{% endif %}
|
||||||
|
{% if days != 30 %}
|
||||||
|
<a href="?p={{path|urlencode}}&days=30">{% trans "a month" %}</a> /
|
||||||
|
{% else %}
|
||||||
|
{% trans "a month" %} /
|
||||||
|
{% endif %}
|
||||||
|
{% if days != -1 %}
|
||||||
|
<a href="?p={{path|urlencode}}&days=-1">{% trans "all" %}</a>
|
||||||
|
{% else %}
|
||||||
|
{% trans "all" %}
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<table class="commit-list">
|
<table class="commit-list">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="30%" class="time">{% trans 'Time' %}</th>
|
<th width="30%" class="time">{% trans 'Time' %}</th>
|
||||||
|
@@ -1448,6 +1448,13 @@ def validate_filename(request):
|
|||||||
|
|
||||||
def render_file_revisions (request, repo_id):
|
def render_file_revisions (request, repo_id):
|
||||||
"""List all history versions of a file."""
|
"""List all history versions of a file."""
|
||||||
|
|
||||||
|
days_str = request.GET.get('days', '')
|
||||||
|
try:
|
||||||
|
days = int(days_str)
|
||||||
|
except ValueError:
|
||||||
|
days = 7
|
||||||
|
|
||||||
path = request.GET.get('p', '/')
|
path = request.GET.get('p', '/')
|
||||||
if path[-1] == '/':
|
if path[-1] == '/':
|
||||||
path = path[:-1]
|
path = path[:-1]
|
||||||
@@ -1468,8 +1475,7 @@ def render_file_revisions (request, repo_id):
|
|||||||
can_compare = False
|
can_compare = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
commits = seafserv_threaded_rpc.list_file_revisions(repo_id, path,
|
commits = seafile_api.get_file_revisions(repo_id, path, -1, -1, days)
|
||||||
-1, -1)
|
|
||||||
except SearpcError, e:
|
except SearpcError, e:
|
||||||
logger.error(e.msg)
|
logger.error(e.msg)
|
||||||
return render_error(request, e.msg)
|
return render_error(request, e.msg)
|
||||||
@@ -1512,6 +1518,7 @@ def render_file_revisions (request, repo_id):
|
|||||||
'is_owner': is_owner,
|
'is_owner': is_owner,
|
||||||
'can_compare': can_compare,
|
'can_compare': can_compare,
|
||||||
'can_revert_file': can_revert_file,
|
'can_revert_file': can_revert_file,
|
||||||
|
'days': days,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
Reference in New Issue
Block a user