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 query = websearch_to_fts_query(search) if search else None
# View options # 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 ()) db.execute(f"SELECT count(*) FROM diffs{'_fts(?)' if query else ''}", (query,) if query else ())
@ -80,7 +80,7 @@ def index():
pagination=pagination, pagination=pagination,
diff_count = diff_count, diff_count = diff_count,
search=search, search=search,
compact_diffs=compact_diffs, expand_diffs=expand_diffs,
) )

View file

@ -23,13 +23,13 @@
</button> </button>
</form> </form>
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" name="compact_diffs" value="true" <input type="checkbox" name="expand_diffs" value="true"
hx-get="/" hx-get="/"
hx-target="#diff-list" hx-target="#diff-list"
hx-select="#diff-list" hx-select="#diff-list"
hx-swap="outerHTML" hx-swap="outerHTML"
/> />
<p>Compact diffs</p> <p>Expand diffs</p>
</label> </label>
</div> </div>
</div> </div>
@ -50,9 +50,7 @@
</a> </a>
</p> </p>
{% if compact_diffs %} {% if expand_diffs %}
<div class="changeset-card-title">{{ diff.diff_html|safe }}</div>
{% else %}
<div class="changeset-card-diff-s"> <div class="changeset-card-diff-s">
<div> <div>
<div class="text-caption">Before</div> <div class="text-caption">Before</div>
@ -74,6 +72,8 @@
<td class="diff-after changeset-card-title">{{ diff.diff_html|safe }}</td> <td class="diff-after changeset-card-title">{{ diff.diff_html|safe }}</td>
</tr> </tr>
</table> </table>
{% else %}
<div class="changeset-card-title">{{ diff.diff_html|safe }}</div>
{% endif %} {% endif %}
</article> </article>
{% endfor %} {% endfor %}