Skip to content

Commit

Permalink
fix: Rename level 109 and make popup buttons match styles
Browse files Browse the repository at this point in the history
  • Loading branch information
faucomte97 committed Nov 3, 2023
1 parent 52e504f commit 8a47500
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
4 changes: 2 additions & 2 deletions game/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
35 changes: 27 additions & 8 deletions game/static/game/js/drawing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,25 +1050,28 @@ ocargo.Drawing.startPopup = function (
if (youtubeVideo[0]) {
$("#modal-mascot").hide()
}

// create a wrapper for the buttons that will be appended
let buttonDiv = $("<div>").addClass("modal-buttons")

const icons = [
$("<span>").addClass("iconify icon").attr("data-icon", "mdi:chevron-left"),
"NOT USED",
$("<span>").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 = [
$("<span>").addClass("iconify icon").attr("data-icon", "mdi:chevron-left"),
"NOT USED",
$("<span>").addClass("iconify icon").attr("data-icon", "mdi:chevron-right"),
]

const links = [
PREV_LEVEL_URL,
"",
NEXT_LEVEL_URL,
]

const regexID = /id=\"*\w+_\w+\"/
// create a wrapper for the buttons that will be appended
let buttonDiv = $("<div>").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('"', '')
Expand All @@ -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()
Expand Down

0 comments on commit 8a47500

Please sign in to comment.