{% extends "theme_editor/base_list.html" %}

{% load i18n %}
{% load humanize %}
{% load base_filters %}

{% block title %}{{ block.super }}Theme Editor{% endblock %}

{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{{ STATIC_URL }}css/theme-editor.css" />
<link rel="stylesheet" href="{{ STATIC_URL }}css/tipsy.css">
{% endblock %}
        
{% block body %}
<div class="t">
    <div class="editor-nav" style="float:right">
        <a href="{% url theme_editor.app_list %}" >{% trans "Back to App List" %}</a>&nbsp;&nbsp;
        <a href="{% url theme_editor.editor %}" >{% trans "Back to Theme-Editor" %}</a>
    </div>
    <h1>{% if app %}{{ app }}{% else %}default{% endif %} templates</h1>
    <strong>{% trans "Choose a folder or file:" %}</strong>
    <div id="right_files_list">
        {% if prev_dir %}
           <p class="prev_dir">
               <a href="{% if app %}{% url theme_editor.original_templates app %}{% else %}{% url theme_editor.original_templates %}{% endif %}?dir={{ prev_dir }}">
               &laquo;&nbsp;{% blocktrans %}back to {{ prev_dir_name }}{% endblocktrans %}
               </a>
           </p>
        {% endif %}
        {% if dirs %}
           <ul class="dir_list">   
                {% for dir in dirs %}
                    <li class="dir_item"><a href="{% if app %}{% url theme_editor.original_templates app %}{% else %}{% url theme_editor.original_templates %}{% endif %}?dir={{ dir }}">
                    {{ dir|basename|safe }}</a></li>
                {% endfor %}
           </ul>
        {%  endif %}
        {%  if files %}
           <ul class="files_list">
                {% for file in files %}
                    <li>
                        {{ file|safe }}<a class="copy" href="{% if app %}{% url theme_editor.copy_to_theme app %}{% else %}{% url theme_editor.copy_to_theme %}{% endif %}?dir={{ current_dir }}&file={{ file }}">
                        &laquo;&nbsp;{% trans "copy to custom templates" %}</a>
                    </li>
                {% endfor %}
           </ul>
        {% endif %}
        {% if not files and not dirs %}
            <p>{% trans "No editable files" %}</p>
        {% endif %}
    </div>
</div>
{% endblock %}

{% block extra_body %}
{{ block.super }}
<script type="text/javascript">
    $(document).ready(function(){
        //bind the modified one
        $('.copy').click(function(){
            if(window.confirm("Do you want to override this template file?")){
                return true;
            } else {
                return false;
            }
        });
    });
</script>
{% endblock %}
