{% extends "_layout.html" %}

{% block content %}
<div class="page-header">
    <h1>
        <a href="{{ url_for('bepasty.download', name=name) }}">
            <span class="glyphicon glyphicon-download-alt"></span>
        </a>
        {{ item.meta['filename'] }}
    </h1>
</div>

<div class="meta">
    <p>
        Type {{ item.meta.get('type') or 'undefined' }}, Size {{ item.meta['size'] }} bytes.<br/>
        SHA256-Hash: {{ item.meta.get('hash')}}
        <button id="del-btn" type="button" class="btn btn-danger pull-right">Delete File from Server</button>
    </p>
    
</div>

<div class="data">
    {{ rendered_content }}
</div>

{% endblock content %}

{% block extra_script %}
<script src="{{ url_for('static', filename='bootbox/bootbox.min.js') }}" type="text/javascript"></script>
<script type="text/javascript">
$("#del-btn").click(function(){
    bootbox.confirm("Are you sure you want to delete this file?", function(result) {
        if (result == true){
            window.location.replace("{{ url_for('bepasty.delete', name=name) }}");
        }
    }); 
});
</script>
{% endblock extra_script %}
