mirror of
https://github.com/netbox-community/netbox.git
synced 2025-09-06 06:13:36 -06:00
Merge bb385024f0
into 5ca2cea016
This commit is contained in:
commit
74f64666c9
@ -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')
|
||||||
@ -93,10 +85,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>")
|
|
||||||
|
@ -26,3 +26,8 @@ PLUGIN_IS_INSTALLED = """
|
|||||||
<span class="text-muted">—</span>
|
<span class="text-muted">—</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
PLUGIN_NAME_TEMPLATE = """
|
||||||
|
<img class="plugin-icon" src="{{ record.icon_url }}">
|
||||||
|
<a href="{% url 'core:plugin' record.config_name %}">{{ record.title_long }}</a>
|
||||||
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user