1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

[back] added 'back' for pages

This commit is contained in:
llj
2016-12-13 12:16:39 +08:00
parent e2bd2fdabc
commit f2de948f97
13 changed files with 61 additions and 14 deletions

View File

@@ -68,7 +68,7 @@
<li class="item{% if page == 'home' %} cur-item{% endif %}"><a href="{% url 'group_wiki' group.id %}" class="link">{% trans "Home" %}</a></li> <li class="item{% if page == 'home' %} cur-item{% endif %}"><a href="{% url 'group_wiki' group.id %}" class="link">{% trans "Home" %}</a></li>
<li class="item"><a href="{% url 'group_wiki_pages' group.id %}" class="link">{% trans "Pages" %}</a></li> <li class="item"><a href="{% url 'group_wiki_pages' group.id %}" class="link">{% trans "Pages" %}</a></li>
{% if group.view_perm != "pub" %} {% if group.view_perm != "pub" %}
<li class="item"><a href="{% url 'repo_history' repo_id %}" class="link">{% trans "Wiki History" %}</a></li> <li class="item"><a href="{% url 'repo_history' repo_id %}" class="link" id="wiki-history">{% trans "Wiki History" %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
@@ -240,5 +240,7 @@ $('#wiki-index-con').html(marked('{{ index_content|escapejs }}'));
// for 'go back' // for 'go back'
var $pageHistory = $('#page-history'); var $pageHistory = $('#page-history');
$pageHistory.attr('href', $pageHistory.attr('href') + '&referer=' + encodeURIComponent(location.href)); $pageHistory.attr('href', $pageHistory.attr('href') + '&referer=' + encodeURIComponent(location.href));
var $wikiHistory = $('#wiki-history');
$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href));
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -11,7 +11,7 @@
<li class="item"><a href="{% url 'group_wiki' group.id %}" class="link">{% trans "Home" %}</a></li> <li class="item"><a href="{% url 'group_wiki' group.id %}" class="link">{% trans "Home" %}</a></li>
<li class="item cur-item"><a href="{% url 'group_wiki_pages' group.id %}" class="link">{% trans "Pages" %}</a></li> <li class="item cur-item"><a href="{% url 'group_wiki_pages' group.id %}" class="link">{% trans "Pages" %}</a></li>
{% if group.view_perm != "pub" %} {% if group.view_perm != "pub" %}
<li class="item"><a href="{% url 'repo_history' repo_id %}" class="link">{% trans "Wiki History" %}</a></li> <li class="item"><a href="{% url 'repo_history' repo_id %}" class="link" id="wiki-history">{% trans "Wiki History" %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% if repo_perm == 'rw' %} {% if repo_perm == 'rw' %}
@@ -46,5 +46,7 @@ $('#page-create-form').submit(function() {
return false; return false;
} }
}); });
var $wikiHistory = $('#wiki-history');
$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href));
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -12,9 +12,11 @@
{% block wide_page_content %} {% block wide_page_content %}
<h2>{% blocktrans %}<span class="op-target">{{ u_filename }}</span> Version History{% endblocktrans %}</h2> <h2>{% blocktrans %}<span class="op-target">{{ u_filename }}</span> Version History{% endblocktrans %}</h2>
{% if referer %}
<a href="{{referer}}" class="go-back" title="{% trans "Back" %}"> <a href="{{referer}}" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span> <span class="icon-chevron-left"></span>
</a> </a>
{% endif %}
<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>
<div class="commit-list-topbar ovhd"> <div class="commit-list-topbar ovhd">
@@ -86,7 +88,7 @@
<a href="{% url "download_file" repo.id commit.rev_file_id %}?p={{commit.path|urlencode}}" class="op vh">{% trans 'Download' %}</a> <a href="{% url "download_file" repo.id commit.rev_file_id %}?p={{commit.path|urlencode}}" class="op vh">{% trans 'Download' %}</a>
<a href="{% url 'view_history_file' repo.id %}?obj_id={{ commit.rev_file_id }}&commit_id={{ commit.id }}&p={{commit.path|urlencode}}" class="op vh" target="_blank">{% trans 'View' %}</a> <a href="{% url 'view_history_file' repo.id %}?obj_id={{ commit.rev_file_id }}&commit_id={{ commit.id }}&p={{commit.path|urlencode}}" class="op vh" target="_blank">{% trans 'View' %}</a>
{% if can_compare and not forloop.last %} {% if can_compare and not forloop.last %}
<a href="{% url 'text_diff' repo.id %}?p={{commit.path|urlencode}}&commit={{commit.id}}" class="op vh">{% trans 'Diff' %}</a> <a href="{% url 'text_diff' repo.id %}?p={{commit.path|urlencode}}&commit={{commit.id}}" class="op vh text-diff">{% trans 'Diff' %}</a>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
@@ -117,5 +119,8 @@ $('.restore-file').click(function() {
return false; return false;
}); });
$('.text-diff').each(function() {
$(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href));
});
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -11,9 +11,11 @@
{% block wide_page_content %} {% block wide_page_content %}
<h2 class="repo-trash-hd">{% blocktrans %}<span class="op-target">{{repo_dir_name}}</span> Trash{% endblocktrans %}</h2> <h2 class="repo-trash-hd">{% blocktrans %}<span class="op-target">{{repo_dir_name}}</span> Trash{% endblocktrans %}</h2>
{% if referer %}
<a href="{{referer}}" class="go-back" title="{% trans "Back" %}"> <a href="{{referer}}" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span> <span class="icon-chevron-left"></span>
</a> </a>
{% endif %}
<div class="repo-file-list-topbar ovhd"> <div class="repo-file-list-topbar ovhd">
<p class="path fleft"> <p class="path fleft">
{% trans "Current path: " %} {% trans "Current path: " %}

