Просмотр исходного кода

Closes #8302: Linkify role column in device & VM tables

jeremystretch 4 лет назад
Родитель
Сommit
076ca46ab4

+ 1 - 0
docs/release-notes/version-3.1.md

@@ -7,6 +7,7 @@
 * [#8246](https://github.com/netbox-community/netbox/issues/8246) - Show human-friendly values for commit rates in circuits table
 * [#8246](https://github.com/netbox-community/netbox/issues/8246) - Show human-friendly values for commit rates in circuits table
 * [#8262](https://github.com/netbox-community/netbox/issues/8262) - Add cable count to tenant stats
 * [#8262](https://github.com/netbox-community/netbox/issues/8262) - Add cable count to tenant stats
 * [#8265](https://github.com/netbox-community/netbox/issues/8265) - Add Stackwise-n interface types
 * [#8265](https://github.com/netbox-community/netbox/issues/8265) - Add Stackwise-n interface types
+* [#8302](https://github.com/netbox-community/netbox/issues/8302) - Linkify role column in device & VM tables
 
 
 ### Bug Fixes
 ### Bug Fixes
 
 

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
netbox/project-static/dist/netbox-dark.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
netbox/project-static/dist/netbox-light.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
netbox/project-static/dist/netbox-print.css


+ 4 - 0
netbox/project-static/styles/netbox.scss

@@ -597,6 +597,10 @@ span.color-label {
   box-shadow: $box-shadow-sm;
   box-shadow: $box-shadow-sm;
 }
 }
 
 
+.badge a {
+  color: inherit;
+}
+
 .btn {
 .btn {
   white-space: nowrap;
   white-space: nowrap;
 }
 }

+ 9 - 9
netbox/utilities/tables.py

@@ -330,15 +330,15 @@ class ColoredLabelColumn(tables.TemplateColumn):
     Render a colored label (e.g. for DeviceRoles).
     Render a colored label (e.g. for DeviceRoles).
     """
     """
     template_code = """
     template_code = """
-    {% load helpers %}
-    {% if value %}
-    <span class="badge" style="color: {{ value.color|fgcolor }}; background-color: #{{ value.color }}">
-      {{ value }}
-    </span>
-    {% else %}
-    &mdash;
-    {% endif %}
-    """
+{% load helpers %}
+  {% if value %}
+  <span class="badge" style="color: {{ value.color|fgcolor }}; background-color: #{{ value.color }}">
+    <a href="{{ value.get_absolute_url }}">{{ value }}</a>
+  </span>
+{% else %}
+  &mdash;
+{% endif %}
+"""
 
 
     def __init__(self, *args, **kwargs):
     def __init__(self, *args, **kwargs):
         super().__init__(template_code=self.template_code, *args, **kwargs)
         super().__init__(template_code=self.template_code, *args, **kwargs)

Некоторые файлы не были показаны из-за большого количества измененных файлов