Browse Source

Adicionado snippets e template para index de app.

0.2
Guilherme Gondim 16 years ago
parent
commit
38000339b4
  1. 2
      sigi/settings.py
  2. 1
      sigi/sites.py
  3. 8
      sigi/templates/app_index.html
  4. 63
      sigi/templates/index.html
  5. 32
      sigi/templates/snippets/modules/actions.html
  6. 10
      sigi/templates/snippets/modules/user.html

2
sigi/settings.py

@ -87,6 +87,8 @@ INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.admindocs',
'django_extensions', # http://django-command-extensions.googlecode.com/
'GChartWrapper.charts',
'sigi.apps.log',
'sigi.apps.casas',
'sigi.apps.contatos',
'sigi.apps.convenios',

1
sigi/sites.py

@ -26,6 +26,7 @@ from sigi.apps.parlamentares.admin import (Partido, PartidoAdmin, Parlamentar,
class DefaultSite(AdminSite):
index_template = 'index.html'
login_template = 'login.html'
app_index_template = 'app_index.html'
default = DefaultSite()

8
sigi/templates/app_index.html

@ -0,0 +1,8 @@
{% extends "admin/app_index.html" %}
{% block sidebar %}
<div id="content-related">
{% include "snippets/modules/user.html" %}
{% include "snippets/modules/actions.html" %}
</div>
{% endblock %}

63
sigi/templates/index.html

@ -5,39 +5,46 @@
{% block content_title %}<h1>Dashboard</h1>{% endblock %}
{% block sidebar %}
<div id="content-related">
<div class="module" id="recent-actions-module">
<h2>Atividades recentes</h2>
<h3>Últimas atividades</h3>
{% load log %}
{% get_admin_log 10 as admin_log %}
{% if not admin_log %}
<p>Não disponível.</p>
{% block content %}
<div id="content-main">
{% if app_list %}
{% for app in app_list %}
<div class="module">
<table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
<caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
{% for model in app.models %}
<tr>
{% if model.perms.change %}
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
{% 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 not entry.is_deletion %}<a href="{{ entry.get_admin_url }}">{% endif %}
{{ entry.object_repr|escape }}
{% if not entry.is_deletion %}</a>{% endif %}
<br />
<span class="mini quiet">
{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}, por
<i>
{% if entry.user.first_name %}
{{ entry.user.first_name }}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.perms.add %}
<td><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
{% if model.perms.change %}
<td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
{% else %}
{{ entry.user.username }}
<td>&nbsp;</td>
{% endif %}
</i>
</span>
</li>
</tr>
{% endfor %}
</ul>
</table>
</div>
{% endfor %}
{% else %}
<p>{% trans "You don't have permission to edit anything." %}</p>
{% endif %}
</div>
{% endblock %}
{% block sidebar %}
<div id="content-related">
{% include "snippets/modules/user.html" %}
{% include "snippets/modules/actions.html" %}
</div>
{% endblock %}

32
sigi/templates/snippets/modules/actions.html

@ -0,0 +1,32 @@
{% load i18n log %}
<div class="module" id="recent-actions-module">
<h2>Atividades recentes</h2>
<h3>Últimas atividades</h3>
{% get_admin_log 10 as admin_log %}
{% if not admin_log %}
<p>Não disponível.</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 not entry.is_deletion %}<a href="{{ entry.get_admin_url }}">{% endif %}
{{ entry.object_repr|escape }}
{% if not entry.is_deletion %}</a>{% endif %}
<br />
<span class="mini quiet">
{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}, por
<i>
{% if entry.user.first_name %}
{{ entry.user.first_name }}
{% else %}
{{ entry.user.username }}
{% endif %}
</i>
</span>
</li>
{% endfor %}
</ul>
{% endif %}
</div>

10
sigi/templates/snippets/modules/user.html

@ -0,0 +1,10 @@
{% load i18n %}
<div class="module" id="user-module">
<h2>Meu espaço</h2>
<h3>{{ user.get_full_name }}</h3>
<ul>
<li><a href="{{ root_path }}password_change/">Alterar senha</a></li>
<li><a href="{{ root_path }}logout/">Encerrar sessão</a></li>
</ul>
</div>
Loading…
Cancel
Save