mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
[img_view] enable view prev/next & improved ui
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
{%comment%}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
{% comment %}
|
||||
content of files that can be viewed online shows here.
|
||||
For details please refer to 'snippets/file_content_js.html'.
|
||||
{%endcomment%}
|
||||
{% endcomment %}
|
||||
<div id="file-view">
|
||||
{% if not err %}
|
||||
{% if filetype == 'Text' or filetype == 'Sf' %}
|
||||
@@ -15,7 +17,22 @@ For details please refer to 'snippets/file_content_js.html'.
|
||||
{% endif %}
|
||||
|
||||
{% if filetype == 'Image' %}
|
||||
<img src="{{ raw_path }}" alt="{{ u_filename}}" id="image-view" />
|
||||
{% if page == 'file_view'%}
|
||||
{% if img_prev or img_next %}
|
||||
<div id="img-prev-next">
|
||||
{% if img_prev %}
|
||||
<a href="{% url 'repo_view_file' repo.id %}?p={{img_prev|urlencode}}" id="img-prev" title="{% trans 'you can also press ← ' %}">{% trans "prev" %}</a>
|
||||
{% endif %}
|
||||
{% if img_prev and img_next %}
|
||||
<span>/</span>
|
||||
{% endif %}
|
||||
{% if img_next %}
|
||||
<a href="{% url 'repo_view_file' repo.id %}?p={{img_next|urlencode}}" id="img-next" title="{% trans 'you can also press → ' %}">{% trans "next" %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<img src="{{ raw_path }}" alt="{{ u_filename}}" id="image-view" class="vh" />
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div id="file-view-tip">
|
||||
|
@@ -17,11 +17,21 @@
|
||||
{% endif %}
|
||||
|
||||
{% if filetype == 'Image' %}
|
||||
window.onload = function() {
|
||||
if ($('#image-view').width() > $('#file-view').width()) {
|
||||
$('#image-view').css('width', $('#file-view').width() - 4);
|
||||
}
|
||||
$(window).load(function() {
|
||||
var img_ht = $('#image-view').height();
|
||||
var file_view_ht = parseInt($('#file-view').css('min-height'));
|
||||
var prev_next_ht = 0;
|
||||
if ($('#img-prev-next').length > 0) {
|
||||
prev_next_ht = $('#img-prev-next').outerHeight(true);
|
||||
}
|
||||
if (img_ht < file_view_ht - prev_next_ht) {
|
||||
$('#image-view').css({'margin-top':(file_view_ht - img_ht - prev_next_ht)/2});
|
||||
}
|
||||
if ($('#image-view').outerWidth() > 950) { // for ie 6
|
||||
$('#image-view').css('width', 946);
|
||||
}
|
||||
$('#image-view').removeClass('vh');
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
{% if filetype == 'SVG' %}
|
||||
|
Reference in New Issue
Block a user