1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

[back] fix

This commit is contained in:
llj
2017-03-29 14:35:30 +08:00
parent 95c157a0b7
commit d3644c2f69
6 changed files with 20 additions and 12 deletions

View File

@@ -124,13 +124,6 @@ $('.text-diff').each(function() {
$(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href));
});
$('.go-back').click(function() {
var referer = '{{referer|escapejs}}';
var str = location.protocol + '//' + location.host;
if (referer.indexOf(str) == 0) {
location.href = referer;
}
return false;
});
{% include 'snippets/go_back_js.html' %}
</script>
{% endblock %}

View File

@@ -12,7 +12,7 @@
{% block wide_page_content %}
<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="#" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span>
</a>
{% endif %}
@@ -179,5 +179,7 @@ $('table').on("click", ".restore-file, .restore-dir", function() {
return false;
});
{% endif %}
{% include 'snippets/go_back_js.html' %}
</script>
{% endblock %}

View File

@@ -14,7 +14,7 @@
<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="#" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span>
</a>
{% endif %}
@@ -81,5 +81,7 @@
$('.view-snapshot').each(function() {
$(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href));
});
{% include 'snippets/go_back_js.html' %}
</script>
{% endblock %}

View File

@@ -13,7 +13,7 @@
<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>
{% if referer %}
<a href="{{referer}}" class="go-back" title="{% trans "Back" %}">
<a href="#" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span>
</a>
{% endif %}
@@ -122,5 +122,7 @@ $('.restore-file, .restore-dir').click(function() {
$('.repo-history-view-link').each(function() {
$(this).attr('href', $(this).attr('href') + '&referer=' + encodeURIComponent(location.href));
});
{% include 'snippets/go_back_js.html' %}
</script>
{% endblock %}

View File

@@ -0,0 +1,8 @@
$('.go-back').click(function() {
var referer = '{{referer|escapejs}}';
var str = location.protocol + '//' + location.host;
if (referer.indexOf(str) == 0) { // check referer
location.href = referer;
}
return false;
});

View File

@@ -12,7 +12,7 @@
<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>
{% if referer %}
<a href="{{referer}}" class="go-back" title="{% trans "Back" %}">
<a href="#" class="go-back" title="{% trans "Back" %}">
<span class="icon-chevron-left"></span>
</a>
{% endif %}
@@ -49,5 +49,6 @@
{% block extra_script %}
<script type="text/javascript">
{% include 'snippets/go_back_js.html' %}
</script>
{% endblock %}