complete rewrite of viewer, videos need to be fixed. Otherwise, viewer now loads entry data for all "how_many" images on the screen, and allows prev/next movement between images without a DB load for the current page of images, then as required, it will retrieve the prev/next "how_many" from the database via /viewlist route, and go back into view/<id> of the appropriate new image of the new list. Also prevents going below 0 and beyond end of DB for the first time.

This commit is contained in:
2021-08-27 23:38:31 +10:00
parent 652a89161d
commit 1d3caf17de
6 changed files with 419 additions and 357 deletions

View File

@@ -2,26 +2,26 @@
<div class="container-fluid">
<h3 class="offset-2">{{page_title}}</h3>
<form id="main_form" method="POST">
<input id="offset" type="hidden" name="offset" value="{{offset}}">
<input id="offset" type="hidden" name="offset" value="{{OPT['offset']}}">
<input id="grouping" type="hidden" name="grouping" value="">
<input id="size" type="hidden" name="size" value="">
<input id="cwd" type="hidden" name="cwd" value="">
<input id="folders" type="hidden" name="folders" value="False">
<div class="col col-auto">
<div class="input-group">
{{CreateSelect( "noo", noo, ["Oldest", "Newest","A to Z", "Z to A"], "$('#offset').val(0)", "rounded-start py-1 my-1")|safe }}
{{CreateSelect( "how_many", how_many, ["10", "25", "50", "75", "100", "150", "200", "500"], "", "rounded-end py-1 my-1" )|safe }}
{{CreateSelect( "noo", OPT['noo'], ["Oldest", "Newest","A to Z", "Z to A"], "$('#offset').val(0)", "rounded-start py-1 my-1")|safe }}
{{CreateSelect( "how_many", OPT['how_many'], ["10", "25", "50", "75", "100", "150", "200", "500"], "", "rounded-end py-1 my-1" )|safe }}
<div class="mb-1 col my-auto d-flex justify-content-center">
{% set prv_disabled="" %}
{% if offset|int == 0 %}
{% if OPT['offset']|int == 0 %}
{% set prv_disabled="disabled" %}
{% endif %}
<button id="prev" {{prv_disabled}} name="prev" class="prev sm-txt btn btn-outline-secondary">
<svg width="16" height="16" fill="currentColor"><use xlink:href="{{url_for('internal', filename='icons.svg')}}#prev"/></svg>
</button>
<span class="sm-txt my-auto">&nbsp;{{how_many}} files&nbsp;</span>
<span class="sm-txt my-auto">&nbsp;{{OPT['how_many']}} files&nbsp;</span>
{% set nxt_disabled="" %}
{% if entry_data|length < how_many|int %}
{% if entry_data|length < OPT['how_many']|int %}
{% set nxt_disabled="disabled" %}
{% endif %}
<button id="next" {{nxt_disabled}} name="next" class="next sm-txt btn btn-outline-secondary">