mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
This commit is big because anything small breaks the code. - Django dispatcher is based on regular expressions and does not need a tree structure - Reduces a lot of unnecessary dependencies among modules - Use Django sessions middlewear instead of CherryPy sessions - Introduce dependency based modules instead of numeric load order - Remove PagePlugin and simply use Django views - Eliminate page rendering wrappers in favor of Django context processors - Use custom auth for now until replaced by Django auth middlewear - Use Django templated 404 and 500 error pages
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
import os
|
|
from gettext import gettext as _
|
|
from django.template.response import TemplateResponse
|
|
|
|
import cfg
|
|
|
|
|
|
def init():
|
|
"""Initialize the Help module"""
|
|
menu = cfg.main_menu.add_item(_('Documentation'), 'icon-book', '/help',
|
|
101)
|
|
menu.add_item(_("Where to Get Help"), "icon-search", "/help/index", 5)
|
|
menu.add_item(_('Developer\'s Manual'), 'icon-info-sign',
|
|
'/help/view/plinth', 10)
|
|
menu.add_item(_('FAQ'), 'icon-question-sign', '/help/view/faq', 20)
|
|
menu.add_item(_('%s Wiki' % cfg.box_name), 'icon-pencil',
|
|
'http://wiki.debian.org/FreedomBox', 30)
|
|
menu.add_item(_('About'), 'icon-star', '/help/about', 100)
|
|
|
|
|
|
def index(request):
|
|
"""Serve the index page"""
|
|
return TemplateResponse(request, 'help.html',
|
|
{'title': _('Documentation and FAQ')})
|
|
|
|
|
|
def about(request):
|
|
"""Serve the about page"""
|
|
title = _('About the {box_name}').format(box_name=cfg.box_name)
|
|
return TemplateResponse(request, 'about.html', {'title': title})
|
|
|
|
|
|
def default(request, page=''):
|
|
"""Serve the documentation pages"""
|
|
with open(os.path.join('doc', '%s.part.html' % page), 'r') as input_file:
|
|
main = input_file.read()
|
|
|
|
title = _('%s Documentation') % cfg.product_name
|
|
return TemplateResponse(request, 'login_nav.html',
|
|
{'title': title, 'main': main})
|