Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crowdsourcehinter
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
crowdsourcehinter
Commits
38620f47
Commit
38620f47
authored
Oct 26, 2015
by
solashirai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed naming, added documentation
parent
f425d8b9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
crowdsourcehinter/static/html/crowdsourcehinter.html
+6
-6
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+12
-3
No files found.
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
38620f47
<script
type=
'x-tmpl/mustache'
id=
'show_hint_rating_ux'
>
<
div
class
=
'csh_hint_value'
value
=
"{{hint
Text
}}"
>
<
div
class
=
'csh_hint_value'
value
=
"{{hint
Identifier
}}"
>
<
div
class
=
'csh_hint_data'
>
<
div
class
=
"csh_hint"
>
You
received
the
following
hint
:
<
b
>
{{
visual_
hintText
}}
<
/b></
div
>
<
div
class
=
"csh_hint"
>
You
received
the
following
hint
:
<
b
>
{{
hintText
}}
<
/b></
div
>
<
/div
>
<
div
class
=
'csh_rating_data'
>
<
div
role
=
"button"
class
=
"csh_rate_hint"
data
-
rate
=
"upvote"
>
...
...
@@ -18,8 +18,8 @@
</script>
<script
type=
"x-tmpl/mustache"
id=
"show_reported_moderation"
>
<
div
class
=
"csh_hint_value"
value
=
"{{reportedHint
Text
}}"
>
<
div
class
=
"csh_hint"
>
{{
visual_
reportedHintText
}}
<
/div
>
<
div
class
=
"csh_hint_value"
value
=
"{{reportedHint
Identifier
}}"
>
<
div
class
=
"csh_hint"
>
{{
reportedHintText
}}
<
/div
>
<
div
role
=
"button"
class
=
"csh_staff_rate"
data
-
rate
=
"unreport"
aria
-
label
=
"unreport"
>
<
u
><
b
>
Return
hint
for
use
in
the
hinter
<
/b></
u
>
<
/div
>
...
...
@@ -46,11 +46,11 @@
<script
type=
"x-tmpl/mustache"
id=
"show_student_submission"
>
<
div
class
=
"csh_student_answer"
>
<
h
class
=
"csh_answer_text"
answer
=
{{
answer
}}
>
<
h
class
=
"csh_answer_text"
answer
=
{{
answer
Identifier
}}
>
<
div
role
=
"button"
class
=
"csh_reveal_info"
>
Help
us
improve
hints
for
this
problem
<
/div
>
<
div
class
=
"csh_user_info"
style
=
"display: none;"
>
<
br
>
Submitting
an
incorrect
answer
for
this
problem
provides
you
with
a
hint
specific
to
the
mistake
that
you
made
-
these
hints
are
made
by
other
students
who
made
the
same
mistake
as
you
did
.
Help
to
make
the
hints
for
this
problem
better
by
rating
the
hint
that
you
received
,
or
if
you
might
have
better
advice
to
give
other
students
,
submit
a
new
hint
!
<
br
>
If
you
choose
to
submit
a
new
hint
,
keep
in
mind
that
the
hints
are
specific
to
one
incorrect
answer
;
specific
advice
(
perhaps
on
some
aspect
of
the
problem
that
you
overlooked
)
is
more
helpful
than
generic
advice
.
<
/div
>
<
br
>
Your
original
answer
was
:
<
b
>
{{
visual_answer
}}
<
/b></
h
>
Your
original
answer
was
:
<
b
>
{{
answerText
}}
<
/b></
h
>
<
/div
>
</script>
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
38620f47
...
...
@@ -119,7 +119,7 @@ function CrowdsourceHinter(runtime, element, data){
* @param student_answer is the first incorrect answer submitted by the student
*/
function
showStudentHintRatingUX
(
hint
,
student_answer
){
var
hintRatingUXTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_hint_rating_ux'
).
html
(),
{
hint
Text
:
encodeURI
(
hint
),
visual_
hintText
:
hint
}));
var
hintRatingUXTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_hint_rating_ux'
).
html
(),
{
hint
Identifer
:
encodeURI
(
hint
),
hintText
:
hint
}));
$
(
'.csh_answer_text'
,
element
).
append
(
hintRatingUXTemplate
);
var
hintCreationTemplate
=
$
(
Mustache
.
render
(
$
(
'#add_hint_creation'
).
html
(),
{}));
$
(
'.csh_answer_text'
,
element
).
append
(
hintCreationTemplate
);
...
...
@@ -134,7 +134,7 @@ function CrowdsourceHinter(runtime, element, data){
* @param reportedHint is the reported hint text
*/
function
showReportedModeration
(
reportedHint
){
var
reportedModerationTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_reported_moderation'
).
html
(),
{
reportedHint
Text
:
encodeURI
(
reportedHint
),
visual_
reportedHintText
:
reportedHint
}));
var
reportedModerationTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_reported_moderation'
).
html
(),
{
reportedHint
Identifer
:
encodeURI
(
reportedHint
),
reportedHintText
:
reportedHint
}));
$
(
'.csh_reported_hints'
,
element
).
append
(
reportedModerationTemplate
);
}
...
...
@@ -145,7 +145,7 @@ function CrowdsourceHinter(runtime, element, data){
* @param student_answers is the text of the student's incorrect answer
*/
function
showStudentSubmissionHistory
(
student_answer
){
var
showStudentSubmissionTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_student_submission'
).
html
(),
{
answer
:
encodeURI
(
student_answer
),
visual_answer
:
student_answer
}));
var
showStudentSubmissionTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_student_submission'
).
html
(),
{
answer
Identifier
:
encodeURI
(
student_answer
),
answerText
:
student_answer
}));
$
(
'.csh_student_submission'
,
element
).
append
(
showStudentSubmissionTemplate
);
}
...
...
@@ -213,6 +213,9 @@ function CrowdsourceHinter(runtime, element, data){
function
submitNewHint
(){
return
function
(
submitHintButtonHTML
){
//add the newly created hint to the hinter's pool of hints
if
(
$
(
'.csh_student_text_input'
,
element
).
val
().
length
>
0
){
//encodeURI is used on the answer string when it is passed to mustache due to errors that
//arise in answers that contain spaces. Since the original answer is not in the encoded form,
//we must use the decoded form here.
var
studentAnswer
=
decodeURI
(
submitHintButtonHTML
.
currentTarget
.
attributes
[
'answer'
].
value
);
var
newHint
=
unescape
(
$
(
'.csh_student_text_input'
).
val
());
$
(
'.csh_submitbutton'
,
element
).
show
();
...
...
@@ -242,6 +245,9 @@ function CrowdsourceHinter(runtime, element, data){
$
(
'.csh_hint_text'
,
element
).
attr
(
'rating'
,
rating
);
$
(
'.csh_hint'
,
element
).
attr
(
'rating'
,
rating
);
hint
=
$
(
'.csh_hint_text'
,
element
).
attr
(
'hint_received'
);
//encodeURI is used on the answer string when it is passed to mustache due to errors that
//arise in answers that contain spaces. Since the original answer is not in the encoded form,
//we must use the decoded form here.
student_answer
=
decodeURI
(
$
(
'.csh_hint_text'
,
element
).
attr
(
'student_answer'
));
$
.
ajax
({
type
:
"POST"
,
...
...
@@ -257,6 +263,9 @@ function CrowdsourceHinter(runtime, element, data){
function
reportHint
(){
return
function
(
reportHintButtonHTML
){
hint
=
$
(
'.csh_hint_text'
,
element
).
attr
(
'hint_received'
);
//encodeURI is used on the answer string when it is passed to mustache due to errors that
//arise in answers that contain spaces. Since the original answer is not in the encoded form,
//we must use the decoded form here.
student_answer
=
decodeURI
(
$
(
'.csh_hint_text'
,
element
).
attr
(
'student_answer'
));
$
(
'.csh_hint_text'
,
element
).
text
(
'This hint has been reported for review.'
);
$
(
'.csh_hint'
,
element
).
text
(
'This hint has been reported for review.'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment