Skip to content

Instantly share code, notes, and snippets.

@answerquest
Last active November 2, 2015 02:18
Show Gist options
  • Select an option

  • Save answerquest/d0b508ea7252b31251cf to your computer and use it in GitHub Desktop.

Select an option

Save answerquest/d0b508ea7252b31251cf to your computer and use it in GitHub Desktop.
crowdcrafting simple text template: see live project on http://crowdcrafting.org/project/template-simpleqa/
<div class="row">
<div class="col-md-12">
<h1>Simple Crowdcrafting Example</h1>
<p>Question : <span id="question_holder"></span></p>
<p>Answer : <input type="text" id="answerBox" placeholder="type your answer here"></p>
<p><button id="save" class="btn btn-primary">Save Answer</button> </p>
<p>Build a project of your own! <a href="https://gist.github.com/answerquest/d0b508ea7252b31251cf">See github gist</a> showing the task presenter code and the input tasks csv.</p>
</div>
</div>
<script type="text/javascript">
// Your JavaScript code
pybossa.taskLoaded(function(task, deferred){
// you don't need to do much here, as you don't want to load any assets, so just go on
deferred.resolve(task);
});
pybossa.presentTask(function(task, deferred){
// Present the current task to the user
// Load the task data into the HTML DOM
$("#answerBox").val("");
$("#question_holder").text(task.info['question']);
$("#save").off('click').on('click', function(evt) {
var answer = $("#answerBox").val();
pybossa.saveTask(task.id, answer).done(function() {
deferred.resolve(task);
});
});
});
pybossa.run('template-simpleqa');
// this should be your crowdcrafting project id. Make sure there's no plus (+) sign in it
</script>
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"question"
"What is 32 + 11 ?"
"What is 7 + 37 ?"
"What is 22 + 23 ?"
"What is 8 + 16 ?"
"What is 27 + 23 ?"
"What is 23 + 21 ?"
"What is 37 + 13 ?"
"What is 26 + 8 ?"
"What is 31 + 21 ?"
"What is 2 + 15 ?"
"What is 27 + 16 ?"
"What is 39 + 33 ?"
"What is 21 + 48 ?"
"What is 25 + 33 ?"
"What is 8 + 50 ?"
"What is 13 + 2 ?"
"What is 33 + 7 ?"
"What is 27 + 44 ?"
"What is 40 + 26 ?"
"What is 36 + 16 ?"
"What is 46 + 13 ?"
"What is 35 + 31 ?"
"What is 37 + 26 ?"
"What is 49 + 8 ?"
"What is 48 + 25 ?"
"What is 36 + 6 ?"
"What is 50 + 27 ?"
"What is 4 + 25 ?"
"What is 9 + 46 ?"
"What is 14 + 28 ?"
"What is 34 + 2 ?"
"What is 18 + 27 ?"
"What is 19 + 14 ?"
"What is 5 + 23 ?"
"What is 25 + 41 ?"
"What is 44 + 36 ?"
"What is 26 + 42 ?"
"What is 11 + 4 ?"
"What is 20 + 43 ?"
"What is 6 + 12 ?"
"What is 11 + 18 ?"
"What is 46 + 8 ?"
"What is 44 + 44 ?"
"What is 30 + 15 ?"
"What is 20 + 39 ?"
"What is 2 + 43 ?"
"What is 42 + 15 ?"
"What is 2 + 45 ?"
"What is 27 + 36 ?"
"What is 31 + 40 ?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment