{% extends "admin/base_site.html" %}
{% load i18n %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% load adminmedia %}{% admin_media_prefix %}css/dashboard.css" />{% endblock %}

{% block coltype %}content{% endblock %}

{% block bodyclass %}dashboard{% endblock %}

{% block breadcrumbs-relative %}<li class='last'>{% trans 'Admin' %}</li>{% endblock %}

{% block content %}
<div id="content-main">

<h2>{% blocktrans count app_list|length as counter %}Application{% plural %}Applications{% endblocktrans %}</h2>
{% if app_list %}
    {% for app in app_list %}
        
        <dl>
        	<dt><a href="{{ app.app_url }}">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></dt>
        	<dd><ul>
	        {% for model in app.models %}
		        {% if model.perms.change or model.perms.add %}
		            <li>
		            {% if model.perms.change %}
		                <a href="{{ model.admin_url }}">{{ model.name }}</a>
					{% else %}
		                {{ model.name }}
		            {% endif %}
					<div class='right'>
			            {% if model.perms.add %}
			                <a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a>
			            {% else %}
			                &nbsp;
			            {% endif %}
			
			            {% if model.perms.change %}
			                <a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a>
			            {% else %}
			                &nbsp;
			            {% endif %}
		            </div>
		            
		            </li>
		    	{% endif %}
	        {% endfor %}
	        
	        </ul></dd>
        </dl>
    {% endfor %}
{% else %}
    <p>{% trans "You don't have permission to edit anything." %}</p>
{% endif %}
</div>
{% endblock %}

{% block sidebar %}

{% if app_list %}
	<ul class='local-color tree treeview'>
    {% for app in app_list %}
        <li class="relative local-color expandable">
        <a href="{{ app.app_url }}">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a>
        <ul style="display: none;">
        
        {% for model in app.models %}
                <li class='expandable' >
                
	                {% if model.perms.change %}
	                	<a href="{{ model.admin_url }}">{{ model.name }}</a>
	                {% else %}
	                	<a href="#">{{ model.name }}</a>
	                {% endif %}
	                
                	<ul style="display: none;">
	                	{% if model.perms.add %}
		                	<li><a href="{{ model.admin_url }}add/">{% trans 'Add' %}</a></li>
			            {% endif %}
			
			            {% if model.perms.change %}
			                <li><a href="{{ model.admin_url }}">{% trans 'Change' %}</a></li>
			            {% endif %}
                	</ul>
                </li>
        {% endfor %}
        
        </ul>
        </li>
    {% endfor %}
    </ul>
{% else %}
    <p>{% trans "You don't have permission to edit anything." %}</p>
{% endif %}

<div class="box">
    <h3>{% trans 'Recent Actions' %}</h3>
        {% load log %}
        {% get_admin_log 10 as admin_log for_user user %}
        {% if not admin_log %}
        <p>{% trans 'None available' %}</p>
        {% else %}
        <ul class="actionlist">
        {% for entry in admin_log %}
        <li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
            {% if entry.is_deletion or not entry.get_admin_url %}
                {{ entry.object_repr }}
            {% else %}
                <a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
            {% endif %}
            <br/>
            {% if entry.content_type %}
                <span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span>
            {% else %}
                <span class="mini quiet">{% trans 'Unknown content' %}</span>
            {% endif %}
        </li>
        {% endfor %}
        </ul>
        {% endif %}
</div>
{% endblock %}
