1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 01:44:13 +00:00

[repo_view_file]modified file-view from file_revisions;clean code

This commit is contained in:
llj
2012-09-22 11:37:01 +08:00
parent b8079d6ea5
commit a3e78bcfa4

View File

@@ -7,16 +7,25 @@
{% endblock %}
{% block main_panel %}
<h2>
{% if not view_history %}
{{ u_filename }}
{% else %}
{{repo.props.name}}
{% if page_from == 'snapshot' %}镜像浏览{% endif %}
{% if page_from == 'file_history' %}历史浏览{% endif %}
<span class="commit-time">({{ current_commit.props.ctime|tsstr_sec }})</span>
{% if not view_history %}
<h2>{{ u_filename }}</h2>
{% else %}
{% if page_from == 'snapshot' %}
<h2>
{{repo.props.name}} 镜像浏览
<span class="commit-time">({{ current_commit.props.ctime|tsstr_sec }})</span>
</h2>
{% endif %}
</h2>
{% if page_from == 'file_history' %}
<div class="w100 ovhd">
<h2 class="fleft">
{{repo.props.name}} 历史浏览
<span class="commit-time">({{ current_commit.props.ctime|tsstr_sec }})</span>
</h2>
<button class="fright" data="{% url 'file_revisions' repo.id %}?p={{ path|urlencode }}" id="back">返回文件版本列表</button>
</div>
{% endif %}
{% endif %}
<div class="w100 ovhd">
<p class="path fleft">
当前路径:
@@ -32,11 +41,7 @@
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> /
{% endif %}
{% else %}
{% if view_history and page_from == 'file_history' %}
<a href="{% url 'file_revisions' repo.id %}?p={{ link|urlencode }}" title="返回文件历史列表">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}
{% endif %}
{% endfor %}
</p>
@@ -160,11 +165,8 @@
$('#view-original, #download').click(function() {
window.open($(this).attr('data'));
});
$('#history').click(function() {
location.href = $(this).attr('data');
});
{% if not view_history %}
$('#edit').click(function() {
$('#edit, #history').click(function() {
location.href = $(this).attr('data');
});
function showLink() {
@@ -337,8 +339,6 @@ $('#file-comment-form .submit').click(function() {
});
{% endif %}
{% endif %}
function send_open_local_file_request(path) {
var callback = 'xx';
$.ajax({
@@ -381,13 +381,6 @@ $('#download-repo').click(function() {
location.href = $(this).attr('data');
});
// When user clicks 'open local file':
//
// - First, check client version to determine is this operation supported by client
// - second check whether repo exists on local machine, then:
// - if exists, send an open local file requst
// - if not exits, redirect to repo download page
$('#open-local').click(function () {
var path = $(this).attr('data');
var local_applet_running = false;
@@ -420,5 +413,13 @@ $('#open-local').click(function () {
}
}, 2000);
});
//'not view_history' ends here
{% endif %}
{% if view_history and page_from == 'file_history' %}
$('#back').click(function() {
location.href = $(this).attr('data');
});
{% endif %}
</script>
{% endblock %}