Skip to content

Commit

Permalink
Ability to specify a menu logo (top left corner) via a config setting (
Browse files Browse the repository at this point in the history
…#184)

* add ability to specify a menu logo (top left corner) via a config setting

* add PR number
  • Loading branch information
nhoening committed Sep 16, 2021
1 parent f7c7fba commit 19896bd
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions documentation/changelog.rst
Expand Up @@ -9,6 +9,8 @@ v0.7.0 | October XX, 2021

New features
-----------
* Set a logo for the top left corner with the new FLEXMEASURES_MENU_LOGO_PATH setting [see `PR #184 <http://www.github.com/SeitaBV/flexmeasures/pull/184>`_]


Bugfixes
-----------
Expand Down
9 changes: 9 additions & 0 deletions documentation/configuration.rst
Expand Up @@ -106,6 +106,15 @@ For example, ``("MyMDCApp", ["MDC"]), "MyApp"]`` would show the name "MyMDCApp"
Default: ``"FlexMeasures"``


FLEXMEASURES_MENU_LOGO_PATH
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A URL path to identify an image being used as logo in the upper left corner (replacing some generic text made from platform name and the page title).
The path can be a complete URL or a relative from the app root.

Default: ""


FLEXMEASURES_ROOT_VIEW
^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
5 changes: 5 additions & 0 deletions flexmeasures/ui/static/css/flexmeasures.css
Expand Up @@ -2,6 +2,11 @@ body {
padding-top: 100px; /* This default is overridden by flexmeasures.js to support a fluid navbar */
}

#menu-logo {
height: 50px;
position: fixed; top: 0; left: 0;
}

#alerts {
position: absolute;
right: 10px;
Expand Down
10 changes: 9 additions & 1 deletion flexmeasures/ui/templates/base.html
Expand Up @@ -63,7 +63,15 @@
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a href="/"><span class="navbar-tool-name">{{ FLEXMEASURES_PLATFORM_NAME }} {% if not "Error" in self.title() %} - {{ self.title() }} {% endif %}</span></a>
<a href="/">
<span class="navbar-tool-name">
{% if menu_logo %}
<img id="menu-logo" src="{{menu_logo}}"/>
{% else %}
{{ FLEXMEASURES_PLATFORM_NAME }} {% if not "Error" in self.title() %} - {{ self.title() }} {% endif %}
{% endif %}
</span>
</a>
</span>
</div>
<div class="collapse navbar-collapse navbar-right" id="bs-example-navbar-collapse-1">
Expand Down
2 changes: 2 additions & 0 deletions flexmeasures/ui/utils/view_utils.py
Expand Up @@ -89,6 +89,8 @@ def render_flexmeasures_template(html_filename: str, **variables):
)
variables["js_versions"] = current_app.config.get("FLEXMEASURES_JS_VERSIONS")

variables["menu_logo"] = current_app.config.get("FLEXMEASURES_MENU_LOGO_PATH")

return render_template(html_filename, **variables)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -16,7 +16,7 @@ def load_requirements(use_case):

setup(
name="flexmeasures",
description="FlexMeasures - A free platform for real-time optimization of flexible energy.",
description="FlexMeasures - A free platform to build services for real-time optimization of flexible energy.",
author="Seita BV",
author_email="nicolas@seita.nl",
url="https://github.com/seitabv/flexmeasures",
Expand Down

0 comments on commit 19896bd

Please sign in to comment.