mirror of
https://github.com/netbox-community/netbox.git
synced 2025-09-09 07:30:39 -06:00
Merge pull request #20280 from pheus/20264-fix-plugin-icon-display-in-plugin-table
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Fixes #20264: Update plugin title rendering with default icon
This commit is contained in:
commit
83fe973fea
@ -1,10 +1,8 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.urls import reverse
|
|
||||||
from django.utils.safestring import mark_safe
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from netbox.tables import BaseTable, columns
|
from netbox.tables import BaseTable, columns
|
||||||
from .template_code import PLUGIN_IS_INSTALLED
|
from .template_code import PLUGIN_IS_INSTALLED, PLUGIN_NAME_TEMPLATE
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'CatalogPluginTable',
|
'CatalogPluginTable',
|
||||||
@ -12,12 +10,6 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
PLUGIN_NAME_TEMPLATE = """
|
|
||||||
<img class="plugin-icon" src="{{ record.icon_url }}">
|
|
||||||
<a href="{% url 'core:plugin' record.config_name %}">{{ record.title_long }}</a>
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class PluginVersionTable(BaseTable):
|
class PluginVersionTable(BaseTable):
|
||||||
version = tables.Column(
|
version = tables.Column(
|
||||||
verbose_name=_('Version')
|
verbose_name=_('Version')
|
||||||
@ -94,10 +86,4 @@ class CatalogPluginTable(BaseTable):
|
|||||||
)
|
)
|
||||||
# List installed plugins first, then certified plugins, then
|
# List installed plugins first, then certified plugins, then
|
||||||
# everything else (with each tranche ordered alphabetically)
|
# everything else (with each tranche ordered alphabetically)
|
||||||
order_by = ('-is_installed', '-is_certified', 'name')
|
order_by = ('-is_installed', '-is_certified', 'title_long')
|
||||||
|
|
||||||
def render_title_long(self, value, record):
|
|
||||||
if record.static:
|
|
||||||
return value
|
|
||||||
url = reverse('core:plugin', args=[record.config_name])
|
|
||||||
return mark_safe(f"<a href='{url}'>{value}</a>")
|
|
||||||
|
@ -27,6 +27,16 @@ PLUGIN_IS_INSTALLED = """
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
PLUGIN_NAME_TEMPLATE = """
|
||||||
|
{% load static %}
|
||||||
|
{% if record.icon_url %}
|
||||||
|
<img class="plugin-icon" src="{{ record.icon_url }}">
|
||||||
|
{% else %}
|
||||||
|
<img class="plugin-icon" src="{% static 'plugin-default.svg' %}">
|
||||||
|
{% endif %}
|
||||||
|
<a href="{% url 'core:plugin' record.config_name %}">{{ record.title_long }}</a>
|
||||||
|
"""
|
||||||
|
|
||||||
DATA_SOURCE_SYNC_BUTTON = """
|
DATA_SOURCE_SYNC_BUTTON = """
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
1
netbox/project-static/img/plugin-default.svg
Normal file
1
netbox/project-static/img/plugin-default.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-box"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" /><path d="M12 12l8 -4.5" /><path d="M12 12l0 9" /><path d="M12 12l-8 -4.5" /></svg>
|
After Width: | Height: | Size: 441 B |
Loading…
Reference in New Issue
Block a user