From 4ceb8a7a27aa57bcc25b9cd884a587623b9b71b6 Mon Sep 17 00:00:00 2001 From: Florian Aucomte <33633200+faucomte97@users.noreply.github.com> Date: Tue, 28 Nov 2023 10:29:19 +0000 Subject: [PATCH] fix: Buttons in level editor popup (#1539) * fix: Buttons in level editor popup * Remove codecov comment * Disable comments --- .codecov.yml | 11 ++--------- game/static/game/css/game_screen.css | 6 ++++++ game/static/game/js/drawing.js | 27 +++++++++------------------ game/static/game/js/level_editor.js | 21 ++++++--------------- 4 files changed, 23 insertions(+), 42 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index a74ec4583..7a1c01f63 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -6,15 +6,8 @@ coverage: patch: default: target: 90% - -comment: - layout: "reach, diff, flags, files" - behavior: new - require_changes: false - require_base: no - require_head: yes - branches: - - "!master" + +comment: false ignore: - "game/tests/*.py" diff --git a/game/static/game/css/game_screen.css b/game/static/game/css/game_screen.css index fbd61fa5c..549667581 100644 --- a/game/static/game/css/game_screen.css +++ b/game/static/game/css/game_screen.css @@ -349,6 +349,12 @@ button > svg { padding-right: 10px; } +.navigation_button_portal_secondary.long_button span { + text-align: left; + margin: 0; + width: 100%; +} + .long_button img + span { line-height: 30px; margin-left: 2px; diff --git a/game/static/game/js/drawing.js b/game/static/game/js/drawing.js index 5cb96153b..8cefe64ad 100644 --- a/game/static/game/js/drawing.js +++ b/game/static/game/js/drawing.js @@ -1102,11 +1102,20 @@ ocargo.Drawing.startPopup = function ( tryAgainButton.removeClass().addClass("navigation_button_portal long_button rapid-router-welcome") buttonDiv.append(tryAgainButton) + let editButton = $("#edit_button") + editButton.removeClass().addClass("navigation_button_portal long_button rapid-router-welcome") + buttonDiv.append(editButton) + 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) + let playButton = $("#play_button") + playButton.removeClass().addClass("navigation_button_portal_secondary long_button rapid-router-welcome button--icon") + playButton.append(icons[2]) + buttonDiv.append(playButton) + $("#modal-buttons").html(buttonDiv) } else { $('#modal-buttons').html( @@ -1140,24 +1149,6 @@ ocargo.Drawing.startYesNoPopup = function ( $('#modal-noBtn').click(noFunction) } -// This provides a pop-up with 2 options -ocargo.Drawing.startOptionsPopup = function ( - title, - subtitle, - message, - optionAFunction, - optionBFunction, - optionAText, - optionBText, - mascot -) { - let buttonHtml = - ' ' - ocargo.Drawing.startPopup(title, subtitle, message, mascot, buttonHtml) - $('#modal-optionABtn').click(optionAFunction) - $('#modal-optionBBtn').click(optionBFunction) -} - // This is the function that starts the pop-up when there is no internet connection while playing the game ocargo.Drawing.startInternetDownPopup = function () { ocargo.Drawing.startPopup( diff --git a/game/static/game/js/level_editor.js b/game/static/game/js/level_editor.js index fb301af75..5da3904cd 100644 --- a/game/static/game/js/level_editor.js +++ b/game/static/game/js/level_editor.js @@ -2727,7 +2727,6 @@ ocargo.LevelEditor = function(levelId) { /******************/ $(function() { - var editor = new ocargo.LevelEditor(LEVEL); var subtitle = interpolate( gettext('Click %(help_icon)s%(help_label)s for clues on getting started.'), { help_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/help.svg', 'popupHelp'), @@ -2738,24 +2737,16 @@ $(function() { if (LEVEL === null){ ocargo.Drawing.startPopup(gettext('Welcome to the Level editor!'), subtitle, ''); } else { - var optionAFunc = function(){ - $(".ocargo-modal").hide(); - $(".modal-overlay").hide(); - }; - - var optionBFunc = function(){ - window.location.replace("/rapidrouter/custom/"+LEVEL+"/"); - }; + let buttons = ''; + buttons += ocargo.button.dismissButtonHtml("edit_button", "Edit"); + buttons += ocargo.button.redirectButtonHtml("play_button", Urls.levels() + "custom/" + LEVEL,"Play"); - ocargo.Drawing.startOptionsPopup( + ocargo.Drawing.startPopup( gettext('Welcome back!'), gettext('Would you like to edit or play with your design?'), '', - optionAFunc, - optionBFunc, - "Edit", - "Play", - '' + false, + buttons, ); }