diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-07-23 12:53:21 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-07-25 09:48:12 +0200 |
commit | fce0ee94c6bfef997ff4346612a55bdb241375aa (patch) | |
tree | aebf762d3befd71fe18cdd618485f63341989f26 /ogcp | |
parent | 52b61df025641d3070140ce4fa0bd28aead047e4 (diff) |
templates: make client details template more compact
Make the form template update automatically after form definition
modifications. Use a loop to render the for fields.
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/templates/actions/client_details.html | 67 |
1 files changed, 11 insertions, 56 deletions
diff --git a/ogcp/templates/actions/client_details.html b/ogcp/templates/actions/client_details.html index 070e4d6..a718450 100644 --- a/ogcp/templates/actions/client_details.html +++ b/ogcp/templates/actions/client_details.html @@ -13,68 +13,23 @@ <h2 class="mx-5 subhead-heading">{{_('Client details')}}</h2> -<div class="container mt-5"> - <form method="POST"> +<div class="container mx-5"> + <form class="form" method="POST"> {{ form.hidden_tag() }} {{ form.server() }} {{ form.folder_id() }} - <div class="form-group row"> - <label for="name" class="col-sm-2 col-form-label">{{ form.name.label }}</label> - <div class="col-sm-9"> - {{ form.name(class="form-control") }} + {% for field in form if field.type != 'CSRFToken' and field.name not in ['submit', 'remote', 'maintenance'] %} + {% if not field.flags.hidden %} + <div class="form-group row"> + <label for="{{ field.id }}" class="col-sm-2 col-form-label">{{ field.label.text }}</label> + <div class="col-sm-9"> + {{ field(class="form-control") }} + </div> </div> - </div> - - <div class="form-group row"> - <label for="ip" class="col-sm-2 col-form-label">{{ form.ip.label }}</label> - <div class="col-sm-9"> - {{ form.ip(class="form-control") }} - </div> - </div> - - <div class="form-group row"> - <label for="mac" class="col-sm-2 col-form-label">{{ form.mac.label }}</label> - <div class="col-sm-9"> - {{ form.mac(class="form-control") }} - </div> - </div> - - <div class="form-group row"> - <label for="serial_number" class="col-sm-2 col-form-label">{{ form.serial_number.label }}</label> - <div class="col-sm-9"> - {{ form.serial_number(class="form-control") }} - </div> - </div> - - <div class="form-group row"> - <label for="livedir" class="col-sm-2 col-form-label">{{ form.livedir.label }}</label> - <div class="col-sm-9"> - {{ form.livedir(class="form-control") }} - </div> - </div> - - <div class="form-group row"> - <label for="repo" class="col-sm-2 col-form-label">{{ form.repo.label }}</label> - <div class="col-sm-9"> - {{ form.repo(class="form-control") }} - </div> - </div> - - <div class="form-group row"> - <label for="room" class="col-sm-2 col-form-label">{{ form.room.label }}</label> - <div class="col-sm-9"> - {{ form.room(class="form-control") }} - </div> - </div> - - <div class="form-group row"> - <label for="boot" class="col-sm-2 col-form-label">{{ form.boot.label }}</label> - <div class="col-sm-9"> - {{ form.boot(class="form-control") }} - </div> - </div> + {% endif %} + {% endfor %} <div class="form-group"> {{ form.submit(class="btn btn-primary") }} |