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

Introduce an inclusion template for object comments

jeremystretch 4 лет назад
Родитель
Сommit
7be684835b

+ 1 - 12
netbox/templates/circuits/circuit.html

@@ -66,18 +66,7 @@
         </div>
         {% include 'inc/custom_fields_panel.html' %}
         {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:circuit_list' %}
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-                {% if object.comments %}
-                    {{ object.comments|render_markdown }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
+        {% include 'inc/comments_panel.html' %}
         {% plugin_left_page object %}
 	</div>
 	<div class="col col-md-6">

+ 1 - 12
netbox/templates/circuits/provider.html

@@ -52,18 +52,7 @@
     <div class="col col-md-6">
         {% include 'inc/custom_fields_panel.html' %}
         {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:provider_list' %}
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-                {% if object.comments %}
-                    {{ object.comments|render_markdown }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
+        {% include 'inc/comments_panel.html' %}
         {% plugin_right_page object %}
     </div>
     <div class="col col-md-12">

+ 1 - 12
netbox/templates/circuits/providernetwork.html

@@ -37,20 +37,9 @@
         {% plugin_left_page object %}
     </div>
     <div class="col col-md-6">
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-                {% if object.comments %}
-                    {{ object.comments|render_markdown }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
         {% include 'inc/custom_fields_panel.html' %}
         {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:providernetwork_list' %}
+        {% include 'inc/comments_panel.html' %}
         {% plugin_right_page object %}
     </div>
 </div>

+ 1 - 12
netbox/templates/dcim/device.html

@@ -210,18 +210,7 @@
             </div>
             {% include 'inc/custom_fields_panel.html' %}
             {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:device_list' %}
-            <div class="card">
-                <h5 class="card-header">
-                    Comments
-                </h5>
-                <div class="card-body rendered-markdown">
-                    {% if object.comments %}
-                        {{ object.comments|render_markdown }}
-                    {% else %}
-                        <span class="text-muted">None</span>
-                    {% endif %}
-                </div>
-            </div>
+            {% include 'inc/comments_panel.html' %}
             {% plugin_left_page object %}
         </div>
         <div class="col col-md-6">

+ 1 - 12
netbox/templates/dcim/devicetype.html

@@ -126,18 +126,7 @@
         <div class="col col-md-6">
             {% include 'inc/custom_fields_panel.html' %}
             {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:devicetype_list' %}
-            <div class="card">
-                <h5 class="card-header">
-                    Comments
-                </h5>
-                <div class="card-body rendered-markdown">
-                    {% if object.comments %}
-                        {{ object.comments|render_markdown }}
-                    {% else %}
-                        <span class="text-muted">None</span>
-                    {% endif %}
-                </div>
-            </div>
+            {% include 'inc/comments_panel.html' %}
             {% plugin_right_page object %}
         </div>
     </div>

+ 1 - 12
netbox/templates/dcim/powerfeed.html

@@ -182,18 +182,7 @@
             </div>
             {% endif %}
         </div>
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-                {% if object.comments %}
-                    {{ object.comments|render_markdown }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
+        {% include 'inc/comments_panel.html' %}
         {% plugin_right_page object %}
     </div>
 </div>

+ 1 - 12
netbox/templates/dcim/rack.html

@@ -168,18 +168,7 @@
         </div>
         {% include 'inc/custom_fields_panel.html' %}
         {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:rack_list' %}
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-            {% if object.comments %}
-                {{ object.comments|render_markdown }}
-            {% else %}
-                <span class="text-muted">None</span>
-            {% endif %}
-            </div>
-        </div>
+        {% include 'inc/comments_panel.html' %}
         {% if power_feeds %}
             <div class="card">
                 <h5 class="card-header">

+ 1 - 12
netbox/templates/dcim/site.html

@@ -167,18 +167,7 @@
         </div>
         {% include 'inc/custom_fields_panel.html' %}
         {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:site_list' %}
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-                {% if object.comments %}
-                    {{ object.comments|render_markdown }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
+        {% include 'inc/comments_panel.html' %}
         {% plugin_left_page object %}
     </div>
     <div class="col col-md-5">

+ 1 - 8
netbox/templates/extras/journalentry.html

@@ -45,14 +45,7 @@
             </div>
         </div>
         <div class="col col-md-8">
-            <div class="card">
-                <h5 class="card-header">
-                    Comments
-                </h5>
-                <div class="card-body">
-                    {{ object.comments|render_markdown }}
-                </div>
-            </div>
+            {% include 'inc/comments_panel.html' %}
         </div>
     </div>
 {% endblock %}

+ 14 - 0
netbox/templates/inc/comments_panel.html

@@ -0,0 +1,14 @@
+{% load helpers %}
+
+<div class="card">
+  <h5 class="card-header">
+    Comments
+  </h5>
+  <div class="card-body rendered-markdown">
+    {% if object.comments %}
+      {{ object.comments|render_markdown }}
+    {% else %}
+      <span class="text-muted">None</span>
+    {% endif %}
+  </div>
+</div>

+ 1 - 12
netbox/templates/tenancy/tenant.html

@@ -37,18 +37,7 @@
         </div>
         {% include 'inc/custom_fields_panel.html' %}
         {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='tenancy:tenant_list' %}
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-                {% if object.comments %}
-                    {{ object.comments|render_markdown }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
+        {% include 'inc/comments_panel.html' %}
         {% plugin_left_page object %}
 	</div>
 	<div class="col col-md-5">

+ 1 - 12
netbox/templates/virtualization/cluster.html

@@ -56,18 +56,7 @@
             </table>
         </div>
     </div>
-    <div class="card">
-        <h5 class="card-header">
-            Comments
-        </h5>
-        <div class="card-body rendered-markdown">
-            {% if object.comments %}
-                {{ object.comments|render_markdown }}
-            {% else %}
-                <span class="text-muted">None</span>
-            {% endif %}
-        </div>
-    </div>
+    {% include 'inc/comments_panel.html' %}
     {% plugin_left_page object %}
   </div>
   <div class="col col-md-6">

+ 1 - 12
netbox/templates/virtualization/virtualmachine.html

@@ -91,18 +91,7 @@
         </div>
         {% include 'inc/custom_fields_panel.html' %}
         {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:virtualmachine_list' %}
-        <div class="card">
-            <h5 class="card-header">
-                Comments
-            </h5>
-            <div class="card-body rendered-markdown">
-                {% if object.comments %}
-                    {{ object.comments|render_markdown }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
+        {% include 'inc/comments_panel.html' %}
         {% plugin_left_page object %}
     </div>
 	<div class="col col-md-6">