Keep default behavior on checkbox

This commit is contained in:
mdivecky 2023-08-18 08:52:08 +02:00
parent b36cb55b36
commit ce7d955ef8
2 changed files with 7 additions and 7 deletions

View file

@ -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,
)

View file

@ -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 %}