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
abae7d6c
Commit
abae7d6c
authored
Nov 17, 2014
by
solashirai
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variable fixes and beginnings of Mustache templating
parent
a8e14d11
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
31 deletions
+47
-31
crowdsourcehinter/crowdsourcehinter.py
+1
-1
crowdsourcehinter/static/css/crowdsourcehinter.css
+12
-16
crowdsourcehinter/static/html/crowdsourcehinter.html
+7
-1
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+24
-13
crowdsourcehinter_xblock.egg-info/SOURCES.txt
+3
-0
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
abae7d6c
...
...
@@ -327,7 +327,7 @@ class CrowdsourceHinter(XBlock):
del
self
.
Flagged
[
flagged_answer
]
return
{
'rating'
:
'removed'
}
if
data
[
'student_rating'
]
==
'flag'
:
# add hint to
# add hint to
Flagged dictionary
self
.
Flagged
[
str
(
answer_data
)]
=
data_hint
return
{
"rating"
:
'flagged'
,
'hint'
:
data_hint
}
if
str
(
data_hint
)
not
in
self
.
Voted
:
...
...
crowdsourcehinter/static/css/crowdsourcehinter.css
View file @
abae7d6c
/* CSS for CrowdsourceHinter */
.crowdsourcehinter_block
.count
{
font-weight
:
bold
;
}
.crowdsourcehinter_block
.feedback
{
.crowdsourcehinter_block
.csh_feedback
{
border-style
:
solid
;
border-width
:
thin
;
border-color
:
rgb
(
200
,
200
,
200
);
}
.crowdsourcehinter_block
.vote
{
.crowdsourcehinter_block
.
csh_
vote
{
padding-top
:
0px
!important
;
padding-bottom
:
0px
!important
;
}
.hint_value
{
.
csh_
hint_value
{
display
:
flex
;
margin-left
:
10px
;
flex-flow
:
column
;
}
.hint_used
{
.
csh_
hint_used
{
flex-direction
:
row
;
}
.crowdsourcehinter_block
.HintsToUse
{
.crowdsourcehinter_block
.
csh_
HintsToUse
{
background-color
:
#FF8
;
}
.rate_hint
{
.
csh_
rate_hint
{
width
:
100%
;
margin-left
:
auto
;
margin-right
:
auto
;
...
...
@@ -50,23 +46,23 @@ div[data-rate="downvote"] {
font-weight
:
bold
;
}
[
csh_isStaff
=
"false"
]
.csh_flagged_hints
{
.crowdsourcehinter_block
.csh_flagged_hints
{
visibility
:
hidden
;
display
:
none
;
}
[
csh_isStaff
=
"true"
]
.csh_flagged_hints
{
.crowdsourcehinter_block_is_staff
.csh_flagged_hints
{
visibility
:
visible
;
}
.rating
{
.
csh_
rating
{
margin-right
:
10px
;
}
.rate_hint
{
cursor
:
pointer
}
.rate_hint
{
color
:
#948f8f
;
}
.
csh_
rate_hint
{
cursor
:
pointer
}
.
csh_
rate_hint
{
color
:
#948f8f
;
}
.hintsarea
{
.
csh_
hintsarea
{
display
:
flex
;
flex-direction
:
colomn
;
}
...
...
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
abae7d6c
...
...
@@ -26,6 +26,11 @@
<
/div
>
</script>
<script
id=
"personTpl"
type=
"text/template"
>
<
h1
>
{{
firstName
}}
{{
lastName
}}
<
/h1
>
<
p
>
Blog
URL
:
<
a
href
=
"{{blogURL}}"
>
{{
blogURL
}}
<
/a></
p
>
</script>
<script
type=
"x-tmpl-mustache"
id=
"show_answer_feedback"
>
<
div
class
=
"csh_student_answer"
>
<
span
><
b
>
{{
answer
}}
<
/b></
span
>
...
...
@@ -36,10 +41,11 @@
<
/div
>
</script>
<div
class=
"crowdsourcehinter_block"
csh_isStaff=
false
>
<div
class=
"crowdsourcehinter_block"
>
<p>
<span
class=
'csh_HintsToUse'
></span>
</p>
<div
id=
"sampleArea"
></div>
<div
class=
"crowdsourcehinter_block"
>
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
abae7d6c
function
CrowdsourceHinter
(
runtime
,
element
){
//use executionFunctions to prevent old initializations of hinter from working after switching units
var
executeFunctions
=
true
;
if
(
executeFunctions
){
//executeHinter is used to disable the hinter after switching units in an edX course
//If the code is not made to stop running, the hinter will act up after switching from and back to
//a certain unit.
var
executeHinter
=
true
;
if
(
executeHinter
){
var
isShowingHintFeedback
=
false
;
var
isStaff
=
false
;
$
(
".HintsToUse"
,
element
).
text
(
""
);
$
(
".
csh_
HintsToUse"
,
element
).
text
(
""
);
function
stopScript
(){
//This function is used to prevent a particular instance of the hinter from acting after
//switching between edX course's units.
execut
ionFunctions
=
false
;
execut
eHinter
=
false
;
}
Logger
.
listen
(
'seq_next'
,
null
,
stopScript
);
Logger
.
listen
(
'seq_prev'
,
null
,
stopScript
);
Logger
.
listen
(
'seq_goto'
,
null
,
stopScript
);
//read the data from the problem_graded event here
//function get_event_data(event_type, data, element){
// console.log("is this still changing");
// onStudentSubmission(data);
//}
//Logger.listen('problem_graded', null, get_event_data);
function
get_event_data
(
event_type
,
data
,
element
){
console
.
log
(
"is this changing"
);
/*below is minimal mustache template usage attempt
$.get('crowdsourcehinter.html', function(data) {
var template = $('#personTpl').html();
var html = Mustache.to_html(template, data);
$('#sampleArea').html(html);
});
*/
onStudentSubmission
(
data
);
}
Logger
.
listen
(
'problem_graded'
,
null
,
get_event_data
);
function
onStudentSubmission
(
event_type
,
problem_graded_event_data
,
element
){
function
onStudentSubmission
(
problem_graded_event_data
){
//This function will determine whether or not the student correctly answered the question.
//If it was correctly answered it will begin the process for giving feedback on hints.
if
(
problem_graded_event_data
[
1
].
search
(
/class="correct/
)
===
-
1
){
...
...
@@ -44,7 +54,6 @@ function CrowdsourceHinter(runtime, element){
success
:
function
(
result
)
{
if
(
result
[
'is_user_staff'
])
{
isStaff
=
true
;
$
(
'.crowdsourcehinter_block'
).
attr
(
'csh_isStaff'
,
true
);
$
.
ajax
({
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'get_feedback'
),
...
...
@@ -63,7 +72,6 @@ function CrowdsourceHinter(runtime, element){
});
}
}
Logger
.
listen
(
'problem_graded'
,
null
,
onStudentSubmission
);
function
seehint
(
result
){
//Show a hint to the student after an incorrect answer is submitted.
...
...
@@ -124,6 +132,9 @@ function CrowdsourceHinter(runtime, element){
function
getFeedback
(
result
){
//Set up the student feedback stage. Each student answer and all answer-specific hints for that answer are shown
//to the student, as well as an option to create a new hint for an answer.
if
(
isStaff
){
$
(
'.crowdsourcehinter_block'
).
attr
(
'class'
,
'crowdsourcehinter_block_is_staff'
);
}
if
(
!
isShowingHintFeedback
){
var
student_answers
=
[];
$
.
each
(
result
,
function
(
index
,
value
)
{
...
...
crowdsourcehinter_xblock.egg-info/SOURCES.txt
View file @
abae7d6c
setup.py
crowdsourcehinter/__init__.py
crowdsourcehinter/crowdsourcehinter.py
crowdsourcehinter/public/3rdParty/mustache.js
crowdsourcehinter/static/README.txt
crowdsourcehinter/static/css/crowdsourcehinter.css
crowdsourcehinter/static/css/crowdsourcehinter.css~
crowdsourcehinter/static/html/crowdsourcehinter.html
crowdsourcehinter/static/html/crowdsourcehinter.html~
crowdsourcehinter/static/html/crowdsourcehinterstudio.html
crowdsourcehinter/static/js/src/crowdsourcehinter.js
crowdsourcehinter/static/js/src/crowdsourcehinter.js~
...
...
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