mirror of https://github.com/JohnHammond/CTFd.git
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 #12671318-submissions-api-improvements
parent
25fe789da8
commit
24c3520685
|
@ -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
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue