diff --git a/docs/changelog.rst b/docs/changelog.rst index 6864925..c511833 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,8 @@ Changelog ========= +* :feature:`-` add links to webmail, phpmyadmin and phppgadmin + * :release:`0.10.0 <2015-02-01>` * :support:`-` move taskresults tests to tasksresults.tests and fix them * :support:`-` cache result of get_hosting_package method of diff --git a/docs/code/gnuviechadmin.rst b/docs/code/gnuviechadmin.rst index 8d72812..57fabec 100644 --- a/docs/code/gnuviechadmin.rst +++ b/docs/code/gnuviechadmin.rst @@ -11,6 +11,13 @@ The project module :py:mod:`gnuviechadmin` :members: +:py:mod:`context_processors ` +--------------------------------------------------------------- + +.. automodule:: gnuviechadmin.context_processors + :members: + + :py:mod:`urls ` ----------------------------------- diff --git a/gnuviechadmin/gnuviechadmin/context_processors.py b/gnuviechadmin/gnuviechadmin/context_processors.py new file mode 100644 index 0000000..a32d65e --- /dev/null +++ b/gnuviechadmin/gnuviechadmin/context_processors.py @@ -0,0 +1,27 @@ +""" +This module provides context processor implementations for gnuviechadmin. + +""" +from __future__ import absolute_import, unicode_literals + +from django.conf import settings + + +def navigation(request): + """ + Add navigation items to the request context. + + :param request: Django :py:class:`HttpRequest ` + :return: new context items + :rtype: dict + + """ + if request.is_ajax(): + return {} + context = { + 'webmail_url': settings.GVA_LINK_WEBMAIL, + 'phpmyadmin_url': settings.GVA_LINK_PHPMYADMIN, + 'phppgadmin_url': settings.GVA_LINK_PHPPGADMIN, + 'active_item': 'dashboard', + } + return context diff --git a/gnuviechadmin/gnuviechadmin/settings/base.py b/gnuviechadmin/gnuviechadmin/settings/base.py index c7b59fb..d1d8eda 100644 --- a/gnuviechadmin/gnuviechadmin/settings/base.py +++ b/gnuviechadmin/gnuviechadmin/settings/base.py @@ -171,6 +171,8 @@ TEMPLATE_CONTEXT_PROCESSORS = ( # allauth specific context processors 'allauth.account.context_processors.account', 'allauth.socialaccount.context_processors.socialaccount', + # custom context processors + 'gnuviechadmin.context_processors.navigation', ) # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders @@ -359,4 +361,8 @@ OSUSER_SFTP_GROUP = 'sftponly' OSUSER_SSH_GROUP = 'sshusers' OSUSER_DEFAULT_GROUPS = [OSUSER_SFTP_GROUP] OSUSER_UPLOAD_SERVER = get_env_variable('GVA_OSUSER_UPLOADSERVER') + +GVA_LINK_WEBMAIL = get_env_variable('GVA_WEBMAIL_URL') +GVA_LINK_PHPMYADMIN = get_env_variable('GVA_PHPMYADMIN_URL') +GVA_LINK_PHPPGADMIN = get_env_variable('GVA_PHPPGADMIN_URL') ########## END CUSTOM APP CONFIGURATION diff --git a/gnuviechadmin/templates/base.html b/gnuviechadmin/templates/base.html index 8d27d3f..d33ab76 100644 --- a/gnuviechadmin/templates/base.html +++ b/gnuviechadmin/templates/base.html @@ -49,6 +49,14 @@ {% if user.is_staff %}
  • {% trans "All hosting packages" %}
  • {% endif %} +
  • About
  • Contact