-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add Jinja2 block {% block pluginfooter %} inside <footer> html tag on 'base/layout.html' template #8733
Comments
Rather than add a
|
I agree with this way, didn't know the But even doing like this, it would be possible to add a entire navigation like I did or only buttons to the existing navigation? |
I don't think it really makes sense to add a second footer like that; it looks odd and will likely lead to rendering issues. But, by introducing both
This allows a downstream template to either override/extend only the footer links, or the entire footer, by overriding the |
New custom links using dropdown listI have just found a solution that kinds of merge our ideas. I think it got better than the first version and I hope you also like it! I used exactly the last code you sent including the Code{# Page footer #}
<footer class="footer container-fluid">
{% block footer %}
<div class="row align-items-center justify-content-between mx-0">
<div class="col-sm-12 col-md-auto fs-4 noprint">
<nav class="nav justify-content-center justify-content-lg-start">
{# Documentation #}
<a type="button" class="nav-link" href="{% static 'docs/' %}" target="_blank">
<i title="Docs" class="mdi mdi-book-open-variant text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
</a>
{# REST API #}
<a type="button" class="nav-link" href="{% url 'api-root' %}" target="_blank">
<i title="REST API" class="mdi mdi-cloud-braces text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
</a>
{# API docs #}
<a type="button" class="nav-link" href="{% url 'api_docs' %}" target="_blank">
<i title="REST API documentation" class="mdi mdi-book text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
</a>
{# GraphQL API #}
{% if config.GRAPHQL_ENABLED %}
<a type="button" class="nav-link" href="{% url 'graphql' %}" target="_blank">
<i title="GraphQL API" class="mdi mdi-graphql text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
</a>
{% endif %}
{# GitHub #}
<a type="button" class="nav-link" href="https://github.com/netbox-community/netbox" target="_blank">
<i title="Source Code" class="mdi mdi-github text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
</a>
{# NetDev Slack #}
<a type="button" class="nav-link" href="https://netdev.chat/" target="_blank">
<i title="Community" class="mdi mdi-slack text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
</a>
{% block footer_links %}
{# Proxbox Custom Links #}
<li class="nav-item dropdown dropup">
<a type="button" class="nav-link dropdown-toggle text-primary" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i title="Proxbox Plugin" class="mdi mdi-puzzle" data-bs-placement="top" data-bs-toggle="tooltip"></i>
</a>
<ul class="dropdown-menu disabled" aria-labelledby="navbarDropdown">
<li>
{# Proxbox - Documentation #}
<a type="button" class="dropdown-item" href="https://github.com/N-Multifibra/netbox-proxbox/blob/develop/README.md" target="_blank">
<i title="Proxbox | Docs" class="mdi mdi-book-open-variant text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i> Docs
</a>
<li>
{# Proxbox - GitHub #}
<a type="button" class="dropdown-item" href="https://github.com/N-Multifibra/netbox-proxbox" target="_blank">
<i title="Proxbox | Source Code" class="mdi mdi-github text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i> GitHub
</a>
</li>
<li>
{# Proxbox - Telegram (Brazil) #}
<a type="button" class="dropdown-item" href="https://t.me/netboxbr" target="_blank">
<i title="Proxbox | Telegram (Brazil)" class="mdi mdi-telegram text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i> Telegram (BR)
</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<span class="dropdown-item disabled">Proxbox (v0.0.3)</span>
</li>
</ul>
</li>
{% endblock footer_links %}
</nav>
</div>
<div class="col-sm-12 col-md-auto text-center text-lg-end text-muted">
<span class="d-block d-md-inline">{% annotated_now %} {% now 'T' %}</span>
<span class="ms-md-3 d-block d-md-inline">{{ settings.HOSTNAME }} (v{{ settings.VERSION }})</span>
</div>
</div>
{% endblock footer %}
</footer> How it actually looks likeLight modeDark mode |
@jeremystretch is it ok this way? |
Closes #8733: Add {% block pluginfooter %} to 'base/layout.html' template
NetBox version
v3.1.8
Feature type
New functionality
Proposed functionality
The functionality allows netbox plugin developers to easily create its own footer navigation to link to many useful links, like Source Code, Plugin documentation, etc.
Use case
Plugin custom links inside footer
I am the main developer of Proxbox plugin and could not find a easy way to insert code inside Netbox footer to link to my own links, so that the community could easily found my code and documentation.
As a workaround, I created my own layout template and changed the settings.py so that Django looks for that template and it solved my issue. The whole thing is that it was more complicated than it should be and I also had to modify the core Netbox code by changing the settings.py, which I did not like to do, as it adds one more step to make the plugin work properly and makes things easy to break.
Bellow some of the code I did as workaround:
How it actually looks like
Light mode:
![proxbox-footer-light-mode](https://user-images.githubusercontent.com/24397251/155451884-dc905764-b834-4c8d-a068-c190306376bb.png)
![proxbox-footer-light-mode_02](https://user-images.githubusercontent.com/24397251/155452359-5c91e2ad-018e-442c-91fb-6c6fe105279c.png)
Dark mode:
![proxbox-footer-dark-mode](https://user-images.githubusercontent.com/24397251/155451420-211e4c29-62cf-4a9e-9700-70e2dffb5ccc.png)
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: