Added js for type buttons

This commit is contained in:
Aykhan-s 2023-02-19 14:33:18 +04:00
parent 9cc2fe24ec
commit 292bd93b32
2 changed files with 16 additions and 15 deletions

View File

@ -1,3 +0,0 @@
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=

View File

@ -14,26 +14,30 @@
<button class="btn btn-outline-success my-2 my-sm-0 ml-2" type="submit">Search</button> <button class="btn btn-outline-success my-2 my-sm-0 ml-2" type="submit">Search</button>
</div> </div>
<br> <br>
{% if type == "all" %}
<input id="all" name="type" type="radio" value="all" checked>
{% else %}
<input id="all" name="type" type="radio" value="all"> <input id="all" name="type" type="radio" value="all">
{% endif %}
<label for="all" style="margin-right: 1.5rem;">All</label> <label for="all" style="margin-right: 1.5rem;">All</label>
{% if type == "watched" %}
<input id="watched" name="type" type="radio" value="watched" checked>
{% else %}
<input id="watched" name="type" type="radio" value="watched"> <input id="watched" name="type" type="radio" value="watched">
{% endif %}
<label for="watched" style="margin-right: 1.5rem;">Watched</label> <label for="watched" style="margin-right: 1.5rem;">Watched</label>
{% if type == "unwatched" %}
<input id="unwatched" name="type" type="radio" value="unwatched" checked>
{% else %}
<input id="unwatched" name="type" type="radio" value="unwatched"> <input id="unwatched" name="type" type="radio" value="unwatched">
{% endif %}
<label for="unwatched">Unwatched</label> <label for="unwatched">Unwatched</label>
</form> </form>
<script>
switch ("{{type}}") {
case 'all':
document.getElementById('all').checked = true;
break;
case 'watched':
document.getElementById('watched').checked = true;
break;
case 'unwatched':
document.getElementById('unwatched').checked = true;
break;
}
</script>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>