Skip to content

Commit

Permalink
lml#341: Fix multiple choice styles.
Browse files Browse the repository at this point in the history
- Ensure that multiple choices are laid out in columnar fashion.
- Add mark_correct variable to toggle correct answer tagging
  in the HTML element with a class.  This is needed to make sure
  correct answer is not revealed through view source :)
  • Loading branch information
navilan committed May 20, 2014
1 parent 437adeb commit b75051b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/views/exercises/_choices.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
Params:
exercise: required
mark_correct: optional. Marks the correct answer with a class. default: false.
%>

<%
exercise_data = exercise.content
solution = exercise.correct_choice_index
solution = exercise.correct_choice_index
mark_correct = false if local_assigns[:mark_correct].nil?
%>

<div class:="question multiple-choice">
<ul class="unstyled">
<% exercise_data["simple_question"]["answer_choices"].each_with_index do |answer_choice, ii| %>
<li <% if solution == ii %>class="correct-answer"<% end %> >
<span class="choice-letter"><%= choice_letter(ii) %>)</span>
<span class="answer-choice"><%= answer_choice["html"].html_safe %></span>
<li class="row <% if mark_correct && solution == ii %>correct-answer<% end %>">
<div class="choice-letter span1"><%= choice_letter(ii) %>)</div>
<div class="answer-choice span6 text-left"><%= answer_choice["html"].html_safe %></div>
<li>
<% end %>
</ul>
Expand Down

0 comments on commit b75051b

Please sign in to comment.