made subbook show it is one more visually, also disabled fields that are part of the parent book so they cannot be changed

This commit is contained in:
2020-12-05 21:23:54 +11:00
parent 8ab3b36dc0
commit 15ac1fbed0

View File

@@ -12,6 +12,16 @@
<form role="form" class="form col-lg-10" action="" method="POST">
{{ book_form.id }}
{{ book_form.csrf_token }}
{% if b.parent|length %}
<div class="form-row">
<label class="col-lg-2 col-form-label bg-secondary text-white">Parent Book:</label>
<div class="col">
<button disabled class="col btn btn-outline-primary">
<i><a href="/book/{{b.parent[0].id}}">{{b.parent[0].title}}</a></i>
</button>
</div>
</div>
{% endif %}
{% for key in keys %}
<div class="form-row">
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
@@ -67,7 +77,13 @@
{% if key == "notes" %}
{% set rows=2 %}
{% endif %}
{{book_form[key](class="form-control", value=books[key], rows=rows )}}
{% if b.parent|length and
(key == 'publisher' or key == 'owned' or key == 'covertype'
or key == 'condition' or key == 'blurb' ) %}
{{book_form[key](class="form-control", value=books[key], rows=rows, disabled="disabled" )}}
{% else %}
{{book_form[key](class="form-control", value=books[key], rows=rows )}}
{% endif %}
</div class="col">
{% endif %}
</div class="form-row">
@@ -95,14 +111,6 @@
</div>
</div>
{% endif %}
{% if b.parent|length %}
<div class="form-row">
<label class="col-lg-2 col-form-label">Parent Book:</label>
<div class="col">
<label class="form-control-plaintext"><a href="/book/{{b.parent[0].id}}">{{b.parent[0].title}}</a></label>
</div>
</div>
{% endif %}
<div class="form-row col-lg-12">
{{ book_form.delete( class="btn btn-outline-danger offset-lg-2 col-lg-2" )}}
{{ book_form.submit( class="btn btn-primary col-lg-2" )}}