View File

@@ -13,9 +13,11 @@
{% block wide_page_content %} {% block wide_page_content %}
<h2>{% blocktrans with repo_name=repo.props.name %}<span class="op-target">{{repo_name}}</span> Modification History{% endblocktrans %}</h2> <h2>{% blocktrans with repo_name=repo.props.name %}<span class="op-target">{{repo_name}}</span> Modification History{% endblocktrans %}</h2>
{% if referer %}
<a href="{{referer}}" class="go-back" title="{% trans "Back" %}"> <a href="{{referer}}" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span> <span class="icon-chevron-left"></span>
</a> </a>
{% endif %}
{% if user_perm == 'rw' %} {% if user_perm == 'rw' %}
<p class="tip">{% trans "Tip: a snapshot will be generated after modification, which records the library state after the modification."%}</p> <p class="tip">{% trans "Tip: a snapshot will be generated after modification, which records the library state after the modification."%}</p>
@@ -55,7 +57,7 @@
{% if forloop.first and current_page == 1 %} {% if forloop.first and current_page == 1 %}
<span class="op vh">{% trans "Current Version" %}</span> <span class="op vh">{% trans "Current Version" %}</span>
{% else %} {% else %}
<a href="{% url 'repo_history_view' repo.id %}?commit_id={{ commit.id }}" class="op vh">{% trans "View Snapshot" %}</a> <a href="{% url 'repo_history_view' repo.id %}?commit_id={{ commit.id }}" class="op vh view-snapshot">{% trans "View Snapshot" %}</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</td> </td>
@@ -76,5 +78,8 @@
{% block extra_script %} {% block extra_script %}
<script type="text/javascript"> <script type="text/javascript">
{% include 'snippets/list_commit_detail.html' %} {% include 'snippets/list_commit_detail.html' %}
$('.view-snapshot').each(function() {
$(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href));
});
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -5,7 +5,6 @@
{% block extra_style %} {% block extra_style %}
<style type="text/css"> <style type="text/css">
#main { position: relative; }
.go-back { top:-3px; } .go-back { top:-3px; }
</style> </style>
{% endblock %} {% endblock %}
@@ -13,9 +12,11 @@
{% block wide_page_content %} {% block wide_page_content %}
<h2 class="repo-snapshot-hd">{% blocktrans with repo_name=repo.props.name %}<span class="op-target">{{repo_name}}</span> Snapshot{% endblocktrans %} <span class="commit-time">({{ current_commit.props.ctime|tsstr_sec }})</span></h2> <h2 class="repo-snapshot-hd">{% blocktrans with repo_name=repo.props.name %}<span class="op-target">{{repo_name}}</span> Snapshot{% endblocktrans %} <span class="commit-time">({{ current_commit.props.ctime|tsstr_sec }})</span></h2>
<a href="{% url 'repo_history' repo.props.id %}" class="go-back" title="{% trans "Back to modification history"%}"> {% if referer %}
<a href="{{referer}}" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span> <span class="icon-chevron-left"></span>
</a> </a>
{% endif %}
{% if path == '/' %} {% if path == '/' %}
<div id="repo-latest-commit" class="repo-snapshot-commit"> <div id="repo-latest-commit" class="repo-snapshot-commit">
@@ -39,7 +40,7 @@
{% trans "Current path: "%} {% trans "Current path: "%}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{% url 'repo_history_view' repo.id %}?commit_id={{ current_commit.id }}&p={{ link|urlencode }}">{{ name }}</a> / <a href="{% url 'repo_history_view' repo.id %}?commit_id={{ current_commit.id }}&p={{ link|urlencode }}" class="repo-history-view-link">{{ name }}</a> /
{% else %} {% else %}
{{ name }} {{ name }}
{% endif %} {% endif %}
@@ -62,7 +63,7 @@
{% for dirent in dir_list %} {% for dirent in dir_list %}
<tr> <tr>
<td class="alc"><img src="{{ MEDIA_URL }}img/folder-24.png" alt="{% trans "Directory"%}" /></td> <td class="alc"><img src="{{ MEDIA_URL }}img/folder-24.png" alt="{% trans "Directory"%}" /></td>
<td><a href="{% url 'repo_history_view' repo.id %}?commit_id={{ current_commit.id }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.obj_name }}</a></td> <td><a href="{% url 'repo_history_view' repo.id %}?commit_id={{ current_commit.id }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}" class="repo-history-view-link">{{ dirent.obj_name }}</a></td>
<td></td> <td></td>
<td><a class="op vh restore-dir" data-commit_id="{{ current_commit.id }}" data-commit_path="{{ path }}{{ dirent.obj_name }}" href="#">{% trans "Restore" %}</a></td> <td><a class="op vh restore-dir" data-commit_id="{{ current_commit.id }}" data-commit_path="{{ path }}{{ dirent.obj_name }}" href="#">{% trans "Restore" %}</a></td>
</tr> </tr>
@@ -118,5 +119,8 @@ $('.restore-file, .restore-dir').click(function() {
return false; return false;
}); });
$('.repo-history-view-link').each(function() {
$(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href));
});
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -2,9 +2,20 @@
{% load seahub_tags avatar_tags i18n %} {% load seahub_tags avatar_tags i18n %}
{% load url from future %} {% load url from future %}
{% block extra_style %}
<style type="text/css">
.go-back { top:-3px; }
</style>
{% endblock %}
{% block wide_page_content %} {% block wide_page_content %}
<h2 class="file-modification-hd"><span class="op-target">{{ u_filename }}</span> {% trans "modification details" %} <a href="{% url 'user_profile' current_commit.creator_name %}">{% avatar current_commit.creator_name 16 %}</a><span class="modifier">{{ current_commit.creator_name|email2nickname }}</span><span class="time">{{ current_commit.ctime|translate_seahub_time }}</span></h2> <h2 class="file-modification-hd"><span class="op-target">{{ u_filename }}</span> {% trans "modification details" %} <a href="{% url 'user_profile' current_commit.creator_name %}">{% avatar current_commit.creator_name 16 %}</a><span class="modifier">{{ current_commit.creator_name|email2nickname }}</span><span class="time">{{ current_commit.ctime|translate_seahub_time }}</span></h2>
<button class="fright" data="{% url 'file_revisions' repo.id %}?p={{ path|urlencode }}" id="back">{% trans "Back to file versions"%}</button>
{% if referer %}
<a href="{{referer}}" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span>
</a>
{% endif %}
<p class="path"> <p class="path">
{% trans "Current Path:" %} {% trans "Current Path:" %}
@@ -38,8 +49,5 @@
{% block extra_script %} {% block extra_script %}
<script type="text/javascript"> <script type="text/javascript">
$('#back').click(function() {
location.href = $(this).attr('data');
});
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -77,5 +77,9 @@
} }
} }
}) })
// for 'go back'
var $fileDiff = $('.file-diff');
$fileDiff.attr('href', $fileDiff.attr('href') + '&referer=' + encodeURIComponent(location.href));
</script> </script>
{% endblock%} {% endblock%}

