From fa5b02a767bde4e1836f828613e568cef01ced58 Mon Sep 17 00:00:00 2001 From: Florian Aucomte <33633200+faucomte97@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:51:46 +0000 Subject: [PATCH] fix: While loop final checks (#1513) * fix: Rename level 109 and make popup buttons match styles * Grey out coming soon episodes * Merge branch 'master' into while_loop_final_checks * Lighter grey and fix typo * Merge remote-tracking branch 'origin/while_loop_final_checks' into while_loop_final_checks * Remove chevron * Merge branch 'master' into while_loop_final_checks --- game/messages.py | 6 ++-- game/static/game/css/backgrounds.css | 4 +++ game/static/game/css/level_selection.css | 4 +-- game/static/game/js/drawing.js | 35 ++++++++++++++++++------ game/templates/game/level_selection.html | 13 ++++++--- 5 files changed, 45 insertions(+), 17 deletions(-) diff --git a/game/messages.py b/game/messages.py index 2a074c645..4f83244f7 100644 --- a/game/messages.py +++ b/game/messages.py @@ -2339,12 +2339,12 @@ def hint_level108(): def title_level109(): - return "Final challenge!" + return "Spiral challenge!" def description_level109(): message = ( - "For the last challenge, the road straight line sections of road start off increasing " + "For this challenge, the road straight line sections of road start off increasing " "by 1 after each turn and then switch to dividing by 2 with a twist!" ) return build_description(title_level109(), message) @@ -2458,7 +2458,7 @@ def hint_level109(): lambda: "Wiggle while you work", lambda: build_description( title_level117(), - "This time is's a little harder. We've added the directions back in." + "This time it's a little harder. We've added the directions back in." "
" "Can you put them in the right place?" "

" diff --git a/game/static/game/css/backgrounds.css b/game/static/game/css/backgrounds.css index 05c3c315b..b661f5e86 100644 --- a/game/static/game/css/backgrounds.css +++ b/game/static/game/css/backgrounds.css @@ -31,3 +31,7 @@ .bg--loops { background: #3F3F3F; } + +.bg--loops-coming-soon { + background: #CBCBCB; +} diff --git a/game/static/game/css/level_selection.css b/game/static/game/css/level_selection.css index 62e11de1f..a0aefee4a 100644 --- a/game/static/game/css/level_selection.css +++ b/game/static/game/css/level_selection.css @@ -73,13 +73,13 @@ margin-left: 15px; } -#episodes .collapsed.episode_range_text::after { +#episodes .panel-header:not(.bg--loops-coming-soon) .collapsed.episode_range_text::after { content: "\e250"; font-family: "Glyphicons Halflings"; margin-left: 10px; } -#episodes .episode_range_text::after { +#episodes .panel-header:not(.bg--loops-coming-soon) .episode_range_text::after { content: "\e252"; font-family: "Glyphicons Halflings"; margin-left: 10px; diff --git a/game/static/game/js/drawing.js b/game/static/game/js/drawing.js index 2a2938c84..e25e40f9e 100644 --- a/game/static/game/js/drawing.js +++ b/game/static/game/js/drawing.js @@ -1050,16 +1050,20 @@ ocargo.Drawing.startPopup = function ( if (youtubeVideo[0]) { $("#modal-mascot").hide() } + + // create a wrapper for the buttons that will be appended + let buttonDiv = $("
").addClass("modal-buttons") + + const icons = [ + $("").addClass("iconify icon").attr("data-icon", "mdi:chevron-left"), + "NOT USED", + $("").addClass("iconify icon").attr("data-icon", "mdi:chevron-right"), + ] + // buttons are passed as html string.. // hence this terribleness // check if we pass an array of buttons or just one button if (Array.isArray(buttons)) { - const icons = [ - $("").addClass("iconify icon").attr("data-icon", "mdi:chevron-left"), - "NOT USED", - $("").addClass("iconify icon").attr("data-icon", "mdi:chevron-right"), - ] - const links = [ PREV_LEVEL_URL, "", @@ -1067,8 +1071,7 @@ ocargo.Drawing.startPopup = function ( ] const regexID = /id=\"*\w+_\w+\"/ - // create a wrapper for the buttons that will be appended - let buttonDiv = $("
").addClass("modal-buttons") + for (let i = 0; i < buttons.length; i++) { // get id with regex by stripping the html content let currentID = buttons[i].match(regexID)[0].slice(3).replaceAll('"', '') @@ -1094,10 +1097,26 @@ ocargo.Drawing.startPopup = function ( else if (buttons) { $('#modal-buttons').html(buttons) + + let tryAgainButton = $("#try_again_button") + tryAgainButton.removeClass().addClass("navigation_button_portal long_button rapid-router-welcome") + buttonDiv.append(tryAgainButton) + + let nextLevelButton = $("#next_level_button") + nextLevelButton.removeClass().addClass("navigation_button_portal_secondary long_button rapid-router-welcome button--icon") + nextLevelButton.append(icons[2]) + buttonDiv.append(nextLevelButton) + + $("#modal-buttons").html(buttonDiv) } else { $('#modal-buttons').html( ocargo.button.dismissButtonHtml('close_button', gettext('Close')) ) + + let closeButton = $("#close_button") + closeButton.removeClass().addClass("navigation_button_portal long_button rapid-router-welcome") + buttonDiv.append(closeButton) + $("#modal-buttons").html(buttonDiv) } // Show popup $("#myModal").show() diff --git a/game/templates/game/level_selection.html b/game/templates/game/level_selection.html index a449fafad..002d29d52 100644 --- a/game/templates/game/level_selection.html +++ b/game/templates/game/level_selection.html @@ -173,13 +173,18 @@

Python levels

{% for episode in pythonEpisodes %} {% if episode.difficulty == "loops" %} -
-
+
Owned by {{ teacher|make_into_username }}
{% endif %}
-{% endblock content %} \ No newline at end of file +{% endblock content %}