Implemented tree view for selection of samples
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
<ul>
|
||||
{% for child in children %}
|
||||
<li> <a href="{{ child.get_absolute_url }}">{{ child }}</a></li>
|
||||
{% child.children.count > 0 %}
|
||||
{% children_list child %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
@@ -1 +0,0 @@
|
||||
{% children_tag parent %}
|
||||
@@ -366,8 +366,7 @@ function my_callback(data){
|
||||
}
|
||||
alert(message);
|
||||
}
|
||||
</script>
|
||||
|
||||
</script
|
||||
|
||||
</head>
|
||||
|
||||
@@ -380,16 +379,23 @@ function my_callback(data){
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{% if sample.questions %}
|
||||
{{ sample.questions.all.0 }}<br>
|
||||
{% for answer in sample.questions.all.0.answers.all %}
|
||||
<input type="radio" name="answer" value={{answer.id}}>{{ answer}}</input><br>
|
||||
{% endfor %}
|
||||
<input type="button" onclick="Dajaxice.three_d_viewer.check_answer(my_callback, {'answerid':$('input:radio[name=answer]:checked').val(), 'questionid':{{ sample.questions.all.0.id }}})" value="Get message from server!" />
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
{% include "three_d_viewer/sampletree.html" %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="well">
|
||||
{% if sample.questions %}
|
||||
{{ sample.questions.all.0 }}<br>
|
||||
{% for answer in sample.questions.all.0.answers.all %}
|
||||
<input type="radio" name="answer" value={{answer.id}}>{{ answer}}</input><br>
|
||||
{% endfor %}
|
||||
<input type="button" onclick="Dajaxice.three_d_viewer.check_answer(my_callback, {'answerid':$('input:radio[name=answer]:checked').val(), 'questionid':{{ sample.questions.all.0.id }}})" value="Get message from server!" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<canvas id="canvas" <!--style="border: 1px dotted #bfbfbf;" width=933 height="700"--></canvas>
|
||||
<canvas id="canvas"></canvas>
|
||||
<div><br><span id="progress" style="color: red"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
31
three_d_viewer/templates/three_d_viewer/home.html
Normal file
31
three_d_viewer/templates/three_d_viewer/home.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% load static %}
|
||||
{% load dajaxice_templatetags %}
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>3D Sample Viewer</title>
|
||||
<link href="{% static "three_d_viewer/css/bootstrap.min.css" %}" rel="stylesheet" media="screen">
|
||||
<script type="text/javascript" src="{% static "three_d_viewer/jquery-2.0.3.js" %}"></script>
|
||||
<script type="text/javascript" srv="{% static "three_d_viewer/js/bootstrap.min.js" %}"></script>
|
||||
</head>
|
||||
|
||||
<body onload="load();">
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h1>Three D Viewer</h1>
|
||||
<p class="lead">Look at some rocks</p>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="row">
|
||||
{% include "three_d_viewer/sampletree.html" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<p>Put some intro text sort of stuff here</p?
|
||||
</div>
|
||||
</div>
|
||||
</div
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +0,0 @@
|
||||
{% if active_samples %}
|
||||
<ul>
|
||||
{% for sample in active_samples %}
|
||||
<li><a href="{% url 'three_d_viewer:detail' sample.id %}">{{ sample.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No samples are available.</p>
|
||||
{% endif %}
|
||||
26
three_d_viewer/templates/three_d_viewer/sampletree.html
Normal file
26
three_d_viewer/templates/three_d_viewer/sampletree.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<script type='text/javascript'>
|
||||
$(window).load(function(){
|
||||
$('.tree-toggle').click(function () {
|
||||
$(this).parent().children('ul.tree').toggle(200);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="well">
|
||||
<ul class="nav nav-list">
|
||||
<h2>Samples</h2>
|
||||
<ul>
|
||||
<ul class="nav nav-list tree">
|
||||
{% for category in parent_categories %}
|
||||
<li><label class="tree-toggle nav-header">{{ category.name }}</label>
|
||||
<ul class="nav nav-list tree">
|
||||
{% for sample in category.samples.all %}
|
||||
<li><a href="{% url 'three_d_viewer:detail' sample.id %}">{{ sample.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
Reference in New Issue
Block a user