diff --git a/BUGs b/BUGs index 767ff9c..f364e48 100644 --- a/BUGs +++ b/BUGs @@ -1,6 +1,2 @@ -### Next: 22 -BUG-22: search for (say) 0000, and the thumbnail sizes are a mess? - - div class row is missing (grouping is not set -- might be BUG-23 kickin in), - the right-click context is also missing, the size of thumbs is wrong too? -BUg-23: search for anything, then change view on search (eg group by, or num per page) and 'term' is not known +### Next: 25 BUg-24: duplicates of one type, but template shows both, so get odd choices between blank buttons (my test photo area, with no duplicates in 2 dirs only) diff --git a/files.py b/files.py index cfd477e..e41c14a 100644 --- a/files.py +++ b/files.py @@ -88,19 +88,7 @@ class FileType(db.Model): def __repr__(self): return "".format(self.id, self.name ) - -################################################################################ -# /file_list -> show detailed file list of files from import_path(s) -################################################################################ -@app.route("/file_list", methods=["GET"]) -def file_list(): - return render_template("file_list.html", page_title='View Files (details)', entry_data=Entry.query.order_by(Entry.name).all()) - -################################################################################ -# /files -> show thumbnail view of files from import_path(s) -################################################################################ -@app.route("/files", methods=["GET", "POST"]) -def files(): +def ViewingOptions( request ): noo="Oldest" grouping="Day" how_many="50" @@ -120,6 +108,22 @@ def files(): if 'next' in request.form: offset += int(how_many) + return noo, grouping, how_many, offset, size + +################################################################################ +# /file_list -> show detailed file list of files from import_path(s) +################################################################################ +@app.route("/file_list", methods=["GET"]) +def file_list(): + return render_template("file_list.html", page_title='View Files (details)', entry_data=Entry.query.order_by(Entry.name).all()) + +################################################################################ +# /files -> show thumbnail view of files from import_path(s) +################################################################################ +@app.route("/files", methods=["GET", "POST"]) +def files(): + + noo, grouping, how_many, offset, size = ViewingOptions( request ) entries=[] if noo == "Oldest": entries=Entry.query.join(File).order_by(File.year,File.month,File.day,Entry.name).offset(offset).limit(how_many).all() @@ -127,17 +131,21 @@ def files(): entries=Entry.query.join(File).order_by(File.year.desc(),File.month.desc(),File.day.desc(),Entry.name).offset(offset).limit(how_many).all() return render_template("files.html", page_title='View Files', entry_data=entries, noo=noo, grouping=grouping, how_many=how_many, offset=offset, size=size ) + ################################################################################ # /search -> show thumbnail view of files from import_path(s) ################################################################################ @app.route("/search", methods=["GET","POST"]) def search(): - file_data=Entry.query.filter(Entry.name.ilike(f"%{request.form['term']}%")).all() - ai_data=Entry.query.join(File).join(FileRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(FileRefimgLink.matched==True).filter(Person.tag.ilike(f"%{request.form['term']}%")).all() + noo, grouping, how_many, offset, size = ViewingOptions( request ) + + file_data=Entry.query.join(File).filter(Entry.name.ilike(f"%{request.form['term']}%")).order_by(File.year.desc(),File.month.desc(),File.day.desc(),Entry.name).offset(offset).limit(how_many).all() + ai_data=Entry.query.join(File).join(FileRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(FileRefimgLink.matched==True).filter(Person.tag.ilike(f"%{request.form['term']}%")).order_by(File.year.desc(),File.month.desc(),File.day.desc(),Entry.name).offset(offset).limit(how_many).all() all_entries = file_data + ai_data - return render_template("files.html", page_title='View Files', entry_data=all_entries) + + return render_template("files.html", page_title='View Files', search_term=request.form['term'], entry_data=all_entries, noo=noo, grouping=grouping, how_many=how_many, offset=offset, size=size ) ################################################################################ # /files/scannow -> allows us to force a check for new files diff --git a/templates/base.html b/templates/base.html index 14f3435..0eaf72a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -94,8 +94,13 @@ -
- + + + + + + +
@@ -133,6 +138,35 @@ + {%block script_content %}{% endblock script_content %} diff --git a/templates/files.html b/templates/files.html index 14db27b..272fb83 100644 --- a/templates/files.html +++ b/templates/files.html @@ -9,7 +9,10 @@
-
+ + {% if search_term is defined %} + + {% endif %}
{{CreateSelect( "noo", noo, ["Oldest", "Newest"], "$('#offset').val(0)")|safe }} @@ -17,8 +20,12 @@ grouped by: {{CreateSelect( "grouping", grouping, ["None", "Day", "Week", "Month"])|safe }}
+ {% if search_term is defined %} +
+ Searched for: '{{search_term}}' +
+ {% endif %}
- {% set fd=entry_data[0].file_details[0] %}  {{how_many}} files