Skip to content

Commit

Permalink
Fix minor hint issues for #137
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Nov 7, 2020
1 parent 3f7b97c commit ebe81b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions huntserver/static/huntserver/staff_hints.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,16 @@ $(document).ready(function() {
}

$('#formModal').on('show.bs.modal', function (event) {
var regex = /<br\s*[\/]?>/gi;
var button = $(event.relatedTarget);
var modal = $(this);
var hint_request = button.parent().parent().parent();
var title = hint_request.find(".hint-title");
var response = hint_request.find(".hint-response");
var outer_row = hint_request.parent().parent().parent();
modal.find('.modal-title').html(title.html());
modal.find('.modal-body #modal-hint-text').text(hint_request.find(".hint-text").text());
modal.find('.modal-body #id_response').val(response.text());
modal.find('.modal-body #modal-hint-text').html(hint_request.find(".hint-text").html());
modal.find('.modal-body #id_response').val(response.html().replace(regex, "\n"));
modal.find('.modal-body #id_hint_id').val(outer_row.data("id"));
})

Expand Down
6 changes: 3 additions & 3 deletions huntserver/templates/hint_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</b>
</div>
<div class="hint-text">
{{ hint.request }}
{{ hint.request|linebreaksbr }}
</div>
</td>
</tr>
Expand All @@ -26,7 +26,7 @@
{% if hint.response %}
<td width="100px">{{ hint.response_time|time:"h:i a" }}</td>
<td>
<div class="hint-response">{{ hint.response }}</div>
<div class="hint-response">{{ hint.response|linebreaksbr }}</div>
<button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#formModal">
Edit response
</button>
Expand All @@ -43,7 +43,7 @@
{% else %}
{% if hint.response %}
<td width="100px">{{ hint.response_time|time:"h:i a" }}</td>
<td>{{ hint.response }}</td>
<td>{{ hint.response|linebreaksbr }}</td>
{% else %}
<td width="100px"></td>
<td><b>No response yet.</b></td>
Expand Down
4 changes: 4 additions & 0 deletions huntserver/templates/puzzle_hint.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ <h1> Hints for P{{ puzzle.puzzle_number }} - {{ puzzle.puzzle_name}} </h1>
{% if not puzzle.hunt.is_public %}
<h3 id="num_available_hints">You currently have {{team.num_available_hints}} available hint{{team.num_available_hints|pluralize}} for this hunt</h3>
{% endif %}
<a href='/puzzle/{{ puzzle.puzzle_id }}/'>
<h4 style="margin-bottom: -10px">Back to Puzzle Page</h4>
</a>
</div>
</div>
{% if not puzzle.hunt.is_public %}
Expand All @@ -41,6 +44,7 @@ <h3 id="num_available_hints">You currently have {{team.num_available_hints}} ava
<br>
<div class="col-md-12">
<h3>Previous Hint Requests: </h3>
<p>Hint responses will show up below automatically once your hint has been answered.</p>
<table id="hint_table" class="table">
{% if hint_list %}
{% for hint in hint_list reversed %}
Expand Down

0 comments on commit ebe81b6

Please sign in to comment.