Author: Adam Gandelman <adamg@canonical.com>
Subject: Allow optionally loading a custom Ubuntu CSS

This patch  adds the ability to override the default style.css with an ubuntu.css
by dropping it in /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/css/

--- a/horizon/templatetags/branding.py
+++ b/horizon/templatetags/branding.py
@@ -22,12 +22,54 @@
 Template tags for customizing Horizon.
 """
 
+import os.path
 from django import template
 from django.conf import settings
 
 
 register = template.Library()
 
+# Ubuntu branding css+favicon will be dropped here when the theme
+# package is installed
+UBUNTU_CSS = '/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/css/ubuntu.css'
+UBUNTU_FAVICON = '/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/img/favicon-ubuntu.ico'
+
+
+class ChooseCss(template.Node):
+    def render(self, context):
+        if os.path.exists(UBUNTU_CSS):
+            return 'ubuntu.css'
+        else:
+            return 'style.css'
+
+@register.tag
+def choose_css(parser, token):
+    return ChooseCss()
+
+class ChooseFavicon(template.Node):
+    def render(self, context):
+        if os.path.exists(UBUNTU_FAVICON):
+            return 'favicon-ubuntu.ico'
+        else:
+            return 'favicon.ico'
+
+@register.tag
+def choose_favicon(parser, token):
+    return ChooseFavicon()
+
+
+class ChooseCss(template.Node):
+    def render(self, context):
+        if os.path.exists(UBUNTU_CSS):
+            return 'ubuntu.css'
+        else:
+            return 'style.css'
+
+@register.tag
+def choose_css(parser, token):
+    return ChooseCss()
+
+
 
 class SiteBrandingNode(template.Node):
     def render(self, context):
--- a/openstack_dashboard/templates/_stylesheets.html
+++ b/openstack_dashboard/templates/_stylesheets.html
@@ -1,6 +1,7 @@
+{% load branding %}
 {% comment %} CSS {% endcomment %}
 <link href='{{ STATIC_URL }}bootstrap/css/bootstrap.min.css' media='screen' rel='stylesheet' />
-<link href='{{ STATIC_URL }}dashboard/css/style.css' media='screen' rel='stylesheet' />
+<link href='{{ STATIC_URL }}dashboard/css/{% choose_css %}' media='screen' rel='stylesheet' />
 
 {% comment %} Favicon {% endcomment %}
-<link rel="shortcut icon" href="{{ STATIC_URL }}dashboard/img/favicon.ico"/>
+<link rel="shortcut icon" href="{{ STATIC_URL }}dashboard/img/{% choose_favicon %}"/>
