From 64c91cf2391b2aabf82a7646cda8d45755ede99f Mon Sep 17 00:00:00 2001
From: Felix Sun
Date: Wed, 31 Jul 2013 15:17:18 -0400
Subject: [PATCH] UX improvements to hinting. Interface is now less cluttered.
Hint submission is hidden behind a link, if there are hints to vote on.
---
.../js/src/crowdsource_hinter/display.coffee | 20 ++++---
common/templates/hinter_display.html | 54 ++++++++++---------
2 files changed, 40 insertions(+), 34 deletions(-)
diff --git a/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee b/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee
index d973f9a564..a1dc35a604 100644
--- a/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee
+++ b/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee
@@ -37,13 +37,14 @@ class @Hinter
@$('input.submit-hint').click @submit_hint
@$('.custom-hint').click @clear_default_text
@$('#answer-tabs').tabs({active: 0})
- @$('.expand-goodhint').click @expand_goodhint
+ @$('.expand').click @expand
- expand_goodhint: =>
- if @$('.goodhint').css('display') == 'none'
- @$('.goodhint').css('display', 'block')
+ expand: (eventObj) =>
+ target = @$('#' + @$(eventObj.currentTarget).data('target'))
+ if @$(target).css('display') == 'none'
+ @$(target).css('display', 'block')
else
- @$('.goodhint').css('display', 'none')
+ @$(target).css('display', 'none')
vote: (eventObj) =>
target = @$(eventObj.currentTarget)
@@ -53,9 +54,12 @@ class @Hinter
@render(response.contents)
submit_hint: (eventObj) =>
- target = @$(eventObj.currentTarget)
- textarea = $('.custom-hint[data-answer="'+target.attr('data-answer')+'"]')
- post_json = {'answer': target.attr('data-answer'), 'hint': @$(textarea).val()}
+ textarea = $('.custom-hint')
+ answer = $('input:radio[name=answer-select]:checked').val()
+ if answer == undefined
+ # The user didn't choose an answer. Do nothing.
+ return
+ post_json = {'answer': answer, 'hint': textarea.val()}
$.postWithPrefix "#{@url}/submit_hint",post_json, (response) =>
@render(response.contents)
diff --git a/common/templates/hinter_display.html b/common/templates/hinter_display.html
index d8b020c0f6..8fd219e847 100644
--- a/common/templates/hinter_display.html
+++ b/common/templates/hinter_display.html
@@ -52,39 +52,35 @@
% endfor
- Don't like any of the hints above? Please write your own, for one of your previous incorrect answers below:
-
+ Don't like any of the hints above?
+
+ Write your own!
+
+
+
% else:
- Optional. Help us write hints for this problem! Select one of your incorrect answers below:
+ Optional. Help us write hints for this problem! Think about how you would help
+ another student who made the same mistake that you did.
% endif
-
-
- % for answer in user_submissions:
- ${answer}
- % endfor
-
+
+ Choose the incorrect answer for which you want to write a hint:
+
+ % for answer in user_submissions:
+ ${answer}
+ % endfor
+
- % for answer in user_submissions:
-
-
-
- What hint would you give a student who also arrived at an answer of ${answer}? Please don't give away the correct answer.
-
-
-
-
-
- % endfor
-
+
+
+
-
Read about what makes a good hint .
-
+
Read about what makes a good hint .
+
What makes a good hint?
It depends on the type of problem you ran into. For stupid errors --
@@ -114,6 +110,12 @@ What would you say to help someone who got this wrong answer?
Learn even more
+ ## Close out the text-hiding div. The text-hiding div only exists if there
+ ## were hints for the student to vote on.
+ % if hints_exist:
+
+ % endif
+
%def>