V1 cleanup (#73)

* removed obsolete code

* removed obsolete code

* removed obsolete code and added type annotations

* removed obsolete code and added type annotations

* version bump

Co-authored-by: Peter Dwyer <peter.dwyer@clanwilliamhealth.com>
This commit is contained in:
2022-08-26 13:11:29 +01:00
committed by GitHub
parent 1aeda89b74
commit 40b79c2f5d
42 changed files with 79 additions and 2720 deletions

View File

@@ -1,85 +0,0 @@
{% load bootstrap4 %}
{% load static %}
{% load sri %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="Ajurna">
<link rel="icon" href="{% static "img/logo.svg" %}">
<title>{% block title %}CB Web Reader{% endblock %}</title>
<!-- Bootstrap core CSS -->
{% sri_static "bootstrap/dist/css/bootstrap.min.css" %}
{% sri_static "datatables.net-bs4/css/dataTables.bootstrap4.min.css" %}
<!-- Custom styles for this template -->
{% sri_static "css/base.min.css" %}
{% sri_static "@fortawesome/fontawesome-free/css/all.min.css" %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light" aria-label="menu">
<a class="navbar-brand" href="/"><img src="{% static 'img/logo.svg' %}" class="d-inline-block align-top" height="35px" alt="CB"> Web Reader</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
{% for page, link in menu.menu_items.items %}
<a class="nav-item nav-link {% if menu.current_page == page %}active{% endif %}" href="{{ link }}">{{ page }}</a>
{% endfor %}
</div>
</div>
</nav>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
{% if breadcrumbs %}
{% include "comic/breadcrumbs.html" %}
{% else %}
<li class="breadcrumb-item"><a href="#">Home</a></li>
{% endif %}
</ol>
</nav>
{% block content %}{% endblock %}
<!-- /.container -->
<footer class="footer mt-auto py-3">
<div class="container text-center">
<a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons Licence" src="{% static "img/ccbysa.png" %}" /></a><br /><span xmlns:dct="https://purl.org/dc/terms/" href="https://purl.org/dc/dcmitype/InteractiveResource" property="dct:title" rel="dct:type">CBReader</span> by <span xmlns:cc="https://creativecommons.org/ns#" property="cc:attributionName">Ajurna</span> is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="https://purl.org/dc/terms/" href="https://github.com/ajurna/cbreader" rel="dct:source">https://github.com/ajurna/cbreader</a>.
</div>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
{# {% bootstrap_javascript jquery='full' %}#}
<script type="text/javascript">
globalThis.regeneratorRuntime = undefined;
</script>
{% sri_static "jquery/dist/jquery.min.js" %}
{% sri_static "bootstrap/dist/js/bootstrap.bundle.js" %}
{% sri_static "datatables.net/js/jquery.dataTables.min.js" %}
{% sri_static "datatables.net-bs4/js/dataTables.bootstrap4.min.js" %}
{% sri_static "js-cookie/src/js.cookie.js" %}
{% sri_static "reveal.js/dist/reveal.js" %}
{% sri_static "reveal.js-menu/menu.js" %}
{% sri_static "hammerjs/hammer.js" %}
{% sri_static "isotope-layout/dist/isotope.pkgd.min.js" %}
{% block script %}
{% endblock %}
</body>
</html>

View File

@@ -1,7 +0,0 @@
{% for crumb in breadcrumbs %}
{% if not forloop.last %}
<li class="breadcrumb-item"><a href="{{ crumb.url }}">{{ crumb.name }}</a></li>
{% else %}
<li class="breadcrumb-item active" aria-current="page">{{ crumb.name }}</li>
{% endif %}
{% endfor %}

View File

@@ -1,124 +0,0 @@
{% extends "base.html" %}
{% load sri %}
{% load bootstrap4 %}
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="input-group">
<input type="text" id="quicksearch" class="form-control" placeholder="Search" aria-label="Search list of comics" aria-describedby="button-addon4">
<div id="filters" class="input-group-append">
<button class="btn btn-outline-secondary filters" type="button" data-filter="*">All</button>
<button class="btn btn-outline-secondary filters" type="button" data-filter=".read">Read</button>
<button class="btn btn-outline-secondary filters" type="button" data-filter=".unread">Unread</button>
<div class="btn-group" role="group">
<button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Actions
</button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
<button type="button" class="btn btn-primary dropdown-item comic_action" title="Mark Un-Read" selector="{{ selector }}" itemtype="Directory" comic_action="mark_unread"><i class="fas fa-book">Mark Un-Read</i></button>
<button type="button" class="btn btn-primary dropdown-item comic_action" title="Mark Read" selector="{{ selector }}" itemtype="Directory" comic_action="mark_read"><i class="fas fa-book-open">Mark Read</i></button>
{# <button type="button" class="btn btn-primary dropdown-item" title="Edit Comic"><i class="fas fa-edit">Edit Comic</i></button>#}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container comic-container">
<div class="row grid card-group">
{% for file in files %}
<div class="m-2 grid-item {% if file.percent == 100 %}read{% else %}unread{% endif %}">
<div class="card card_list_card">
{% if file.item_type == 'Directory' %}
<a href="{% url "comic_list" file.selector %}">
{% elif file.item_type == 'ComicBook' %}
<a href="{% url "read_comic" file.selector %}">
{% endif %}
{% if file.obj.thumbnail %}
<img src="{{file.obj.thumbnail.url}}" class="card-img-top" alt="{{ file.name }}" alt_src="{% static "/img/placeholder.png" %}">
{% else %}
{% if file.item_type == 'Directory' %}
<img src="{% url 'directory_thumbnail' file.selector %}" class="card-img-top" alt="{{ file.name }}" alt_src="{% static "/img/placeholder.png" %}">
{% elif file.item_type == 'ComicBook' %}
<img src="{% url 'comic_thumbnail' file.selector %}" class="card-img-top" alt="{{ file.name }}" alt_src="{% static "/img/placeholder.png" %}">
{% endif %}
{% endif %}
</a>
<div class="card-body">
<h5 class="card-title {{ file.selector }}">
{% if file.item_type == 'Directory' %}
<a href="{% url "comic_list" file.selector %}" class="search-name">
{% elif file.item_type == 'ComicBook' %}
<a href="{% url "read_comic" file.selector %}" class="search-name">
{% endif %}
{{ file.name }}
</a>
</h5>
<p class="card-text">
<figure class="text-center w-100 mb-0">{{ file.total_read }} / {{ file.total }}</figure>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{ file.percent }}" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</p>
<div class="btn-group w-100" role="group" aria-label="Comic Actions">
<button type="button" class="btn btn-primary comic_action" title="Mark Un-Read" selector="{{ file.selector }}" itemtype="{{ file.item_type }}" comic_action="mark_unread"><i class="fas fa-book"></i></button>
<button type="button" class="btn btn-primary comic_action" title="Mark Read" selector="{{ file.selector }}" itemtype="{{ file.item_type }}" comic_action="mark_read"><i class="fas fa-book-open"></i></button>
<div class="btn-group" role="group">
<button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">F
</button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
<button type="button" class="btn btn-primary dropdown-item comic_action" title="Mark Un-Read" selector="{{ file.selector }}" itemtype="{{ file.item_type }}" comic_action="mark_unread"><i class="fas fa-book">Mark Un-Read</i></button>
<button type="button" class="btn btn-primary dropdown-item comic_action" title="Mark Read" selector="{{ file.selector }}" itemtype="{{ file.item_type }}" comic_action="mark_read"><i class="fas fa-book-open">Mark Read</i></button>
{% if file.item_type != 'Directory' %}
<button type="button" class="btn btn-primary dropdown-item comic_action" title="Mark Previous Read" selector="{{ file.selector }}" itemtype="{{ file.item_type }}" comic_action="mark_previous"><i class="fas fa-book"><i class="fas fa-arrow-up">Mark Previous Read</i></i></button>
{% else %}
<button type="button" class="btn btn-primary dropdown-item modal-button" title="Edit Comic" data-toggle="modal" data-target="#editModal" selector="{{ file.selector }}" itemtype="{{ file.item_type }}"><i class="fas fa-edit">Edit Comic</i></button>
{% endif %}
</div>
</div>
</div>
</div>
{% if file.total_unread and file.item_type == 'Directory' %}
<span class="badge rounded-pill bg-primary unread-badge">{{ file.total_unread }}</span>
{% endif %}
<span class="badge rounded-pill bg-warning {{ file.selector }} classification-badge" classification="{{ file.obj.classification }}">{{ file.obj.get_classification_display }}</span>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="modal fade" id="editModal" tabindex="-1" aria-labelledby="editModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% csrf_token %}
{% bootstrap_form form %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="save_button">Save changes</button>
</div>
</div>
</div>
</div>
{% endblock %}
{% block script %}
{{ js_urls|json_script:'js_urls' }}
{% sri_static "js/comic_list.min.js" %}
{% endblock %}

View File

@@ -1,29 +0,0 @@
{% extends "base.html" %}
{% load sri %}
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="reveal" id="comic_box">
<div id="slides_div" class="slides">
{% for page in pages %}
<section data-menu-title="{{ page.page_file_name }}">
{% if page.content_type|first in 'image' %}
<img data-src="{% url "get_image" nav.cur_path page.index %}" class="w-100" alt="{{ page.page_file_name }}">
{% else %}
<p><embed class="comic_embed" type="{{ page.content_type }}" src="{% url "get_image" nav.cur_path page.index %}"></p>
{% endif %}
</section>
{% endfor %}
</div>
</div>
{% endblock %}
{% block script %}
{{ nav|json_script:"nav" }}
{{ status.last_read_page|json_script:"last_read_page" }}
{% sri_static "js/read_comic.min.js" %}
{% endblock %}

View File

@@ -1,31 +0,0 @@
{% extends "base.html" %}
{% load sri %}
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="container m-0">
<div class="row justify-content-center w-100">
<div class="btn-group" role="group" aria-label="Basic example">
<button id="prev" class="btn btn-secondary">Previous</button>
<button id="pages" class="btn btn-secondary"><span id="page_num"></span> / <span id="page_count"></span></button>
<button id="next" class="btn btn-secondary">Next</button>
</div>
</div>
<div class="row w-100">
<canvas id="the-canvas" width="100%"></canvas>
</div>
</div>
{% endblock %}
{% block script %}
{% sri_static "pdfjs-dist/build/pdf.min.js" %}
{{ nav|json_script:"nav" }}
{{ status.last_read_page|json_script:"last_read_page" }}
{% sri_static 'js/read_comic_pdf.min.js' %}
{% endblock %}

View File

@@ -1,46 +0,0 @@
{% extends "base.html" %}
{% load sri %}
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="container">
<form id="comic_form" method="post" action="/comic/edit/">
{% csrf_token %}
<table class="table table-bordered table-striped table-hover" id="comic_list">
<caption><h2>Recent Comics - <a href="/comic/feed/{{ feed_id }}/">Feed</a></h2>
mark selected issues as:
<select name="func" id="func_selector">
<option value="choose">Choose...</option>
<option value="read">Read</option>
<option value="unread">Un-Read</option>
</select>
</caption>
<thead>
<tr>
<th id="select-all"><input type="checkbox" id="select-all-cb"></th>
<th>
<div class="text-center"><span class="glyphicon glyphicon-file"></span></div>
</th>
<th width="100%">File/Folder</th>
<th>Date&nbsp;Added</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr class="clickable-row" data-href="/comic/">
<td></td>
<td></td>
<td>loading data</td>
<td></td>
</tr>
</tbody>
</table>
</form>
</div>
{% endblock %}
{% block script %}
{% sri_static "js/recent_comics.min.js" %}
{% endblock %}

View File

@@ -1,37 +0,0 @@
{% extends "base.html" %}
{% load bootstrap4 %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="container">
{% if error_message %}
<div class="alert alert-danger" role="alert">{{ error_message|safe }}</div>
{% endif %}
{% if success_message %}
<div class="alert alert-success" role="alert">{{ success_message|safe }}</div>
{% endif %}
<form method="POST">
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="submit" class="btn btn-secondary">Submit</button>
{% endbuttons %}
</form>
{% endblock %}
{% block content2 %}
{% if error_message %}
<div class="alert alert-danger" role="alert">{{ error_message }}</div>
{% endif %}
<form method="POST">
{% csrf_token %}
<div class="form-group">
<label for="base_directory">Base Directory</label>
<input type="text" class="form-control" id="base_directory" name="base_directory" placeholder="Base Directory" value="{{ base_dir.value }}">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
{% endblock %}

View File

@@ -1,36 +0,0 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
{% if error_message %}
<div class="alert alert-danger" role="alert">{{ error_message|safe }}</div>
{% endif %}
{% if success_message %}
<div class="alert alert-success" role="alert">{{ success_message|safe }}</div>
{% endif %}
<form method="POST">
{% csrf_token %}
{% for item in form %}
<div class="form-group">
<label for="{{ item.id_for_label }}">{{ item.help_text }}</label>
{{ item }}
</div>
{% endfor %}
<button type="submit" class="btn btn-default">Submit</button>
</form>
{% endblock %}
{% block content2 %}
{% if error_message %}
<div class="alert alert-danger" role="alert">{{ error_message }}</div>
{% endif %}
<form method="POST">
{% csrf_token %}
<div class="form-group">
<label for="base_directory">Base Directory</label>
<input type="text" class="form-control" id="base_directory" name="base_directory" placeholder="Base Directory" value="{{ base_dir.value }}">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
{% endblock %}

View File

@@ -1,34 +0,0 @@
{% extends "base.html" %}
{% block title %}CBWebReader - Users{% endblock %}
{% block content %}
<div class="container">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>#</th>
<th>Username</th>
<th>Email</th>
<th>Superuser</th>
<th>Classification</th>
</tr>
</thead>
<tbody data-link="row" class="rowlink">
{% for user in users %}
<tr>
<td>{{user.id}}</td>
<td><a href="{% url 'user_details' user.id %}">{{user.username}}</a></td>
<td>{{user.email}}</td>
<td>{{user.is_superuser}}</td>
<td>{{ user.usermisc.get_allowed_to_read_display }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-secondary" href="{% url 'add_users' %}" role="button">Add User</a>
</div>
{% endblock %}
{% block script %}
{% endblock %}