Skip to content

Allow Plugins to inject CSS or Javascript to HEAD section #16630

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

Closed
PieterL75 opened this issue Jun 17, 2024 · 0 comments
Closed

Allow Plugins to inject CSS or Javascript to HEAD section #16630

PieterL75 opened this issue Jun 17, 2024 · 0 comments
Assignees
Labels
complexity: low Requires minimal effort to implement netbox status: accepted This issue has been accepted for implementation topic: plugins Relates to the plugins framework type: feature Introduction of new functionality to the application
Milestone

Comments

@PieterL75
Copy link
Contributor

NetBox version

v4.0.5

Feature type

Data model extension

Proposed functionality

Provide a mean for a plugin to add its own content into the HEAD section of the page
This will make the CSS and Javascript available on all pages loaded.

netbox/templates/base/base.html

  • add {% load plugins %}
  • update the HEAD section to include {% plugin_base_head object %}

netbox/utilities/templatetags/plugins.py

  • extend with a def plugin_base_head(context, obj):

netbox/netbox/plugins/templates.py

  • extend class PluginTemplateExtension with def base_head(self)

Use case

Some plugins want to add content to all pages.
I'm using the 'BANNER_BOTTOM' to do this, and in newer version the middleware technique.
It would however be convenient for the plugin to have a native way to inject the JS and CSS.

Database changes

No response

External dependencies

No response

@PieterL75 PieterL75 added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application labels Jun 17, 2024
@arthanson arthanson added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation complexity: low Requires minimal effort to implement and removed status: needs triage This issue is awaiting triage by a maintainer labels Jun 18, 2024
@arthanson arthanson removed their assignment Jun 18, 2024
@jeremystretch jeremystretch added needs milestone Awaiting prioritization for inclusion with a future NetBox release status: backlog Awaiting selection for work and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Aug 15, 2024
@jeremystretch jeremystretch added the netbox label Nov 1, 2024 — with Linear
@jeremystretch jeremystretch added the topic: plugins Relates to the plugins framework label Feb 11, 2025
@jeremystretch jeremystretch removed the needs milestone Awaiting prioritization for inclusion with a future NetBox release label Feb 20, 2025
@jeremystretch jeremystretch added this to the v4.3 milestone Feb 20, 2025
@jeremystretch jeremystretch self-assigned this Apr 1, 2025
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: backlog Awaiting selection for work labels Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: low Requires minimal effort to implement netbox status: accepted This issue has been accepted for implementation topic: plugins Relates to the plugins framework type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

3 participants