Skip to content

Commit

Permalink
Clean up code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Mar 22, 2024
1 parent 955581d commit 4a37abd
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions app/assets/javascripts/answers.coffee.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# https://stackoverflow.com/a/8133832/
<% environment.context_class.instance_eval { include ApplicationHelper } %>

# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

# change button 'Bearbeiten' to 'verwerfen' after answer body is revealed

# the "target button" is either the "discard" button or the "edit" button
# what its purpose is is stored in this object with a mapping
# id -> boolean
# The "target button" is either the "discard" button or the "edit" button
# what its purpose is is stored in this object with a mapping:
# answerId -> boolean
targetButtonIsDiscardButton = {}
window.registeredDiscardListeners = new Set(); # set of answer ids

# Set of answer ids that have a discard listener registered
# This is to avoid registering the same listener multiple times.
window.registeredDiscardListeners = new Set();

$(document).on 'turbolinks:load', ->

Expand All @@ -32,8 +28,7 @@ $(document).on 'turbolinks:load', ->
$target.empty().append($target.data('edit'))
.removeClass('btn-secondary').addClass('btn-primary')

# change color of box depending on whether answer is marked
# as correct or incorrect
# Appearance of box
$(document).on 'change', '[id^="answer-value-"]', ->
id = $(this).data('id')
isCorrectAnswer = $('#answer-true-' + id).is(':checked')
Expand Down

0 comments on commit 4a37abd

Please sign in to comment.