Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to specify a menu logo (top left corner) via a config setting #184

Merged
merged 2 commits into from Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shame we still lack a real FlexMeasures logo for a default.

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