{% extends 'base.html' %}
{% load seahub_tags avatar_tags i18n %}


{% block viewport %}{% endblock %}

{% block extra_style %}
{% include 'snippets/file_view_style.html' %}
{% endblock %}

{% block header_css_class %}hide{% endblock %}
{% block main_class %}ovhd d-flex fd-col{% endblock %}

{% block main_content %}
    <div id="view-hd" class="ovhd">
        <div class="fleft">
            <h2 class="file-view-hd">{{file_name}}</h2>
            {% block file_path %}
            <p class="file-view-meta-info">{{ current_commit.props.ctime|tsstr_sec }}</p>
            {% endblock %}
        </div>

        <a class="file-view-op sf-btn-link fright" href="{% url 'download_file' repo.id obj_id%}?file_name={{ file_name|urlencode }}&p={{path|urlencode}}" id="download">{% trans "Download"%}</a>
    </div>

    {% include 'snippets/file_content_html.html' %}
{% endblock %}

{% block extra_script %}
{% include "snippets/file_view_js.html" %}
<script type="text/javascript">
$(function() {
    var dld_url = $('#download').attr('href');
    $('#file-view-tip').append('<a href="' + dld_url + '" class="sf-btn-link big-btn-link">' + "{% trans "Download" %}" + '</a>');
});

{% if filetype == 'Image' and not err %}
    $('#image-view').attr('src', '{{ raw_path|escapejs }}');
{% endif %}

{% include "snippets/file_content_js.html" %}
</script>
{% if enable_watermark %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/watermark.js"></script>
<script type="text/javascript">{% include "snippets/add_watermark.html" %}</script>
{% endif %}
{% endblock %}
