diff --git a/requirements/dev.txt b/requirements/dev.txt
index 2a390c0..0173913 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -8,6 +8,7 @@ django-dynamic-fixture==1.7.0
coverage==3.7.1
pytest-cov==1.8.0
pyPdf==1.13
+pyquery==1.2.9
# para desevolvimento
django-debug-toolbar==1.2.1
diff --git a/requirements/producao.txt b/requirements/producao.txt
index 24361ba..6f34ca4 100644
--- a/requirements/producao.txt
+++ b/requirements/producao.txt
@@ -5,7 +5,6 @@ django-autoslug==1.7.2
django-extensions==1.4.0
git+git://github.com/jacobian/django-googlecharts.git@c542996cf9a7a097b447e1ce5a1a6b66bdad254f#egg=django_googlecharts
django-localflavor==1.0
-django-treemenus==0.9.1
eav-django==1.4.7
html5lib==0.999
pisa==3.0.33
diff --git a/sigi/apps/home/__init__.py b/sigi/apps/home/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/sigi/apps/home/templates/menus/menu.html b/sigi/apps/home/templates/menus/menu.html
new file mode 100644
index 0000000..7bac3ae
--- /dev/null
+++ b/sigi/apps/home/templates/menus/menu.html
@@ -0,0 +1,6 @@
+{% load menus %}
+
+ {% for menu_item in menu_items %}
+ {% show_menu_item menu_item base_url %}
+ {% endfor %}
+
diff --git a/sigi/apps/home/templates/menus/menu_item.html b/sigi/apps/home/templates/menus/menu_item.html
new file mode 100644
index 0000000..71f61e0
--- /dev/null
+++ b/sigi/apps/home/templates/menus/menu_item.html
@@ -0,0 +1,17 @@
+{% load menus %}
+ {% if menu_item.children %}
+
+ {% if menu_item.url %}
+ {{ menu_item.title }}
+ {% else %}
+ {{ menu_item.title }}
+ {% endif %}
+
+
+ {% else %}
+ {{ menu_item.title }}
+ {% endif %}
diff --git a/sigi/apps/home/templatetags/__init__.py b/sigi/apps/home/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/sigi/apps/home/templatetags/menu_conf.yaml b/sigi/apps/home/templatetags/menu_conf.yaml
new file mode 100644
index 0000000..2715269
--- /dev/null
+++ b/sigi/apps/home/templatetags/menu_conf.yaml
@@ -0,0 +1,97 @@
+main_menu:
+ - title: Gráficos
+ url: ''
+ - title: Municípios
+ url: admin:contatos/municipio/
+ children:
+ - title: Municípios
+ url: contatos/municipio/
+ - title: Unidades Federativas
+ url: contatos/unidadefederativa/
+ - title: Casas Legislativas
+ url: casas/casalegislativa/
+ children:
+ - title: Todas
+ url: casas/casalegislativa/
+ - title: Câmaras Municipais
+ url: casas/casalegislativa/?tipo__id__exact=1
+ - title: Assembléias Legislativas
+ url: casas/casalegislativa/?tipo__id__exact=2
+ - title: Legislaturas
+ url: mesas/legislatura/
+ children:
+ - title: Todas
+ url: mesas/legislatura/
+ - title: Parlamentares
+ url: parlamentares/parlamentar/
+ - title: Tabela de cargos
+ url: mesas/cargo/
+ - title: Tabela de partidos
+ url: parlamentares/partido/
+ - title: Diagnósticos
+ url: diagnosticos/diagnostico/
+ children:
+ - title: Administração
+ url: diagnosticos/diagnostico/
+ - title: Coleta de dados
+ url: diagnosticos/mobile/
+ - title: Gráficos e estatísticas
+ url: diagnosticos-graficos
+ - title: Convênios
+ url: convenios/convenio/
+ children:
+ - title: Convênios
+ url: convenios/convenio/
+ - title: Planos diretores
+ url: metas/planodiretor/
+ - title: Inventário
+ url: inventario/bem/
+ children:
+ - title: Bens
+ url: inventario/bem/
+ - title: Fornecedores
+ url: inventario/fornecedor/
+ - title: Equipamentos
+ url: inventario/equipamento/
+ - title: Fabricantes
+ url: inventario/fabricante/
+ - title: Tipos de equipamentos
+ url: inventario/tipoequipamento/
+ - title: Modelos de equipamentos
+ url: inventario/modeloequipamento/
+ - title: Servidores
+ url: servidores/servidor/?user__is_active__exact=1
+ children:
+ - title: Pessoal
+ url: servidores/servidor/?user__is_active__exact=1
+ - title: Funções
+ url: servidores/funcao
+ - title: Férias
+ url: servidores/ferias/
+ - title: Licenças
+ url: servidores/licenca/
+ - title: Serviços SEIT
+ url: servicos/casaatendida/
+ children:
+ - title: Tipos de serviço
+ url: servicos/tiposervico/
+ - title: Casas atendidas
+ url: servicos/casaatendida/
+ - title: Lista de serviços
+ url: servicos/servico/
+ - title: Ocorrências
+ url: ocorrencias/ocorrencia/?grupo=S&status__in=1,2
+ children:
+ - title: Registro de ocorrências
+ url: ocorrencias/ocorrencia/?grupo=S&status__in=1,2
+ - title: Tabela de categorias
+ url: ocorrencias/categoria/
+ - title: Tipos de contato
+ url: ocorrencias/tipocontato/
+ - title: Financeiro
+ url: financeiro/desembolso/
+ children:
+ - title: Desembolsos
+ url: financeiro/desembolso/
+ - title: Dashboard
+ url: metas-dashboardsss
diff --git a/sigi/apps/home/templatetags/menus.py b/sigi/apps/home/templatetags/menus.py
new file mode 100644
index 0000000..f8819fd
--- /dev/null
+++ b/sigi/apps/home/templatetags/menus.py
@@ -0,0 +1,21 @@
+from os.path import dirname
+
+import yaml
+from django import template
+
+
+register = template.Library()
+
+menus = yaml.load(open(dirname(__file__) + '/menu_conf.yaml', 'r'))
+
+
+@register.inclusion_tag('menus/menu.html', takes_context=True)
+def show_menu(context, menu_id):
+ base_url = context['request'].build_absolute_uri('/')
+ menus = yaml.load(open(dirname(__file__) + '/menu_conf.yaml', 'r'))
+ return dict(menu_items=menus[menu_id], base_url=base_url)
+
+
+@register.inclusion_tag('menus/menu_item.html')
+def show_menu_item(menu_item, base_url):
+ return dict(menu_item=menu_item, base_url=base_url)
diff --git a/sigi/settings/base.py b/sigi/settings/base.py
index b1a621c..ca3f2d9 100644
--- a/sigi/settings/base.py
+++ b/sigi/settings/base.py
@@ -32,6 +32,7 @@ SITE_ID = 1
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
'sigi.context_processors.charts_data',
+ 'django.core.context_processors.request',
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
@@ -55,6 +56,7 @@ INSTALLED_APPS = (
'django.contrib.staticfiles',
# Local apps
+ 'sigi.apps.home',
'sigi.apps.contatos',
'sigi.apps.servidores',
'sigi.apps.parlamentares',
@@ -77,7 +79,6 @@ INSTALLED_APPS = (
'reporting',
'django_extensions',
'googlecharts',
- 'treemenus',
'easy_thumbnails',
'image_cropping',
diff --git a/templates/admin/base.html b/templates/admin/base.html
index daf3e91..cc066d7 100644
--- a/templates/admin/base.html
+++ b/templates/admin/base.html
@@ -1,6 +1,6 @@
{% load admin_static bootstrapped_goodies_tags %}
-{% load tree_menu_tags %}
{% load i18n %}
+{% load menus %}
@@ -134,7 +134,7 @@
- {% show_menu "Barra de navegação" "unordered-list" %}
+ {% show_menu "main_menu" %}
diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html
index 85ceee6..e00a31e 100644
--- a/templates/admin/base_site.html
+++ b/templates/admin/base_site.html
@@ -1,6 +1,5 @@
{% extends "admin/base.html" %}
{% load i18n %}{% load admin_static bootstrapped_goodies_tags %}
-{% load tree_menu_tags %}
{% load static from staticfiles %}
{% block title %}{{ title }} | SIGI{% endblock %}
@@ -39,7 +38,6 @@
{% trans 'Administração' %}
diff --git a/templates/treemenus/menu.html b/templates/treemenus/menu.html
deleted file mode 100644
index 572cce7..0000000
--- a/templates/treemenus/menu.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{% load tree_menu_tags %}
-
-{% ifequal menu_type "unordered-list" %}
-
- {% for menu_item in menu.root_item.children %}
- {% show_menu_item menu_item %}
- {% endfor %}
-
-{% endifequal %}
diff --git a/templates/treemenus/menu_item.html b/templates/treemenus/menu_item.html
deleted file mode 100644
index be87c3a..0000000
--- a/templates/treemenus/menu_item.html
+++ /dev/null
@@ -1,20 +0,0 @@
-{% load tree_menu_tags %}
-
-{% ifequal menu_type "unordered-list" %}
- {% if menu_item.has_children %}
-
- {% if menu_item.url %}
- {{ menu_item.caption }}
- {% else %}
- {{ menu_item.caption }}
- {% endif %}
-
-
- {% else %}
- {{ menu_item.caption }}
- {% endif %}
-{% endifequal %}