66{% block main %}
77< div class ="container ">
88 < h1 > User Rankings</ h1 >
9- < table class ="table table-striped ">
9+ < table class ="table ">
1010 < thead >
1111 < tr >
1212 < th > Rank</ th >
1313 < th > Username</ th >
1414 < th > Rating</ th >
15- < th > Request Unranked</ th >
16- < th > Request Ranked</ th >
15+ < th > Unranked</ th >
16+ < th > Ranked</ th >
17+ < th > </ th >
1718 </ tr >
1819 </ thead >
1920 < tbody >
@@ -22,8 +23,18 @@ <h1>User Rankings</h1>
2223 < td > {{ page_obj.start_index|add:forloop.counter|add:-1 }}</ td >
2324 < td > < a href ="{% url 'auth:profile' user.username %} "> {{ user.username }}</ a > </ td >
2425 < td > {{ user.rating }}</ td >
25- < td > {% if user.username in users_with_submissions and user.accept_unranked_matches %}< button type ="button " class ="btn btn-primary btn-sm " data-toggle ="modal " data-target ="#requestMatchModal " data-username ="{{ user.username }} " data-type ="unranked "> Request Unranked</ button > {% endif %}</ td >
26- < td > {% if user.username in users_with_submissions and user.accept_ranked_matches %}< button type ="button " class ="btn btn-primary btn-sm " data-toggle ="modal " data-target ="#requestMatchModal " data-username ="{{ user.username }} " data-type ="ranked "> Request Ranked</ button > {% endif %}</ td >
26+ < td > {% if user.accept_unranked_matches %}
27+ < button class ="btn btn-sm win status-btn "> Auto-Accept</ button >
28+ {% else %}
29+ < button class ="btn btn-sm lose status-btn "> Auto-Reject</ button >
30+ {% endif %}
31+ </ td >
32+ < td > {% if user.accept_ranked_matches %}
33+ < button class ="btn btn-sm win status-btn "> Auto-Accept</ button >
34+ {% else %}
35+ < button class ="btn btn-sm lose status-btn "> Auto-Reject</ button >
36+ {% endif %}</ td >
37+ < td > {% if user.username in users_with_submissions %}< button type ="button " class ="btn btn-primary btn-sm " data-toggle ="modal " data-target ="#requestMatchModal " data-username ="{{ user.username }} "> Request Match</ button > {% endif %}</ td >
2738 </ tr >
2839 {% endfor %}
2940 </ tbody >
@@ -73,7 +84,6 @@ <h5 class="modal-title" id="requestMatchModalLabel">Request a Match</h5>
7384$ ( '#requestMatchModal' ) . on ( 'show.bs.modal' , function ( event ) {
7485 var button = $ ( event . relatedTarget ) ;
7586 var username = button . data ( 'username' ) ;
76- var type = button . data ( 'type' ) ;
7787 var form = $ ( '#requestMatchForm' ) ;
7888 var action = form . attr ( 'action' ) ;
7989 if ( action . indexOf ( '?' ) > - 1 ) {
@@ -90,28 +100,16 @@ <h5 class="modal-title" id="requestMatchModalLabel">Request a Match</h5>
90100 } ) ;
91101
92102 select . prop ( 'disabled' , true ) ;
93-
94- var isRankedCheckbox = form . find ( 'input[name="is_ranked"]' ) ;
95- if ( type === 'ranked' ) {
96- isRankedCheckbox . prop ( 'checked' , true ) ;
97- } else {
98- isRankedCheckbox . prop ( 'checked' , false ) ;
99- }
100- isRankedCheckbox . prop ( 'disabled' , true ) ;
101103} ) ;
102104
103105$ ( '#requestMatchForm' ) . on ( 'submit' , function ( ) {
104106 $ ( this ) . find ( 'select[name="opponent"]' ) . prop ( 'disabled' , false ) ;
105- $ ( this ) . find ( 'input[name="is_ranked"]' ) . prop ( 'disabled' , false ) ;
106107} ) ;
107108
108109$ ( '#requestMatchModal' ) . on ( 'hidden.bs.modal' , function ( ) {
109110 var form = $ ( '#requestMatchForm' ) ;
110111 var select = form . find ( 'select[name="opponent"]' ) ;
111112 select . prop ( 'disabled' , false ) ;
112- var isRankedCheckbox = form . find ( 'input[name="is_ranked"]' ) ;
113- isRankedCheckbox . prop ( 'disabled' , false ) ;
114113} ) ;
115-
116114</ script >
117115{% endblock %}
0 commit comments