From f03dd9f422b7f88f7a14f658715865a2db552b70 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 16 Nov 2023 19:42:35 -0500 Subject: allow re-solving on the same day --- app/views/wittle/puzzles/_handle_puzzle.html.erb | 8 ++++++-- app/views/wittle/puzzles/show.html.haml | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/views/wittle/puzzles/_handle_puzzle.html.erb b/app/views/wittle/puzzles/_handle_puzzle.html.erb index e451745..f0e3227 100644 --- a/app/views/wittle/puzzles/_handle_puzzle.html.erb +++ b/app/views/wittle/puzzles/_handle_puzzle.html.erb @@ -19,7 +19,7 @@ function setTime() { } window.onload = function() { - <% if @playable %> + <% if @playable or @puzzle.latest? %> $("#sens").val(window.settings.sensitivity) $("#sens").on("change", function() { window.settings.sensitivity = this.value @@ -28,7 +28,9 @@ window.onload = function() { $("#volume").on("change", function() { window.settings.volume = this.value }) + <% end %> + <% if @playable %> <% if @already_started %> var puzzle = window.deserializePuzzle("<%= @puzzle.data %>") draw(puzzle) @@ -52,7 +54,9 @@ window.onload = function() { var puzzle = window.deserializePuzzle("<%= @puzzle.data %>") draw(puzzle) drawPath(puzzle, JSON.parse("<%= escape_javascript(sanitize @solution) %>")) - window.trace = function() {} + <% unless @puzzle.latest? %> + window.trace = function() {} + <% end %> <% end %> } diff --git a/app/views/wittle/puzzles/show.html.haml b/app/views/wittle/puzzles/show.html.haml index 679046d..5eb34a4 100644 --- a/app/views/wittle/puzzles/show.html.haml +++ b/app/views/wittle/puzzles/show.html.haml @@ -12,6 +12,7 @@ %label#minutes 00 %label#colon : %label#seconds 00 +- if @playable or @puzzle.latest? %details#trace-settings %summary Settings .things @@ -19,7 +20,7 @@ %input#sens{ type: "range", min: "0.1", max: "1.3", step: "0.1" } %label{ for: "volume" } Volume %input#volume{ type: "range", min: "0", max: "0.24", step: "0.02" } -- else +- unless @playable #scores #by-time %h2 Fastest Solves -- cgit 1.4.1