Change challenge visibility badge on challenge update (#1331)

* Refresh challenge visibility badge after challenge update. A stopgap solution until a better state based UI is implemented. 
* Closes #1267
1318-submissions-api-improvements
Kevin Chung 2020-04-18 03:43:30 -04:00 committed by GitHub
parent 25fe789da8
commit 24c3520685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 5 deletions

View File

@ -407,8 +407,23 @@ $(() => {
.then(function(response) {
return response.json();
})
.then(function(data) {
if (data.success) {
.then(function(response) {
if (response.success) {
$(".challenge-state").text(response.data.state);
switch (response.data.state) {
case "visible":
$(".challenge-state")
.removeClass("badge-danger")
.addClass("badge-success");
break;
case "hidden":
$(".challenge-state")
.removeClass("badge-success")
.addClass("badge-danger");
break;
default:
break;
}
ezToast({
title: "Success",
body: "Your challenge has been updated!"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@
<h2 class="text-center">{{ challenge.type }}</h2>
{% set badge_state = 'badge-danger' if challenge.state == 'hidden' else 'badge-success' %}
<h5>
<span class="badge {{ badge_state }}">
<span class="badge {{ badge_state }} challenge-state">
{{ challenge.state }}
</span>
</h5>