Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 8b279ee

Browse files
authored
Challenge ratings (#114)
* Add user facing UI for CTFd/CTFd#2808
1 parent 902a087 commit 8b279ee

24 files changed

+126
-49
lines changed

assets/js/challenges.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ Alpine.data("Challenge", () => ({
7474
share_url: null,
7575
max_attempts: 0,
7676
attempts: 0,
77+
ratingValue: 0,
78+
hoveredRating: 0,
79+
selectedRating: 0,
80+
ratingReview: "",
81+
ratingSubmitted: false,
7782

7883
async init() {
7984
highlight();
@@ -221,6 +226,20 @@ Alpine.data("Challenge", () => ({
221226
// Dispatch load-challenges event to call loadChallenges in the ChallengeBoard
222227
this.$dispatch("load-challenges");
223228
},
229+
230+
async submitRating() {
231+
const response = await CTFd.pages.challenge.submitRating(
232+
this.id,
233+
this.selectedRating,
234+
this.ratingReview,
235+
);
236+
if (response.value) {
237+
this.ratingValue = this.selectedRating;
238+
this.ratingSubmitted = true;
239+
} else {
240+
alert("Error submitting rating");
241+
}
242+
},
224243
}));
225244

226245
Alpine.data("ChallengeBoard", () => ({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"verify": "vite build; git diff --quiet --exit-code"
1111
},
1212
"dependencies": {
13-
"@ctfdio/ctfd-js": "^0.0.17",
13+
"@ctfdio/ctfd-js": "^0.0.18",
1414
"@fontsource/lato": "^4.5.3",
1515
"@fontsource/raleway": "^4.5.3",
1616
"@fortawesome/fontawesome-free": "6.5.1",

static/assets/challenges.074c9899.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/challenges.4dca8d2f.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

static/assets/clipboard.be7a2341.js renamed to static/assets/clipboard.98f9b827.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/index.993fb568.js renamed to static/assets/index.b6be5691.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/notifications.389525f0.js renamed to static/assets/notifications.000e9e48.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/page.1b85bc2f.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import{C as o,m as d}from"./index.b6be5691.js";window.CTFd=o;window.Alpine=d;d.start();

static/assets/page.2f07bf20.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

static/assets/scoreboard.e0c9338a.js renamed to static/assets/scoreboard.53fd757c.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)