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

Clean up cable terminations display & edit form

jeremystretch 3 лет назад
Родитель
Сommit
924471ee76
2 измененных файлов с 7 добавлено и 13 удалено
  1. 1 1
      netbox/dcim/tables/template_code.py
  2. 6 12
      netbox/templates/dcim/cable_edit.html

+ 1 - 1
netbox/dcim/tables/template_code.py

@@ -4,7 +4,7 @@ LINKTERMINATION = """
     <a href="{{ termination.parent_object.get_absolute_url }}">{{ termination.parent_object }}</a>
     <i class="mdi mdi-chevron-right"></i>
   {% endif %}
-  <a href="{{ termination.get_absolute_url }}">{{ termination }}</a>{% if not forloop.last %},{% endif %}
+  <a href="{{ termination.get_absolute_url }}">{{ termination }}</a>{% if not forloop.last %}<br />{% endif %}
 {% empty %}
   {{ ''|placeholder }}
 {% endfor %}

+ 6 - 12
netbox/templates/dcim/cable_edit.html

@@ -1,18 +1,8 @@
-{% extends 'base/layout.html' %}
+{% extends 'generic/object_edit.html' %}
 {% load static %}
 {% load helpers %}
 {% load form_helpers %}
 
-{% block title %}Connect Cable{% endblock %}
-
-{% block tabs %}
-<ul class="nav nav-tabs px-3">
-  <li class="nav-item" role="presentation">
-    <a href="#" role="tab" data-bs-toggle="tab" class="nav-link active">Connect Cable</a>
-  </li>
-</ul>
-{% endblock %}
-
 {% block content-wrapper %}
   <div class="tab-content">
     {% render_errors form %}
@@ -116,8 +106,12 @@
       </div>
       <div class="row my-3">
         <div class="col col-md-12 text-center">
+          {% if object.pk %}
+            <button type="submit" name="_update" class="btn btn-primary">Save</button>
+          {% else %}
+            <button type="submit" name="_create" class="btn btn-primary">Create</button>
+          {% endif %}
           <a href="{{ return_url }}" class="btn btn-outline-danger">Cancel</a>
-          <button type="submit" name="_update" class="btn btn-primary">Connect</button>
         </div>
       </div>
     </form>