1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-24 01:30:57 +00:00
seahub/templates/repo_history.html
2012-06-01 02:10:31 +08:00

130 lines
4.4 KiB
HTML

{% extends "myhome_base.html" %}
{% load seahub_tags %}
{% block left_panel %}
<h3>操作</h3>
<ul class="with-bg">
<li><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">返回同步目录</a></li>
</ul>
{% endblock %}
{% block right_panel %}
<h2 class="repo-history">{{repo.props.name}} 修改历史</h2>
<table>
<tr>
<th width="12%">修改时间</th>
<th width="10%">修改者</th>
<th width="65%">描述</th>
<th width="13%">操作</th>
</tr>
{% for commit in commits %}
<tr>
<td>{{ commit.props.ctime|translate_commit_time }}</td>
{% if commit.props.creator_name %}
<td>{{ commit.props.creator_name }}</td>
{% else %}
<td>未知</td>
{% endif %}
<td>
{{ commit.props.desc|translate_commit_desc }}
{% if not forloop.last %}
<a class="lsch" href="{{ SITE_ROOT }}repo/history/changes/{{ repo.id }}/?commit_id={{ commit.id }}" data="{{ commit.props.ctime|tsstr_sec }}">详情</a>
{% endif %}
</td>
{% if not forloop.last %}
<td>
<a href="{{ SITE_ROOT }}repo/history/dir/{{ repo.id }}/?commit_id={{ commit.id }}" class="op">浏览</a>
{% if is_owner %}
<a href="#" data="{{ SITE_ROOT }}repo/history/revert/{{ repo.id }}/?commit_id={{ commit.id }}" class="repo-revert op">还原</a>
{% endif %}
</td>
{% else %}
<td></td>
{% endif %}
</tr>
{% endfor %}
</table>
<div id="paginator">
{% if current_page != 1 %}
<a href="?page={{ prev_page }}&per_page={{ per_page }}">上一页</a>
{% endif %}
{% if page_next %}
<a href="?page={{ next_page }}&per_page={{ per_page }}">下一页</a>
{% endif %}
<span>每页:</span>
{% if per_page == 25 %}
<span> 25 </span>
{% else %}
<a href="?per_page=25" class="per-page">25</a>
{% endif %}
{% if per_page == 50 %}
<span> 50 </span>
{% else %}
<a href="?per_page=50" class="per-page">50</a>
{% endif %}
{% if per_page == 100 %}
<span> 100 </span>
{% else %}
<a href="?per_page=100" class="per-page">100</a>
{% endif %}
</div>
<div id="ls-ch" class="hide"></div><!--list modification details of a commit-->
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
//list modification made by a commit
$('.lsch').each(function() {
$(this).click(function() {
var str_time_author = '<span class="latest-commit-time-author">(' + $(this).attr('data') + ')</span>';
$.ajax({
url: $(this).attr('href'),
dataType: 'json',
cache: false,
contentType: 'application/json; charset=utf-8',
success: function(data) {
var str_title = '<h3>修改详情' + str_time_author + '</h3>';
var str_con = '';
var show = function(data_) {
str_con += '<ul>';
for (var i = 0, len = data_.length; i < len; i++) {
str_con += '<li>' + data_[i] + '</li>';
}
str_con += '</ul>';
};
if (data['new'].length > 0) {
str_con += '<h4 id="ls-ch-new">新文件</h4>';
show(data['new']);
}
if (data['removed'].length > 0) {
str_con += '<h4 id="ls-ch-rm">删除的文件</h4>';
show(data['removed']);
}
if (data['renamed'].length > 0) {
str_con += '<h4 id="ls-ch-rn">移动的文件</h4>';
show(data['renamed']);
}
if (data['modified'].length > 0) {
str_con += '<h4 id="ls-ch-modi">修改的文件</h4>';
show(data['modified']);
}
if (!str_con) {
str_con = '<p>没有文件被改动</p>';
}
$('#ls-ch').html(str_title + str_con);
$('#ls-ch').modal({appendTo:'#main'});
}
});
return false;
});
});
addConfirmTo($(".repo-revert"), '确定要还原该目录?');
</script>
{% endblock %}