diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst index c1b045a558..6e0cbd02d0 100755 --- a/doc/source/topics/settings.rst +++ b/doc/source/topics/settings.rst @@ -401,11 +401,15 @@ This example sorts flavors by vcpus in descending order:: Default: ``"static/themes/default"`` This setting allows Horizon to use a custom theme. The theme folder -should contains one _variables.scss file and one _styles.scss file. +should contain one _variables.scss file and one _styles.scss file. _variables.scss contains all the bootstrap and horizon specific variables which are used to style the GUI. Whereas _styles.scss contains extra styling. For example themes, see: /horizon/openstack_dashboard/static/themes/ +If the static theme folder also contains a sub-folder 'templates', then +the path to that sub-folder will be prepended to TEMPLATE_DIRS tuple +to allow for theme specific template customizations. + ``DROPDOWN_MAX_ITEMS`` ---------------------- diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 81860a2ab4..277849254f 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -283,6 +283,19 @@ STATIC_URL = WEBROOT + 'static/' STATICFILES_DIRS = get_staticfiles_dirs(WEBROOT) CUSTOM_THEME = os.path.join(ROOT_PATH, CUSTOM_THEME_PATH) + +# If a custom template directory exists within our custom theme, then prepend +# it to our first-come, first-serve TEMPLATE_DIRS +if os.path.exists(os.path.join(CUSTOM_THEME, 'templates')): + TEMPLATE_DIRS = \ + (os.path.join(CUSTOM_THEME_PATH, 'templates'),) + TEMPLATE_DIRS + +# Only expose the subdirectory 'static' if it exists from a custom theme, +# allowing other logic to live with a theme that we might not want to expose +# statically +if os.path.exists(os.path.join(CUSTOM_THEME, 'static')): + CUSTOM_THEME = os.path.join(CUSTOM_THEME, 'static') + STATICFILES_DIRS.append( ('custom', CUSTOM_THEME), ) diff --git a/openstack_dashboard/static/themes/blue/horizon/_styles.scss b/openstack_dashboard/static/themes/blue/horizon/_styles.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/openstack_dashboard/static/themes/blue/_styles.scss b/openstack_dashboard/static/themes/blue/static/_styles.scss similarity index 100% rename from openstack_dashboard/static/themes/blue/_styles.scss rename to openstack_dashboard/static/themes/blue/static/_styles.scss diff --git a/openstack_dashboard/static/themes/blue/_variables.scss b/openstack_dashboard/static/themes/blue/static/_variables.scss similarity index 100% rename from openstack_dashboard/static/themes/blue/_variables.scss rename to openstack_dashboard/static/themes/blue/static/_variables.scss diff --git a/openstack_dashboard/static/themes/blue/bootstrap/_styles.scss b/openstack_dashboard/static/themes/blue/static/bootstrap/_styles.scss similarity index 100% rename from openstack_dashboard/static/themes/blue/bootstrap/_styles.scss rename to openstack_dashboard/static/themes/blue/static/bootstrap/_styles.scss diff --git a/openstack_dashboard/static/themes/blue/bootstrap/_variables.scss b/openstack_dashboard/static/themes/blue/static/bootstrap/_variables.scss similarity index 100% rename from openstack_dashboard/static/themes/blue/bootstrap/_variables.scss rename to openstack_dashboard/static/themes/blue/static/bootstrap/_variables.scss diff --git a/openstack_dashboard/static/themes/blue/static/horizon/_styles.scss b/openstack_dashboard/static/themes/blue/static/horizon/_styles.scss new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/openstack_dashboard/static/themes/blue/static/horizon/_styles.scss @@ -0,0 +1 @@ + diff --git a/openstack_dashboard/static/themes/blue/horizon/_variables.scss b/openstack_dashboard/static/themes/blue/static/horizon/_variables.scss similarity index 100% rename from openstack_dashboard/static/themes/blue/horizon/_variables.scss rename to openstack_dashboard/static/themes/blue/static/horizon/_variables.scss diff --git a/openstack_dashboard/static/themes/blue/templates/_header.html b/openstack_dashboard/static/themes/blue/templates/_header.html new file mode 100644 index 0000000000..9c4c858188 --- /dev/null +++ b/openstack_dashboard/static/themes/blue/templates/_header.html @@ -0,0 +1,71 @@ +{% load branding i18n %} +{% load url from future %} +{% load context_selection %} + + diff --git a/openstack_dashboard/static/themes/blue/templates/context_selection/_overview.html b/openstack_dashboard/static/themes/blue/templates/context_selection/_overview.html new file mode 100644 index 0000000000..aa32246ee8 --- /dev/null +++ b/openstack_dashboard/static/themes/blue/templates/context_selection/_overview.html @@ -0,0 +1,12 @@ + + + {% if domain_supported %} + {{ domain_name }} + · + {% endif %} + {{ project_name }} + {% if multi_region %} + · + {{ region_name }} + {% endif %} + diff --git a/openstack_dashboard/static/themes/blue/templates/context_selection/_project_list.html b/openstack_dashboard/static/themes/blue/templates/context_selection/_project_list.html new file mode 100644 index 0000000000..01bcbec94b --- /dev/null +++ b/openstack_dashboard/static/themes/blue/templates/context_selection/_project_list.html @@ -0,0 +1,18 @@ +{% load i18n %} +{% load url from future %} + +{% with dashboard_url=request.horizon.dashboard.get_absolute_url %} + +{% endwith %}