Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
template and tutorial with both Bootstrap 3 and 2
- Loading branch information
1 parent
3cb81be
commit 9268e79
Showing
4 changed files
with
222 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<div class="row"> | ||
<!-- Success and Error Messages for the user --> | ||
<div class="span6 offset2" style="height:50px"> | ||
<div id="success" class="alert alert-success" style="display:none;"> | ||
<a class="close">×</a> | ||
<strong>Well done!</strong> Your answer has been saved | ||
</div> | ||
<div id="loading" class="alert alert-info" style="display:none;"> | ||
<a class="close">×</a> | ||
Loading next task... | ||
</div> | ||
<div id="taskcompleted" class="alert alert-info" style="display:none;"> | ||
<strong>The task has been completed!</strong> Thanks a lot! | ||
</div> | ||
<div id="finish" class="alert alert-success" style="display:none;"> | ||
<strong>Congratulations!</strong> You have participated in all available tasks! | ||
<br/> | ||
<div class="alert-actions"> | ||
<a class="btn small" href="/">Go back</a> | ||
<a class="btn small" href="/app">or, Check other applications</a> | ||
</div> | ||
</div> | ||
<div id="error" class="alert alert-error" style="display:none;"> | ||
<a class="close">×</a> | ||
<strong>Error!</strong> Something went wrong, please contact the site administrators | ||
</div> | ||
</div> <!-- End Success and Error Messages for the user --> | ||
</div> <!-- End of Row --> | ||
|
||
<!-- | ||
Task DOM for loading the Flickr Images | ||
It uses the class="skeleton" to identify the elements that belong to the | ||
task. | ||
--> | ||
<div class="row skeleton"> <!-- Start Skeleton Row--> | ||
<div class="span6 "><!-- Start of Question and Submission DIV (column) --> | ||
<h1 id="question">Question</h1> <!-- The question will be loaded here --> | ||
<div id="answer"> <!-- Start DIV for the submission buttons --> | ||
<!-- If the user clicks this button, the saved answer will be value="yes"--> | ||
<button class="btn btn-success btn-answer" value='Yes'><i class="icon icon-white icon-thumbs-up"></i> Yes</button> | ||
<!-- If the user clicks this button, the saved answer will be value="no"--> | ||
<button class="btn btn-danger btn-answer" value='No'><i class="icon icon-white icon-thumbs-down"></i> No</button> | ||
<!-- If the user clicks this button, the saved answer will be value="NoPhoto"--> | ||
<button class="btn btn-answer" value='NoPhoto'><i class="icon icon-white icon-exclamation"></i> No photo</button> | ||
<!-- If the user clicks this button, the saved answer will be value="NotKnown"--> | ||
<button class="btn btn-answer" value='NotKnown'><i class="icon icon-white icon-question-sign"></i> I don't know</button> | ||
</div><!-- End of DIV for the submission buttons --> | ||
<!-- Feedback items for the user --> | ||
<p>You are working now on task: <span id="task-id" class="label label-warning">#</span></p> | ||
<p>You have completed: <span id="done" class="label label-info"></span> tasks from | ||
<!-- Progress bar for the user --> | ||
<span id="total" class="label label-inverse"></span></p> | ||
<div class="progress progress-striped"> | ||
<div id="progress" rel="tooltip" title="#" class="bar" style="width: 0%;"></div> | ||
</div> | ||
<!-- | ||
This application uses Disqus to allow users to provide some feedback. | ||
The next section includes a button that when a user clicks on it will | ||
load the comments, if any, for the given task | ||
--> | ||
<div id="disqus_show_btn" style="margin-top:5px;"> | ||
<button class="btn btn-primary btn-large btn-disqus" onclick="loadDisqus()"><i class="icon-comments"></i> Show comments</button> | ||
<button class="btn btn-large btn-disqus" onclick="loadDisqus()" style="display:none"><i class="icon-comments"></i> Hide comments</button> | ||
</div><!-- End of Disqus Button section --> | ||
<!-- Disqus thread for the given task --> | ||
<div id="disqus_thread" style="margin-top:5px;display:none"></div> | ||
</div><!-- End of Question and Submission DIV (column) --> | ||
<div class="span6"><!-- Start of Photo DIV (column) --> | ||
<a id="photo-link" href="#"> | ||
<img id="photo" src="http://i.imgur.com/GeHxzb7.png" style="max-width=100%"> | ||
</a> | ||
</div><!-- End of Photo DIV (columnt) --> | ||
</div><!-- End of Skeleton Row --> | ||
|
||
<script type="text/javascript"> | ||
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ | ||
|
||
/* * * DON'T EDIT BELOW THIS LINE * * */ | ||
function loadDisqus() { | ||
$("#disqus_thread").toggle(); | ||
$(".btn-disqus").toggle(); | ||
var disqus_shortname = 'pybossa'; // required: replace example with your forum shortname | ||
//var disqus_identifier = taskId; | ||
var disqus_developer = 1; | ||
|
||
(function() { | ||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | ||
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | ||
})(); | ||
} | ||
|
||
</script> | ||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | ||
|
||
<script> | ||
function loadUserProgress() { | ||
pybossa.userProgress('flickrperson').done(function(data){ | ||
var pct = Math.round((data.done*100)/data.total); | ||
$("#progress").css("width", pct.toString() +"%"); | ||
$("#progress").attr("title", pct.toString() + "% completed!"); | ||
$("#progress").tooltip({'placement': 'left'}); | ||
$("#total").text(data.total); | ||
$("#done").text(data.done); | ||
}); | ||
} | ||
|
||
pybossa.taskLoaded(function(task, deferred) { | ||
if ( !$.isEmptyObject(task) ) { | ||
// load image from flickr | ||
var img = $('<img />'); | ||
img.load(function() { | ||
// continue as soon as the image is loaded | ||
deferred.resolve(task); | ||
}); | ||
img.attr('src', task.info.url_b).css('height', 460); | ||
img.addClass('img-polaroid'); | ||
task.info.image = img; | ||
} | ||
else { | ||
deferred.resolve(task); | ||
} | ||
}); | ||
|
||
pybossa.presentTask(function(task, deferred) { | ||
if ( !$.isEmptyObject(task) ) { | ||
loadUserProgress(); | ||
$('#photo-link').html('').append(task.info.image); | ||
$("#photo-link").attr("href", task.info.link); | ||
$("#question").html(task.info.question); | ||
$('#task-id').html(task.id); | ||
$('.btn-answer').off('click').on('click', function(evt) { | ||
var answer = $(evt.target).attr("value"); | ||
if (typeof answer != 'undefined') { | ||
//console.log(answer); | ||
pybossa.saveTask(task.id, answer).done(function() { | ||
deferred.resolve(); | ||
}); | ||
$("#loading").fadeIn(500); | ||
if ($("#disqus_thread").is(":visible")) { | ||
$('#disqus_thread').toggle(); | ||
$('.btn-disqus').toggle(); | ||
} | ||
} | ||
else { | ||
$("#error").show(); | ||
} | ||
}); | ||
$("#loading").hide(); | ||
} | ||
else { | ||
$(".skeleton").hide(); | ||
$("#loading").hide(); | ||
$("#finish").fadeIn(500); | ||
} | ||
}); | ||
|
||
pybossa.run('flickrperson'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<div class="row"> | ||
<div class="span12"> | ||
<div id="modal" class="modal hide fade"> | ||
<div class="modal-header"> | ||
<h3>Flickr Person Finder tutorial</h3> | ||
</div> | ||
<div id="0" class="modal-body" style="display:none"> | ||
<p><strong>Hi!</strong> This is a <strong>demo application</strong> that shows how you can do pattern recognition on pictures or images using the PyBossa framework in Crowdcrafting.org. | ||
</p> | ||
</div> | ||
<div id="1" class="modal-body" style="display:none"> | ||
<p>The application is really simple. It loads a photo from <a href="http://flickr.com">Flickr</a> and asks you this question: <strong>Do you see a human in this photo?</strong></p> | ||
<img src="http://farm7.staticflickr.com/6109/6286728068_2f3c6912b8_q.jpg" class="img-polaroid"/> | ||
<p>You will have 3 possible answers: | ||
<ul> | ||
<li>Yes,</li> | ||
<li>No, and</li> | ||
<li>I don't know</li> | ||
</ul> | ||
</p> | ||
<p> | ||
</p> | ||
<p>All you have to do is to click in one of the three possible answers and you will be done. This demo application could be adapted for more complex pattern recognition problems.</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<a id="prevBtn" href="#" onclick="showStep('prev')" class="btn">Previous</a> | ||
<a id="nextBtn" href="#" onclick="showStep('next')" class="btn btn-success">Next</a> | ||
<a id="startContrib" href="../flickrperson/newtask" class="btn btn-primary" style="display:none"><i class="icon-thumbs-up"></i> Try the demo!</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<script> | ||
var step = -1; | ||
function showStep(action) { | ||
$("#" + step).hide(); | ||
if (action == 'next') { | ||
step = step + 1; | ||
} | ||
if (action == 'prev') { | ||
step = step - 1; | ||
} | ||
if (step == 0) { | ||
$("#prevBtn").hide(); | ||
} | ||
else { | ||
$("#prevBtn").show(); | ||
} | ||
|
||
if (step == 1 ) { | ||
$("#nextBtn").hide(); | ||
$("#startContrib").show(); | ||
} | ||
$("#" + step).show(); | ||
} | ||
|
||
showStep('next'); | ||
$("#modal").modal('show'); | ||
</script> |