From: Ricardo Markiewicz Date: Wed, 28 Feb 2007 04:51:12 +0000 (+0000) Subject: Hago el navbar dinamico para tener menos mantenimiento. X-Git-Tag: pre-merge~40 X-Git-Url: https://git.llucax.com/software/sercom.git/commitdiff_plain/22af73dbf4c0af8a7c8aa0a976c4e4748fcd2f35?ds=inline Hago el navbar dinamico para tener menos mantenimiento. --- diff --git a/sercom/menu.py b/sercom/menu.py index c85b817..ef9f590 100644 --- a/sercom/menu.py +++ b/sercom/menu.py @@ -1,11 +1,27 @@ from turbogears import url +from turbogears import controllers + +class Menu: + def __init__(self, controller): + # Armo la lista de subcontrollers + self.items = [] + for i in controller.__dict__: + if isinstance(getattr(controller, i),controllers.Controller): + self.items.append(i) + self.items.sort() + + def __repr__(self): + t = """ + + """ + s = '' + for i in self.items: + s = s + u"""" """ % (url('/' + i), i.capitalize().replace('_', ' ')) + return t % s -menu = [] -menu.append({'name': 'Alumnos', 'url':url('/alumno')}) -menu.append({'name': 'Docentes', 'url':url('/docente')}) -menu.append({'name': 'Grupos', 'url':url('/grupo')}) -menu.append({'name': 'Enunciados', 'url':url('/enunciado')}) -menu.append({'name': 'Ejercicios', 'url':url('/ejercicio')}) -menu.append({'name': 'Casos de Prueba', 'url':url('/caso_de_prueba')}) -menu.append({'name': 'Cursos', 'url':url('/curso')}) diff --git a/sercom/subcontrollers/grupo/templates/list.kid b/sercom/subcontrollers/grupo/templates/list.kid index dedcd5c..ab3c056 100644 --- a/sercom/subcontrollers/grupo/templates/list.kid +++ b/sercom/subcontrollers/grupo/templates/list.kid @@ -17,7 +17,7 @@ Operaciones - curso + curso nombre diff --git a/sercom/templates/master.kid b/sercom/templates/master.kid index e0d9803..48ae314 100644 --- a/sercom/templates/master.kid +++ b/sercom/templates/master.kid @@ -1,6 +1,10 @@ - + @@ -34,15 +38,8 @@
- + ${XML(str(menu))} +