removed all old *_lst tables, added corresponding new classes, etc. fro covertype, owned, rating, and dropped tables from DB, etc. Updated base.html to use new tables as drop-downs that are set correctly. So far slight hack on BookForm, will finish that after syncing this all back to mara. If I do the sync, and export/import this version of DB, then the fixes.sql and fix_db() code included in main.py can be removed. Finally, lamely added a favicon and a static/ to support it
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.18.0/dist/bootstrap-table.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.22/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
<script src="https://kit.fontawesome.com/9b4c7cf470.js" crossorigin="anonymous"></script>
|
||||
{% import "bootstrap/wtf.html" as wtf %}
|
||||
</head>
|
||||
@@ -48,8 +49,12 @@
|
||||
<a class="dropdown-item" href="{{url_for('genres')}}">Show Genres</a>
|
||||
<a class="dropdown-item" href="{{url_for('conditions')}}">Create new Condition</a>
|
||||
<a class="dropdown-item" href="{{url_for('conditions')}}">Show Conditions</a>
|
||||
<a class="dropdown-item" href="{{url_for('genres')}}">Create new Covertype</a>
|
||||
<a class="dropdown-item" href="{{url_for('genres')}}">Show Covertypes</a>
|
||||
<a class="dropdown-item" href="{{url_for('covertypes')}}">Create new Covertype</a>
|
||||
<a class="dropdown-item" href="{{url_for('covertypes')}}">Show Covertypes</a>
|
||||
<a class="dropdown-item" href="{{url_for('owneds')}}">Create new Owned Type</a>
|
||||
<a class="dropdown-item" href="{{url_for('owneds')}}">Show Owned Types</a>
|
||||
<a class="dropdown-item" href="{{url_for('ratings')}}">Create new Rating</a>
|
||||
<a class="dropdown-item" href="{{url_for('ratings')}}">Show Owned Ratings</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,44 +3,52 @@
|
||||
<h3><center>View/Edit Book</center></h1>
|
||||
{% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
|
||||
<div class="container">
|
||||
<div class="row with-margin">
|
||||
<div class="row">
|
||||
<form class="form col-lg-12">
|
||||
{% for key in keys %}
|
||||
<div class="input-group input-group-lg">
|
||||
{% if key == "condition" or key == "covertype" or key == "owned" or key == "rating" %}
|
||||
<div class="form-row">
|
||||
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
|
||||
<div class="col-lg-10">
|
||||
{{book_form[key](class="form-control")}}
|
||||
</div class="col-lg-10">
|
||||
</div class="form-row">
|
||||
{% else %}
|
||||
<div class="form-row">
|
||||
<label for="{{key}}" class="col-lg-2 col-form-label">{{key}}:</label>
|
||||
<div class="col-lg-10">
|
||||
<div class="row">
|
||||
{% if books[key] is iterable and books[key] is not string %}
|
||||
{% set cnt = namespace(idx=0, val=0) %}
|
||||
{% for objects in books[key] %}
|
||||
{% set cnt.val = 0 %}
|
||||
{% set str = namespace(val="") %}
|
||||
{% for attr in objects %}
|
||||
{% if attr != "id" %}
|
||||
{% if cnt.val > 0 %}
|
||||
{% set str.val=str.val+", "+objects[attr] %}
|
||||
{% else %}
|
||||
{% set str.val=str.val+objects[attr] %}
|
||||
{% if books[key] is iterable and books[key] is not string %}
|
||||
<div class="row" style="margin-left:0px; margin-right:0px;">
|
||||
{% set cnt = namespace(idx=0, val=0) %}
|
||||
{% for objects in books[key] %}
|
||||
{% set cnt.val = 0 %}
|
||||
{% set str = namespace(val="") %}
|
||||
{% for attr in objects %}
|
||||
{% if attr != "id" %}
|
||||
{% if cnt.val > 0 %}
|
||||
{% set str.val=str.val+", "+objects[attr] %}
|
||||
{% else %}
|
||||
{% set str.val=str.val+objects[attr] %}
|
||||
{% endif %}
|
||||
{% set cnt.val = cnt.val + 1 %}
|
||||
{% endif %}
|
||||
{% set cnt.val = cnt.val + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<span class="form-control col-lg-{{((12/books[key]|length)|int)}}" id="{{key}}-{{books[key][cnt.idx].id}}">
|
||||
<a href="{{url_for(key, id=books[key][cnt.idx].id)}}">{{str.val}}</a>
|
||||
</span>
|
||||
{% set cnt.idx = cnt.idx+1 %}
|
||||
{% endfor %}
|
||||
<span class="form-control col-lg-{{((12/books[key]|length)|int)}}" id="{{key}}-{{books[key][cnt.idx].id}}">
|
||||
<a href="{{url_for(key, id=books[key][cnt.idx].id)}}">{{str.val}}</a>
|
||||
</span>
|
||||
{% set cnt.idx = cnt.idx+1 %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</table>
|
||||
{% else %}
|
||||
{% if key == "notes" or key == "blurb" %}
|
||||
<textarea rows="5" type="text" class="form-control input-lg" id="{{key}}">{{books[key]}}</textarea>
|
||||
</div class="row">
|
||||
{% else %}
|
||||
<input type="text" class="form-control input-lg" id="{{key}}" value="{{books[key]}}">
|
||||
{% if key == "notes" or key == "blurb" %}
|
||||
<textarea rows="5" type="text" class="form-control input-lg" id="{{key}}">{{books[key]}}</textarea>
|
||||
{% else %}
|
||||
<input type="text" class="form-control input-lg" id="{{key}}" value="{{books[key]}}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div class="col-lg-8">
|
||||
</div class="form-group">
|
||||
</div class="col-lg-10">
|
||||
</div class="form-row">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</form>
|
||||
</div class="row">
|
||||
|
||||
24
templates/covertype.html
Normal file
24
templates/covertype.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %} {% block main_content %}
|
||||
<h3><center>Covertype</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( covertype_form.id, form_type='inline' ) }}
|
||||
<div class="col-xl-12">
|
||||
{{ wtf.form_field( covertype_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( covertype_form.submit, horizontal_columns=('xl', 2, 2), class="btn btn-primary offset-xl-1 col-xl-2" )}}
|
||||
{{ wtf.form_field( covertype_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/covertypes.html
Normal file
15
templates/covertypes.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block main_content %}
|
||||
<h3>Covertypes</h3>
|
||||
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
|
||||
<thead>
|
||||
<tr class="thead-light"><th>Name</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for covertype in covertypes %}
|
||||
<tr><td data-sort="{{covertype.id}}"><a href="{{url_for('covertype', id=covertype.id )}}">{{covertype.name}}</a></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock main_content %}
|
||||
24
templates/owned.html
Normal file
24
templates/owned.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %} {% block main_content %}
|
||||
<h3><center>Owned</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( owned_form.id, form_type='inline' ) }}
|
||||
<div class="col-xl-12">
|
||||
{{ wtf.form_field( owned_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( owned_form.submit, horizontal_columns=('xl', 2, 2), class="btn btn-primary offset-xl-1 col-xl-2" )}}
|
||||
{{ wtf.form_field( owned_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/owneds.html
Normal file
15
templates/owneds.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block main_content %}
|
||||
<h3>Owned List</h3>
|
||||
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
|
||||
<thead>
|
||||
<tr class="thead-light"><th>Name</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for owned in owneds %}
|
||||
<tr><td data-sort="{{owned.id}}"><a href="{{url_for('owned', id=owned.id )}}">{{owned.name}}</a></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock main_content %}
|
||||
24
templates/rating.html
Normal file
24
templates/rating.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %} {% block main_content %}
|
||||
<h3><center>Rating</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( rating_form.id, form_type='inline' ) }}
|
||||
<div class="col-xl-12">
|
||||
{{ wtf.form_field( rating_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( rating_form.submit, horizontal_columns=('xl', 2, 2), class="btn btn-primary offset-xl-1 col-xl-2" )}}
|
||||
{{ wtf.form_field( rating_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/ratings.html
Normal file
15
templates/ratings.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block main_content %}
|
||||
<h3>Ratings</h3>
|
||||
<table id="book_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
|
||||
<thead>
|
||||
<tr class="thead-light"><th>Name</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for rating in ratings %}
|
||||
<tr><td data-sort="{{rating.id}}"><a href="{{url_for('rating', id=rating.id )}}">{{rating.name}}</a></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock main_content %}
|
||||
Reference in New Issue
Block a user