1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Replace legacy add/edit secret views with SecretEditView

This commit is contained in:
Jeremy Stretch
2020-05-22 11:24:49 -04:00
parent ab60a5d73d
commit bae050e689
4 changed files with 58 additions and 119 deletions

View File

@@ -9,7 +9,7 @@
{{ form.private_key }}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h3>{% block title %}{% if secret.pk %}Editing {{ secret }}{% else %}Add a Secret{% endif %}{% endblock %}</h3>
<h3>{% block title %}{% if obj.pk %}Editing {{ obj }}{% else %}Add a Secret{% endif %}{% endblock %}</h3>
{% if form.non_field_errors %}
<div class="panel panel-danger">
<div class="panel-heading"><strong>Errors</strong></div>
@@ -30,17 +30,17 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>Secret Data</strong></div>
<div class="panel-body">
{% if secret.pk and secret|decryptable_by:request.user %}
{% if obj.pk and obj|decryptable_by:request.user %}
<div class="form-group">
<label class="col-md-3 control-label required">Current Plaintext</label>
<div class="col-md-7">
<p class="form-control-static" id="secret_{{ secret.pk }}">********</p>
<p class="form-control-static" id="secret_{{ obj.pk }}">********</p>
</div>
<div class="col-md-2 text-right">
<button class="btn btn-xs btn-success unlock-secret" secret-id="{{ secret.pk }}">
<button class="btn btn-xs btn-success unlock-secret" secret-id="{{ obj.pk }}">
<i class="fa fa-lock"></i> Unlock
</button>
<button class="btn btn-xs btn-danger lock-secret collapse" secret-id="{{ secret.pk }}">
<button class="btn btn-xs btn-danger lock-secret collapse" secret-id="{{ obj.pk }}">
<i class="fa fa-unlock-alt"></i> Lock
</button>
</div>
@@ -69,9 +69,9 @@
<div class="row">
<div class="form-group">
<div class="col-md-12 text-center">
{% if secret.pk %}
{% if obj.pk %}
<button type="submit" name="_update" class="btn btn-primary">Update</button>
<a href="{% url 'secrets:secret' pk=secret.pk %}" class="btn btn-default">Cancel</a>
<a href="{% url 'secrets:secret' pk=obj.pk %}" class="btn btn-default">Cancel</a>
{% else %}
<button type="submit" name="_create" class="btn btn-primary">Create</button>
<button type="submit" name="_addanother" class="btn btn-primary">Create and Add Another</button>