Skip to content

Commit 5f748af

Browse files
committed
fix: make buttons dimmer and make modal colors correct
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
1 parent e758094 commit 5f748af

3 files changed

Lines changed: 35 additions & 19 deletions

File tree

othello/static/css/base.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,25 @@ input, button{
143143
background-color: #f8d7da;
144144
}
145145

146+
.accept {
147+
background-color: #60cc7d;
148+
}
149+
150+
.reject {
151+
background-color: #f04646;
152+
}
153+
146154
.nav-button {
147155
background-color: transparent;
148156
border: transparent;
149157
color: white;
158+
}
159+
160+
.status-btn:hover {
161+
cursor: default !important;
162+
}
163+
164+
.status-btn:focus {
165+
outline: none !important;
166+
box-shadow: none !important;
150167
}

othello/templates/auth/rankings.html

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
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 %}

othello/templates/base.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585
<div class="main" id="main">
8686
<div id="messages" class="messages">
8787
{% for message in messages %}
88-
<div class="alert alert-{{ message.tags }} alert-dismissible fade show my-2" role="alert">
88+
<div class="alert alert-{% if message.tags == 'error' %}danger{% elif message.tags == 'success' %}success{% elif message.tags == 'warning' %}warning{% endif %} alert-dismissible fade show my-2"
89+
role="alert">
8990
{{ message }}
9091
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
9192
<span aria-hidden="true">&times;</span>

0 commit comments

Comments
 (0)