View File

@@ -58,4 +58,9 @@
</script> </script>
{% endifnotequal %} {% endifnotequal %}
{% endif %} {% endif %}
<script type="text/javascript">
// for 'go back'
var $fileDiff = $('.file-diff');
$fileDiff.attr('href', $fileDiff.attr('href') + '&referer=' + encodeURIComponent(location.href));
</script>
{% endblock%} {% endblock%}

View File

@@ -64,7 +64,7 @@
<ul class="wiki-nav fleft"> <ul class="wiki-nav fleft">
<li class="item{% if page == 'home' %} cur-item{% endif %}"><a href="{% url 'personal_wiki' %}" class="link">{% trans "Home" %}</a></li> <li class="item{% if page == 'home' %} cur-item{% endif %}"><a href="{% url 'personal_wiki' %}" class="link">{% trans "Home" %}</a></li>
<li class="item"><a href="{% url 'personal_wiki_pages' %}" class="link">{% trans "Pages" %}</a></li> <li class="item"><a href="{% url 'personal_wiki_pages' %}" class="link">{% trans "Pages" %}</a></li>
<li class="item"><a href="{% url 'repo_history' repo_id %}" target="_blank" class="link">{% trans "Wiki History" %}</a></li> <li class="item"><a href="{% url 'repo_history' repo_id %}" class="link" id="wiki-history">{% trans "Wiki History" %}</a></li>
</ul> </ul>
<button id="page-create" class="btn-white">{% trans "New Page" %}</button> <button id="page-create" class="btn-white">{% trans "New Page" %}</button>
@@ -233,5 +233,7 @@ $('#create-index').click(function() {
// for 'go back' // for 'go back'
var $pageHistory = $('#page-history'); var $pageHistory = $('#page-history');
$pageHistory.attr('href', $pageHistory.attr('href') + '&referer=' + encodeURIComponent(location.href)); $pageHistory.attr('href', $pageHistory.attr('href') + '&referer=' + encodeURIComponent(location.href));
var $wikiHistory = $('#wiki-history');
$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href));
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -12,7 +12,7 @@
<ul class="wiki-nav fleft"> <ul class="wiki-nav fleft">
<li class="item"><a href="{% url 'personal_wiki' %}" class="link">{% trans "Home" %}</a></li> <li class="item"><a href="{% url 'personal_wiki' %}" class="link">{% trans "Home" %}</a></li>
<li class="item cur-item"><a href="{% url 'personal_wiki_pages' %}" class="link">{% trans "Pages" %}</a></li> <li class="item cur-item"><a href="{% url 'personal_wiki_pages' %}" class="link">{% trans "Pages" %}</a></li>
<li class="item"><a href="{% url 'repo_history' repo_id %}" target="_blank" class="link">{% trans "Wiki History" %}</a></li> <li class="item"><a href="{% url 'repo_history' repo_id %}" class="link" id="wiki-history">{% trans "Wiki History" %}</a></li>
</ul> </ul>
<button id="page-create" class="btn-white">{% trans "New Page" %}</button> <button id="page-create" class="btn-white">{% trans "New Page" %}</button>
</div> </div>
@@ -44,5 +44,7 @@ $('#page-create-form').submit(function() {
return false; return false;
} }
}); });
var $wikiHistory = $('#wiki-history');
$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href));
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -1386,6 +1386,8 @@ def text_diff(request, repo_id):
zipped = gen_path_link(path, repo.name) zipped = gen_path_link(path, repo.name)
referer = request.GET.get('referer', '')
return render_to_response('text_diff.html', { return render_to_response('text_diff.html', {
'u_filename':u_filename, 'u_filename':u_filename,
'repo': repo, 'repo': repo,
@@ -1395,6 +1397,7 @@ def text_diff(request, repo_id):
'prev_commit': prev_commit, 'prev_commit': prev_commit,
'diff_result_table': diff_result_table, 'diff_result_table': diff_result_table,
'is_new_file': is_new_file, 'is_new_file': is_new_file,
'referer': referer,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
########## office related ########## office related

View File

@@ -146,6 +146,8 @@ def repo_history_view(request, repo_id):
repo_owner = seafile_api.get_repo_owner(repo.id) repo_owner = seafile_api.get_repo_owner(repo.id)
is_repo_owner = True if username == repo_owner else False is_repo_owner = True if username == repo_owner else False
referer = request.GET.get('referer', '')
return render_to_response('repo_history_view.html', { return render_to_response('repo_history_view.html', {
'repo': repo, 'repo': repo,
"is_repo_owner": is_repo_owner, "is_repo_owner": is_repo_owner,
@@ -155,6 +157,7 @@ def repo_history_view(request, repo_id):
'file_list': file_list, 'file_list': file_list,
'path': path, 'path': path,
'zipped': zipped, 'zipped': zipped,
'referer': referer,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
########## shared dir/uploadlink ########## shared dir/uploadlink