Merge "Allow customization of logo link"

This commit is contained in:
Jenkins 2013-11-10 21:46:35 +00:00 committed by Gerrit Code Review
commit a8028db5e5
3 changed files with 16 additions and 1 deletions

View File

@ -28,6 +28,14 @@ To override the OpenStack Logo image, replace the image at the directory path
The dimensions should be ``width: 108px, height: 121px``.
Changing the Brand Link
=======================
The logo also acts as a hyperlink. The default behavior is to redirect to
``horizon:user_home``. By adding the attribute ``SITE_BRANDING_LINK`` with
the desired url target e.g., ``http://sample-company.com`` in
``local_settings.py``, the target of the hyperlink can be changed.
Modifying Existing Dashboards and Panels
========================================

View File

@ -2,7 +2,7 @@
{% load url from future %}
<div class='sidebar'>
<h1 class="brand clearfix"><a href="{% url 'horizon:user_home' %}">{% site_branding %}</a></h1>
<h1 class="brand clearfix"><a href="{% site_branding_link %}">{% site_branding %}</a></h1>
{% horizon_main_nav %}

View File

@ -23,6 +23,7 @@ Template tags for customizing Horizon.
"""
from django.conf import settings # noqa
from django.core.urlresolvers import reverse # noqa
from django import template
from django.utils.translation import ugettext_lazy as _ # noqa
@ -45,6 +46,12 @@ def site_title(parser, token):
return settings.SITE_BRANDING
@register.simple_tag
def site_branding_link():
return getattr(settings, "SITE_BRANDING_LINK",
reverse("horizon:user_home"))
# TODO(jeffjapan): This is just an assignment tag version of the above, replace
# when the dashboard is upgraded to a django version that
# supports the @assignment_tag decorator syntax instead.