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
4a2ace3a
Commit
4a2ace3a
authored
Nov 10, 2014
by
Sola
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implementing mustache templates
parent
4d6cf7a8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
18 deletions
+37
-18
crowdsourcehinter/crowdsourcehinter.py
+1
-0
crowdsourcehinter/public/3rdParty/mustache.js
+0
-0
crowdsourcehinter/static/html/crowdsourcehinter.html
+23
-2
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+11
-4
crowdsourcehinter_xblock.egg-info/SOURCES.txt
+2
-12
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
4a2ace3a
...
...
@@ -55,6 +55,7 @@ class CrowdsourceHinter(XBlock):
"""
html
=
self
.
resource_string
(
"static/html/crowdsourcehinter.html"
)
frag
=
Fragment
(
html
.
format
(
self
=
self
))
frag
.
add_javascript_url
(
'//cdnjs.cloudflare.com/ajax/libs/mustache.js/0.8.1/mustache.min.js'
)
frag
.
add_css
(
self
.
resource_string
(
"static/css/crowdsourcehinter.css"
))
frag
.
add_javascript
(
self
.
resource_string
(
"static/js/src/crowdsourcehinter.js"
))
frag
.
initialize_js
(
'CrowdsourceHinter'
)
...
...
crowdsourcehinter/public/3rdParty/mustache.js
0 → 100644
View file @
4a2ace3a
This diff is collapsed.
Click to expand it.
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
4a2ace3a
<script
type=
"x-tmpl-mustache"
id=
"show_hint_feedback"
>
<
div
class
=
"hint_value"
value
=
{{
hint
}}
>
<
div
class
=
"hint_value"
value
=
{{
hint
value
}}
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"upvote"
data
-
icon
=
"arrow-u"
aria
-
label
=
"upvote"
>
<
b
>
↑
<
/b
>
<
/div
>
...
...
@@ -13,6 +13,13 @@
<
/div
>
<
/div
>
</script>
<script
type=
"text/template"
id=
"testing"
>
<
div
>
{{
testone
}}
{{
testtwo
}}
<
/div
>
</script>
<div
class=
"crowdsourcehinter_block"
>
<!--most stuff just for testing purposes-->
<p>
<span
class=
'HintsToUse'
></span>
...
...
@@ -28,7 +35,21 @@
<div
class=
"feedback"
>
<script
type=
"x-tmpl-mustache"
id=
"show_hint_feedback"
>
<
div
class
=
"hint_value"
value
=
{{
hintvalue
}}
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"upvote"
data
-
icon
=
"arrow-u"
aria
-
label
=
"upvote"
>
<
b
>
↑
<
/b
>
<
/div
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"flag"
data
-
icon
=
"flag"
aria
-
label
=
"flag"
>
<
b
>!<
/b
>
<
/div
>
<
div
class
=
"rating"
>
{{
rating
}}
<
/div
>
<
div
class
=
"hint"
>
{{
hint
}}
<
/div
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"downvote"
aria
-
label
=
"downvote"
>
<
b
>
↓
<
/b
>
<
/div
>
<
/div
>
</script>
</div>
<p>
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
4a2ace3a
...
...
@@ -17,6 +17,7 @@ function CrowdsourceHinter(runtime, element){
//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
);
...
...
@@ -72,12 +73,18 @@ function CrowdsourceHinter(runtime, element){
//This appended div includes upvote/downvote/flagging buttons, the hint, and the hint's rating
$
(
".student_answer"
,
element
).
each
(
function
(){
if
(
$
(
this
).
find
(
"span"
).
text
()
==
result
.
student_answer
){
var
template
=
$
(
'#show_hint_feedback'
).
html
();
/*var template = $('#show_hint_feedback').html();
Mustache.parse(template);
var data = {
"hint"
:
result
.
hint
,
"rating"
:
result
.
rating
hintvalue: "result.hint",
hint: "result.hint",
rating: "result.rating"
};
$
(
this
).
append
(
Mustache
.
to_html
(
template
,
data
));
$(this).append(Mustache.render(template, data)); */
var
template
=
$
(
'#testing'
).
html
();
var
data
=
{
testone
:
"testing"
,
testtwo
:
"TESTING"
};
var
html
=
Mustache
.
to_html
(
template
,
data
);
$
(
this
).
html
(
html
);
/**$(this).append(unescape("<div class=\"hint_value\" value = \"" + result.hint + "\">" +
"<div role=\"button\"class=\"rate_hint\"data-rate=\"upvote\" data-icon=\"arrow-u\" aria-label=\"upvote\"><b>↑</b></div>" +
"<div role=\"button\" class=\"rate_hint\" data-rate=\"flag\" data-icon=\"flag\" aria-label=\"flag\"><b>!</b></div>"+
...
...
crowdsourcehinter_xblock.egg-info/SOURCES.txt
View file @
4a2ace3a
...
...
@@ -3,23 +3,13 @@ crowdsourcehinter/__init__.py
crowdsourcehinter/crowdsourcehinter.py
crowdsourcehinter/static/README.txt
crowdsourcehinter/static/css/crowdsourcehinter.css
crowdsourcehinter/static/css/crowdsourcehinter.css~
crowdsourcehinter/static/css/crowdxblock.css~
crowdsourcehinter/static/html/crowdsourcehinter.html
crowdsourcehinter/static/html/crowdsourcehinter.html~
crowdsourcehinter/static/html/crowdsourcehinterstudio.html
crowdsourcehinter/static/html/crowdsourcehinterstudio.html~
crowdsourcehinter/static/html/crowdxblock.html~
crowdsourcehinter/static/js/src/crowdsourcehinter.js
crowdsourcehinter/static/js/src/crowdsourcehinter.js~
crowdsourcehinter/static/js/src/crowdxblock.js~
crowdsourcehinter_xblock.egg-info/PKG-INFO
crowdsourcehinter_xblock.egg-info/PKG-INFO~
crowdsourcehinter_xblock.egg-info/SOURCES.txt
crowdsourcehinter_xblock.egg-info/SOURCES.txt~
crowdsourcehinter_xblock.egg-info/dependency_links.txt
crowdsourcehinter_xblock.egg-info/entry_points.txt
crowdsourcehinter_xblock.egg-info/entry_points.txt~
crowdsourcehinter_xblock.egg-info/requires.txt
crowdsourcehinter_xblock.egg-info/top_level.txt
crowdsourcehinter_xblock.egg-info/top_level.txt~
\ No newline at end of file
crowdsourcehinter_xblock.egg-info/top_level.txt
\ No newline at end of file
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