use list of links instead of comma separated links for forms; customize
template so that section type is repeated
This commit is contained in:
parent
ee10610926
commit
c2ffbce005
|
@ -6,6 +6,8 @@ import modules.announces_ui
|
|||
|
||||
import modules.admin
|
||||
|
||||
import modules.template
|
||||
|
||||
import wcs
|
||||
|
||||
for lang in ['fr']:
|
||||
|
|
|
@ -143,15 +143,17 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
'<strong>'
|
||||
'<a href="%s/">' % category.url_name
|
||||
category.name
|
||||
'</a></strong> : '
|
||||
|
||||
for formdef in formdefs[:3]:
|
||||
'<a href="%s/%s/">%s</a>' % (category.url_name, formdef.url_name, formdef.name)
|
||||
if formdef != formdefs[-1]:
|
||||
', '
|
||||
'</a></strong>\n'
|
||||
if len(formdefs) > 3:
|
||||
'...'
|
||||
'</li>'
|
||||
_(' (%d forms)') % len(formdefs)
|
||||
|
||||
'<ul>'
|
||||
for formdef in formdefs[:3]:
|
||||
'<li>'
|
||||
'<a href="%s/%s/">%s</a>' % (category.url_name, formdef.url_name, formdef.name)
|
||||
'</li>\n'
|
||||
'</ul>'
|
||||
'</li>\n'
|
||||
'</ul>'
|
||||
'</div>'
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
from quixote import get_request
|
||||
|
||||
from wcs import template
|
||||
from wcs.categories import Category
|
||||
|
||||
wcs_decorate = template.decorate
|
||||
|
||||
def decorate(body, response):
|
||||
body = str(body)
|
||||
|
||||
section = get_request().get_path(-1)
|
||||
|
||||
section_title = ''
|
||||
page_title = response.filter.get('title')
|
||||
if section == '/consultations':
|
||||
section_title = '<h2 id="consultations">%s</h2>\n' % _('Consultations')
|
||||
elif section == '/announces':
|
||||
section_title = '<h2 id="announces">%s</h2>\n' % _('Announces to citizens')
|
||||
elif section and len(section) > 1:
|
||||
# XXX: this works but is not efficient
|
||||
if Category.has_urlname(section[1:]):
|
||||
section_title = '<h2 id="services">%s</h2>\n' % _('Services')
|
||||
|
||||
if page_title:
|
||||
if section_title:
|
||||
page_title = '<h3>%s</h3>' % page_title
|
||||
else:
|
||||
page_title = '<h2 id="info">%s</h2>' % page_title
|
||||
else:
|
||||
page_title = ''
|
||||
|
||||
body = '\n'.join((section_title, page_title, body))
|
||||
|
||||
return wcs_decorate(body, response)
|
||||
|
||||
template.decorate = decorate
|
||||
|
Reference in New Issue