fixed bug with route to / now needing to be to base.html, not main.html, then just added publisher (list all/edit 1/deleted button)

This commit is contained in:
2020-11-14 15:33:43 +11:00
parent 3831c0a03b
commit 29f8189c97
5 changed files with 113 additions and 9 deletions

View File

@@ -36,7 +36,7 @@
<div class="nav-item dropdown">
<a class="nav-item dropdown nav-link dropdown-toggle" href="#" id="PublisherMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Publishers</a>
<div class="dropdown-menu" aria-labelledby="PublisherMenu">
<a class="dropdown-item" href="#">Show All</a>
<a class="dropdown-item" href="{{url_for('publishers')}}">Show All</a>
</div>
</div>
</div>

24
templates/publisher.html Normal file
View File

@@ -0,0 +1,24 @@
{% extends "base.html" %} {% block main_content %}
<h3><center>Publisher</center></h3>
<div class="container">
<right>
{% if message|length %}
<div class="row alert alert-{{alert}}">
{{message}}
</div>
{% endif %}
<div class="row">
<form class="form form-inline col-xl-12" action="" method="POST">
{{ wtf.form_field( publisher_form.id, form_type='inline' ) }}
<div class="col-xl-12">
{{ wtf.form_field( publisher_form.name, form_type='horizontal', horizontal_columns=('xl', 2, 10), style="width:100%" ) }}
</div>
<div class="col-xl-12">
<br></br>
</div>
{{ wtf.form_field( publisher_form.submit, horizontal_columns=('xl', 2, 2), class="btn btn-primary offset-xl-1 col-xl-2" )}}
{{ wtf.form_field( publisher_form.delete, horizontal_columns=('xl', 2, 2), class="btn btn-danger offset-xl-1 col-xl-2" )}}
</form>
</div class="row">
</div class="container">
{% endblock main_content %}

15
templates/publishers.html Normal file
View File

@@ -0,0 +1,15 @@
{% extends "base.html" %}
{% block main_content %}
<h3>Publishers</h3>
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<thead>
<tr class="thead-light"><th>Surname</th><th>Firstname(s)</th></tr>
</thead>
<tbody>
{% for publisher in publishers %}
<tr><td><a href="{{url_for('publisher', id=publisher.id )}}">{{publisher.name}}</a></td></tr>
{% endfor %}
</tbody>
</table>
{% endblock main_content %}