From f2de948f976d6f33e0fff41d81aca1f6f5445c3f Mon Sep 17 00:00:00 2001 From: llj Date: Tue, 13 Dec 2016 12:16:39 +0800 Subject: [PATCH] [back] added 'back' for pages --- seahub/group/templates/group/group_wiki.html | 4 +++- .../group/templates/group/group_wiki_pages.html | 4 +++- seahub/templates/file_revisions.html | 7 ++++++- seahub/templates/repo_dir_recycle_view.html | 2 ++ seahub/templates/repo_history.html | 7 ++++++- seahub/templates/repo_history_view.html | 12 ++++++++---- seahub/templates/text_diff.html | 16 ++++++++++++---- seahub/templates/view_file_markdown.html | 4 ++++ seahub/templates/view_file_text.html | 5 +++++ seahub/templates/wiki/personal_wiki.html | 4 +++- seahub/templates/wiki/personal_wiki_pages.html | 4 +++- seahub/views/file.py | 3 +++ seahub/views/repo.py | 3 +++ 13 files changed, 61 insertions(+), 14 deletions(-) diff --git a/seahub/group/templates/group/group_wiki.html b/seahub/group/templates/group/group_wiki.html index 02da68b967..4cc31ad623 100644 --- a/seahub/group/templates/group/group_wiki.html +++ b/seahub/group/templates/group/group_wiki.html @@ -68,7 +68,7 @@
  • {% trans "Home" %}
  • {% trans "Pages" %}
  • {% if group.view_perm != "pub" %} -
  • {% trans "Wiki History" %}
  • +
  • {% trans "Wiki History" %}
  • {% endif %} @@ -240,5 +240,7 @@ $('#wiki-index-con').html(marked('{{ index_content|escapejs }}')); // for 'go back' var $pageHistory = $('#page-history'); $pageHistory.attr('href', $pageHistory.attr('href') + '&referer=' + encodeURIComponent(location.href)); +var $wikiHistory = $('#wiki-history'); +$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href)); {% endblock %} diff --git a/seahub/group/templates/group/group_wiki_pages.html b/seahub/group/templates/group/group_wiki_pages.html index f00effbdc6..71d176099a 100644 --- a/seahub/group/templates/group/group_wiki_pages.html +++ b/seahub/group/templates/group/group_wiki_pages.html @@ -11,7 +11,7 @@
  • {% trans "Home" %}
  • {% trans "Pages" %}
  • {% if group.view_perm != "pub" %} -
  • {% trans "Wiki History" %}
  • +
  • {% trans "Wiki History" %}
  • {% endif %} {% if repo_perm == 'rw' %} @@ -46,5 +46,7 @@ $('#page-create-form').submit(function() { return false; } }); +var $wikiHistory = $('#wiki-history'); +$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href)); {% endblock %} diff --git a/seahub/templates/file_revisions.html b/seahub/templates/file_revisions.html index f9e3b787bc..b9cbcd58f2 100644 --- a/seahub/templates/file_revisions.html +++ b/seahub/templates/file_revisions.html @@ -12,9 +12,11 @@ {% block wide_page_content %}

    {% blocktrans %}{{ u_filename }} Version History{% endblocktrans %}

    +{% if referer %} +{% endif %}

    {% trans "Tip: a new version will be generated after each modification, and you can restore the file to a previous version." %}

    @@ -86,7 +88,7 @@ {% trans 'Download' %} {% trans 'View' %} {% if can_compare and not forloop.last %} - {% trans 'Diff' %} + {% trans 'Diff' %} {% endif %} @@ -117,5 +119,8 @@ $('.restore-file').click(function() { return false; }); +$('.text-diff').each(function() { + $(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href)); +}); {% endblock %} diff --git a/seahub/templates/repo_dir_recycle_view.html b/seahub/templates/repo_dir_recycle_view.html index 0278aad0ae..1df3d6b957 100644 --- a/seahub/templates/repo_dir_recycle_view.html +++ b/seahub/templates/repo_dir_recycle_view.html @@ -11,9 +11,11 @@ {% block wide_page_content %}

    {% blocktrans %}{{repo_dir_name}} Trash{% endblocktrans %}

    +{% if referer %} +{% endif %}

    {% trans "Current path: " %} diff --git a/seahub/templates/repo_history.html b/seahub/templates/repo_history.html index a35e6ac83b..93e3e82653 100644 --- a/seahub/templates/repo_history.html +++ b/seahub/templates/repo_history.html @@ -13,9 +13,11 @@ {% block wide_page_content %}

    {% blocktrans with repo_name=repo.props.name %}{{repo_name}} Modification History{% endblocktrans %}

    + {% if referer %} + {% endif %} {% if user_perm == 'rw' %}

    {% trans "Tip: a snapshot will be generated after modification, which records the library state after the modification."%}

    @@ -55,7 +57,7 @@ {% if forloop.first and current_page == 1 %} {% trans "Current Version" %} {% else %} - {% trans "View Snapshot" %} + {% trans "View Snapshot" %} {% endif %} {% endif %} @@ -76,5 +78,8 @@ {% block extra_script %} {% endblock %} diff --git a/seahub/templates/repo_history_view.html b/seahub/templates/repo_history_view.html index 51b450761b..914ff91b2e 100644 --- a/seahub/templates/repo_history_view.html +++ b/seahub/templates/repo_history_view.html @@ -5,7 +5,6 @@ {% block extra_style %} {% endblock %} @@ -13,9 +12,11 @@ {% block wide_page_content %}

    {% blocktrans with repo_name=repo.props.name %}{{repo_name}} Snapshot{% endblocktrans %} ({{ current_commit.props.ctime|tsstr_sec }})

    - +{% if referer %} + +{% endif %} {% if path == '/' %}
    @@ -39,7 +40,7 @@ {% trans "Current path: "%} {% for name, link in zipped %} {% if not forloop.last %} - {{ name }} / + {{ name }} / {% else %} {{ name }} {% endif %} @@ -62,7 +63,7 @@ {% for dirent in dir_list %} {% trans - {{ dirent.obj_name }} + {{ dirent.obj_name }} {% trans "Restore" %} @@ -118,5 +119,8 @@ $('.restore-file, .restore-dir').click(function() { return false; }); +$('.repo-history-view-link').each(function() { + $(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href)); +}); {% endblock %} diff --git a/seahub/templates/text_diff.html b/seahub/templates/text_diff.html index 3263d4cb09..afb525ebee 100644 --- a/seahub/templates/text_diff.html +++ b/seahub/templates/text_diff.html @@ -2,9 +2,20 @@ {% load seahub_tags avatar_tags i18n %} {% load url from future %} +{% block extra_style %} + +{% endblock %} + {% block wide_page_content %}

    {{ u_filename }} {% trans "modification details" %} {% avatar current_commit.creator_name 16 %}{{ current_commit.creator_name|email2nickname }}{{ current_commit.ctime|translate_seahub_time }}

    - + +{% if referer %} + + + +{% endif %}

    {% trans "Current Path:" %} @@ -38,8 +49,5 @@ {% block extra_script %} {% endblock %} diff --git a/seahub/templates/view_file_markdown.html b/seahub/templates/view_file_markdown.html index 1ba768c050..773921dca9 100644 --- a/seahub/templates/view_file_markdown.html +++ b/seahub/templates/view_file_markdown.html @@ -77,5 +77,9 @@ } } }) + + // for 'go back' + var $fileDiff = $('.file-diff'); + $fileDiff.attr('href', $fileDiff.attr('href') + '&referer=' + encodeURIComponent(location.href)); {% endblock%} diff --git a/seahub/templates/view_file_text.html b/seahub/templates/view_file_text.html index 3db078803e..6d098dba30 100644 --- a/seahub/templates/view_file_text.html +++ b/seahub/templates/view_file_text.html @@ -58,4 +58,9 @@ {% endifnotequal %} {% endif %} + {% endblock%} diff --git a/seahub/templates/wiki/personal_wiki.html b/seahub/templates/wiki/personal_wiki.html index 2e593718c8..f05188a2c4 100644 --- a/seahub/templates/wiki/personal_wiki.html +++ b/seahub/templates/wiki/personal_wiki.html @@ -64,7 +64,7 @@

    @@ -233,5 +233,7 @@ $('#create-index').click(function() { // for 'go back' var $pageHistory = $('#page-history'); $pageHistory.attr('href', $pageHistory.attr('href') + '&referer=' + encodeURIComponent(location.href)); +var $wikiHistory = $('#wiki-history'); +$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href)); {% endblock %} diff --git a/seahub/templates/wiki/personal_wiki_pages.html b/seahub/templates/wiki/personal_wiki_pages.html index 975e8d562b..6964f0b09a 100644 --- a/seahub/templates/wiki/personal_wiki_pages.html +++ b/seahub/templates/wiki/personal_wiki_pages.html @@ -12,7 +12,7 @@
    @@ -44,5 +44,7 @@ $('#page-create-form').submit(function() { return false; } }); +var $wikiHistory = $('#wiki-history'); +$wikiHistory.attr('href', $wikiHistory.attr('href') + '?referer=' + encodeURIComponent(location.href)); {% endblock %} diff --git a/seahub/views/file.py b/seahub/views/file.py index a638507fcf..4143fbed8f 100644 --- a/seahub/views/file.py +++ b/seahub/views/file.py @@ -1386,6 +1386,8 @@ def text_diff(request, repo_id): zipped = gen_path_link(path, repo.name) + referer = request.GET.get('referer', '') + return render_to_response('text_diff.html', { 'u_filename':u_filename, 'repo': repo, @@ -1395,6 +1397,7 @@ def text_diff(request, repo_id): 'prev_commit': prev_commit, 'diff_result_table': diff_result_table, 'is_new_file': is_new_file, + 'referer': referer, }, context_instance=RequestContext(request)) ########## office related diff --git a/seahub/views/repo.py b/seahub/views/repo.py index f068942c75..004b039a7e 100644 --- a/seahub/views/repo.py +++ b/seahub/views/repo.py @@ -146,6 +146,8 @@ def repo_history_view(request, repo_id): repo_owner = seafile_api.get_repo_owner(repo.id) is_repo_owner = True if username == repo_owner else False + referer = request.GET.get('referer', '') + return render_to_response('repo_history_view.html', { 'repo': repo, "is_repo_owner": is_repo_owner, @@ -155,6 +157,7 @@ def repo_history_view(request, repo_id): 'file_list': file_list, 'path': path, 'zipped': zipped, + 'referer': referer, }, context_instance=RequestContext(request)) ########## shared dir/uploadlink