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
f6c8f243
Commit
f6c8f243
authored
Oct 20, 2014
by
Sola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed variables, working on css
parent
c2bada91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
51 deletions
+51
-51
crowdxblock/static/css/crowdxblock.css
+33
-26
crowdxblock/static/js/src/crowdxblock.js
+18
-25
No files found.
crowdxblock/static/css/crowdxblock.css
View file @
f6c8f243
...
...
@@ -4,28 +4,7 @@
font-weight
:
bold
;
}
/*.crowdxblock_block {
cursor: pointer;
background: rgb(0,0,200);
}*/
.crowdxblock_block
.crowdsource-wrapper
{
box-shadow
:
inset
0
1px
2px
1px
rgba
(
0
,
0
,
0
,
0.1
);
border-radius
:
2px
;
display
:
none
;
margin-top
:
20px
;
padding
:
(
15px
);
background
:
rgb
(
50
,
50
,
235
);
}
.crowdxblock_block
.hint-inner-container
{
padding-left
:
15px
;
padding-right
:
15px
;
font-size
:
16px
;
}
.crowdxblock_block
.hintsarea
{
.crowdxblock_block
.feedback
{
border-style
:
solid
;
border-width
:
thin
;
border-color
:
rgb
(
200
,
200
,
200
);
...
...
@@ -36,19 +15,47 @@
padding-bottom
:
0px
!important
;
}
.hint_value
{
display
:
flex
;
margin-left
:
10px
;
flex-flow
:
column
;
}
.hint_used
{
flex-direction
:
row
;
}
.crowdxblock_block
.HintsToUse
{
background-color
:
#FF8
;
}
.
downvote_hint
,
.flag_hint
,
.upvo
te_hint
{
.
ra
te_hint
{
width
:
100%
;
margin-left
:
auto
;
margin-right
:
auto
;
text-align
:
left
;
}
.upvote_hint
,
.downvote_hint
,
.flag_hint
{
cursor
:
pointer
}
.upvote_hint
,
.downvote_hint
,
.flag_hint
{
color
:
#948f8f
;
}
d2
[
data-rate
=
"flag"
]
{
align-self
:
flex-end
;
}
d1
[
data-rate
=
"upvote"
]
{
color
:
green
;
font-weight
:
bold
;
margin-right
:
15px
;
}
d5
[
data-rate
=
"downvote"
]
{
color
:
red
;
font-weight
:
bold
;
}
.rating
{
margin-right
:
10px
;
}
.rate_hint
{
cursor
:
pointer
}
.rate_hint
{
color
:
#948f8f
;
}
.hintsarea
{
display
:
flex
;
...
...
crowdxblock/static/js/src/crowdxblock.js
View file @
f6c8f243
function
CrowdXBlock
(
runtime
,
element
){
//use executionFunctions to prevent old initializations of hinter from working after switching units
var
executionFunctions
=
true
;
var
executeFunctions
=
true
;
if
(
executeFunctions
){
var
isStaff
=
false
;
$
(
".HintsToUse"
,
element
).
text
(
""
);
...
...
@@ -22,14 +24,11 @@ function CrowdXBlock(runtime, element){
//read the data from the problem_graded event here
function
get_event_data
(
event_type
,
data
,
element
){
if
(
executionFunctions
){
check_correct
(
event_type
,
data
,
element
);
}
check_correct
(
event_type
,
data
,
element
);
}
Logger
.
listen
(
'problem_graded'
,
null
,
get_event_data
);
function
check_correct
(
var_event_type
,
var_data
,
var_element
){
if
(
executionFunctions
){
//check that problem wasn't correctly answered
if
(
var_data
[
1
].
search
(
/class="correct/
)
===
-
1
){
$
.
ajax
({
...
...
@@ -67,23 +66,22 @@ function CrowdXBlock(runtime, element){
}
});
}
}
}
}
function
seehint
(
result
){
if
(
executionFunctions
){
//show hint to student
$
(
'.HintsToUse'
,
element
).
text
(
result
.
HintsToUse
);
}
}
}
function
appendHint
(
result
){
$
(
".student_answer"
,
element
).
each
(
function
(){
if
(
$
(
this
).
find
(
"span"
).
text
()
==
result
.
student_answer
){
$
(
this
).
append
(
unescape
(
"<div class=
\"
hint_value
\"
value =
\"
"
+
result
.
hint_used
+
"
\"
>"
+
"<div
role=
\"
button
\"
class=
\"
rate_hint
\"
data-rate=
\"
upvote
\"
data-icon=
\"
arrow-u
\"
aria-label=
\"
upvote
\"
><b>↑</b></div
>"
+
"<d
iv role=
\"
button
\"
class=
\"
rate_hint
\"
data-rate=
\"
flag
\"
data-icon=
\"
flag
\"
aria-label=
\"
flag
\"
><b>!</b
></div>"
+
"<div
class =
\"
rating
\"
>"
+
result
.
rating
+
"</div
>"
+
"<d
iv class=
\"
hint_used
\"
>"
+
""
+
result
.
hint_used
+
"
</div>"
+
"<div
role=
\"
button
\"
class=
\"
rate_hint
\"
data-rate=
\"
downvote
\"
aria-label=
\"
downvote
\"
><b>↓</b></div>
</div>"
));
"<div
> <d1 role=
\"
button
\"
class=
\"
rate_hint
\"
data-rate=
\"
upvote
\"
data-icon=
\"
arrow-u
\"
aria-label=
\"
upvote
\"
><b>↑</b></d1
>"
+
"<d
2 role=
\"
button
\"
class=
\"
rate_hint
\"
data-rate=
\"
flag
\"
data-icon=
\"
flag
\"
aria-label=
\"
flag
\"
><b>!</b></d2
></div>"
+
"<div
><d3 class =
\"
rating
\"
>"
+
result
.
rating
+
"</d3
>"
+
"<d
4 class=
\"
hint_used
\"
>"
+
""
+
result
.
hint_used
+
"</d4>
</div>"
+
"<div
> <d5 role=
\"
button
\"
class=
\"
rate_hint
\"
data-rate=
\"
downvote
\"
aria-label=
\"
downvote
\"
><b>↓</b></div> </d5>
</div>"
));
}
});
}
...
...
@@ -97,7 +95,6 @@ function CrowdXBlock(runtime, element){
}
function
getFeedback
(
result
){
if
(
executionFunctions
){
if
(
isStaff
){
$
(
'.feedback'
,
element
).
append
(
"<div class=
\"
flagged_hints
\"
><span>Flagged</span></div>"
);
}
...
...
@@ -153,23 +150,21 @@ function CrowdXBlock(runtime, element){
});
}
});
}
}
}
$
(
document
).
on
(
'click'
,
'.student_hint_creation'
,
function
(){
if
(
executionFunctions
){
//remove all other hint inputs and replace
$
(
'.math'
).
remove
();
$
(
'.submit_new'
).
remove
();
student_answer
=
$
(
this
).
parent
().
parent
().
find
(
"span"
).
text
();
$
(
".student_answer"
,
element
).
each
(
function
(){
if
(
$
(
this
).
find
(
"span"
).
text
()
==
student_answer
){
$
(
this
).
pre
pend
(
"<p><input type=
\"
text
\"
name=
\"
studentinput
\"
class=
\"
math
\"
size=
\"
40
\"
><input id=
\"
"
+
student_answer
+
"
\"
type=
\"
button
\"
class=
\"
submit_new
\"
value=
\"
Submit Hint
\"
> </p>"
);
$
(
this
).
ap
pend
(
"<p><input type=
\"
text
\"
name=
\"
studentinput
\"
class=
\"
math
\"
size=
\"
40
\"
><input id=
\"
"
+
student_answer
+
"
\"
type=
\"
button
\"
class=
\"
submit_new
\"
value=
\"
Submit Hint
\"
> </p>"
);
}
});
}
}
)
})
$
(
document
).
on
(
'click'
,
'.submit_new'
,
function
(){
if
(
executionFunctions
){
if
(
$
(
this
).
parent
().
find
(
'.math'
).
val
()
!=
null
){
var
answerdata
=
unescape
(
$
(
this
).
attr
(
'id'
));
var
newhint
=
unescape
(
$
(
'.math'
).
val
());
...
...
@@ -181,10 +176,9 @@ function CrowdXBlock(runtime, element){
});
$
(
this
).
parent
(
'p'
).
remove
();
}
}
}
)
})
$
(
document
).
on
(
'click'
,
'.rate_hint'
,
function
(){
if
(
executionFunctions
){
used_hint
=
$
(
this
).
parent
().
find
(
".hint_used"
).
text
();
student_answer
=
$
(
this
).
parent
().
parent
().
find
(
"span"
).
text
();
Logger
.
log
(
'rate_hint.click.event'
,
{
"used_hint"
:
used_hint
,
"student_answer"
:
student_answer
,
"rating"
:
$
(
this
).
attr
(
'data-rate'
)});
...
...
@@ -207,11 +201,10 @@ function CrowdXBlock(runtime, element){
}
}
});
}
}
)
})
//staff ratings are the removal or unflagging of flagged hints from the database
$
(
document
).
on
(
'click'
,
'.staff_rate'
,
function
(){
if
(
executionFunctions
){
used_hint
=
$
(
this
).
parent
().
find
(
".hint_used"
).
text
();
student_answer
=
$
(
this
).
parent
().
parent
().
find
(
"span"
).
text
();
$
.
ajax
({
...
...
@@ -226,5 +219,5 @@ function CrowdXBlock(runtime, element){
});
}
});
}
}
)
}
})
}
}
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