From ce7d955ef8fa0d009af96aa6a3efeb4999a88bbe Mon Sep 17 00:00:00 2001 From: mdivecky <matej@divecky.com> Date: Fri, 18 Aug 2023 08:52:08 +0200 Subject: [PATCH] Keep default behavior on checkbox --- view/app.py | 4 ++-- view/templates/index.html | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/view/app.py b/view/app.py index b7468cb..a9ce493 100644 --- a/view/app.py +++ b/view/app.py @@ -48,7 +48,7 @@ def index(): query = websearch_to_fts_query(search) if search else None # View options - compact_diffs = request.args.get("compact_diffs") is not None + expand_diffs = request.args.get("expand_diffs") is not None db.execute(f"SELECT count(*) FROM diffs{'_fts(?)' if query else ''}", (query,) if query else ()) @@ -80,7 +80,7 @@ def index(): pagination=pagination, diff_count = diff_count, search=search, - compact_diffs=compact_diffs, + expand_diffs=expand_diffs, ) diff --git a/view/templates/index.html b/view/templates/index.html index fbae8f8..63265a8 100644 --- a/view/templates/index.html +++ b/view/templates/index.html @@ -23,13 +23,13 @@ </button> </form> <label class="checkbox"> - <input type="checkbox" name="compact_diffs" value="true" + <input type="checkbox" name="expand_diffs" value="true" hx-get="/" hx-target="#diff-list" hx-select="#diff-list" hx-swap="outerHTML" /> - <p>Compact diffs</p> + <p>Expand diffs</p> </label> </div> </div> @@ -50,9 +50,7 @@ </a> </p> - {% if compact_diffs %} - <div class="changeset-card-title">{{ diff.diff_html|safe }}</div> - {% else %} + {% if expand_diffs %} <div class="changeset-card-diff-s"> <div> <div class="text-caption">Before</div> @@ -74,6 +72,8 @@ <td class="diff-after changeset-card-title">{{ diff.diff_html|safe }}</td> </tr> </table> + {% else %} + <div class="changeset-card-title">{{ diff.diff_html|safe }}</div> {% endif %} </article> {% endfor %}