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
d93375bc
Commit
d93375bc
authored
Nov 17, 2014
by
solashirai
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempt at mustache minimal example
parent
abae7d6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
crowdsourcehinter/static/html/crowdsourcehinter.html
+2
-2
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+11
-9
No files found.
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
d93375bc
...
...
@@ -26,9 +26,9 @@
<
/div
>
</script>
<script
id=
"
personTpl"
type=
"text/templat
e"
>
<script
id=
"
testingID"
type=
"x-tmpl-mustach
e"
>
<
h1
>
{{
firstName
}}
{{
lastName
}}
<
/h1
>
<
p
>
Blog
URL
:
<
a
href
=
"{{blogURL}}"
>
{{
blogURL
}}
<
/a></
p
>
<
p
>
Test
<
a
href
=
"{{testvar}}"
>
{{
testvar
}}
<
/a></
p
>
</script>
<script
type=
"x-tmpl-mustache"
id=
"show_answer_feedback"
>
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
d93375bc
...
...
@@ -18,16 +18,18 @@ function CrowdsourceHinter(runtime, element){
Logger
.
listen
(
'seq_prev'
,
null
,
stopScript
);
Logger
.
listen
(
'seq_goto'
,
null
,
stopScript
);
//read the data from the problem_graded event here
//data about the problem obtained from Logger.listen('problem_graded') is passed on to the onStudentSubmission.
//directly passing data to onStudentSubmission does not work for unknown reasons (to be fixed?)
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);
});
*/
//below is minimal mustache template usage attempt
var
data
=
{
firstName
:
"Sola"
,
lastName
:
"Shirai"
,
testvar
:
"Hello"
};
var
template
=
$
(
Mustache
.
render
(
$
(
"#testingID"
).
html
(),
data
));
$
(
'#sampleArea'
).
html
(
template
);
onStudentSubmission
(
data
);
}
Logger
.
listen
(
'problem_graded'
,
null
,
get_event_data
);
...
...
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