Minerals now show their detail. The layout still needs work to get it showing correctly though.
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
Django==1.5.1
|
Django==1.6.1
|
||||||
South==0.8.1
|
South==0.8.1
|
||||||
astroid==1.0.0
|
astroid==1.0.0
|
||||||
coverage==3.6
|
coverage==3.6
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Category(CommonInfo):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def active_samples(self):
|
def active_samples(self):
|
||||||
return self.samples.filter(active=True).order_by('name')
|
return self.samples.select_subclasses(Sample, Mineral).filter(active=True).order_by('name')
|
||||||
|
|
||||||
|
|
||||||
class Sample(CommonInfo):
|
class Sample(CommonInfo):
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div
|
<div class="row my-fluid-container">
|
||||||
|
{% block details %}
|
||||||
|
{% endblock details %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -69,6 +69,7 @@ function formatNumber(numero, decimales){
|
|||||||
return parseInt(numero * pot) / pot;
|
return parseInt(numero * pot) / pot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% block load %}
|
||||||
function load(){
|
function load(){
|
||||||
window.addEventListener('resize', resizeCanvas, false);
|
window.addEventListener('resize', resizeCanvas, false);
|
||||||
resizeCanvas();
|
resizeCanvas();
|
||||||
@@ -96,6 +97,7 @@ function load(){
|
|||||||
}
|
}
|
||||||
request.send();
|
request.send();
|
||||||
}
|
}
|
||||||
|
{% endblock load %}
|
||||||
|
|
||||||
function loaded(){
|
function loaded(){
|
||||||
/*if ( navigator.userAgent.indexOf("WebKit") == -1){
|
/*if ( navigator.userAgent.indexOf("WebKit") == -1){
|
||||||
|
|||||||
@@ -1,6 +1,83 @@
|
|||||||
{% extends "three_d_viewer/detail.html" %}
|
{% extends "three_d_viewer/detail.html" %}
|
||||||
|
|
||||||
{% block pageheader %}
|
{% block pageheader %}
|
||||||
<h1>{{ 'MINERALS' }}</h1>
|
<h1>{{ mineral.name }}</h1>
|
||||||
<p class="lead">{{ sample.description }}</p>
|
<p class="lead">{{ mineral.description }}</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block load %}
|
||||||
|
function load(){
|
||||||
|
window.addEventListener('resize', resizeCanvas, false);
|
||||||
|
resizeCanvas();
|
||||||
|
|
||||||
|
var sampleFilename = '{{ mineral.model_filename|escapejs }}';
|
||||||
|
|
||||||
|
if (sampleFilename.trim() == "")
|
||||||
|
{
|
||||||
|
document.getElementById("progress").innerHTML = "No model defined!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request = new XMLHttpRequest();
|
||||||
|
request.open("GET", '{{ MEDIA_URL }}' + sampleFilename, true);
|
||||||
|
request.overrideMimeType("text/plain; charset=x-user-defined");
|
||||||
|
request.onreadystatechange = function(){
|
||||||
|
if (this.readyState == 3 || this.readyState == 4){
|
||||||
|
document.getElementById("progress").innerHTML = "Downloading... "
|
||||||
|
+ formatNumber(this.responseText.length / 1048576, 2) + " MB";
|
||||||
|
}
|
||||||
|
if (this.readyState == 4 && (this.status == 200 || this.status == 0) ){
|
||||||
|
document.getElementById("progress").innerHTML = "Unpacking...";
|
||||||
|
setTimeout(loaded, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
request.send();
|
||||||
|
}
|
||||||
|
{% endblock load %}
|
||||||
|
|
||||||
|
{% block details %}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">{{ mineral.name }} Details</div>
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<td>Chemical Formula</td>
|
||||||
|
<td>{{ mineral.chemical_formula }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Hardness</td>
|
||||||
|
<td>{{ mineral.hardness }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Specific Gravity</td>
|
||||||
|
<td>{{ mineral.specific_gravity }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cleavage/Fracture</td>
|
||||||
|
<td>{{ mineral.cleavage_fracture }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Lustre</td>
|
||||||
|
<td>{{ mineral.lustre }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Colour</td>
|
||||||
|
<td>{{ mineral.colour }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Streak</td>
|
||||||
|
<td>{{ mineral.habit }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Crystallography</td>
|
||||||
|
<td>{{ mineral.crystallography }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Identifying features</td>
|
||||||
|
<td>{{ mineral.identifying_features }}</td>
|
||||||
|
</tr>
|
||||||
|
<td>Occurance</td>
|
||||||
|
<td>{{ mineral.occurance }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endblock details %}
|
||||||
@@ -6,7 +6,7 @@ urlpatterns = patterns(
|
|||||||
'',
|
'',
|
||||||
url(r'^$', views.HomeView.as_view(), name='home'),
|
url(r'^$', views.HomeView.as_view(), name='home'),
|
||||||
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
|
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
|
||||||
url(r'^(?P<pk>\d+)/$', views.MineralDetailView.as_view(), name='mineral_detail'),
|
url(r'^minerals/(?P<pk>\d+)/$', views.MineralDetailView.as_view(), name='mineral_detail'),
|
||||||
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
|
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
|
||||||
{'document_root': settings.MEDIA_ROOT}),
|
{'document_root': settings.MEDIA_ROOT}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,4 +48,14 @@ class MineralDetailView(DetailView):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
model = Mineral
|
model = Mineral
|
||||||
template_name = 'three_d_viewer/mineral_detail.html'
|
template_name = 'three_d_viewer/mineral_detail.html'
|
||||||
|
|
||||||
|
parent_categories = Category.objects.filter(parent=None). \
|
||||||
|
filter(active=True).order_by("name")
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(DetailView, self).get_context_data(**kwargs)
|
||||||
|
context['active_samples'] = Sample.objects.select_subclasses(Mineral).filter(active=True).order_by('name')
|
||||||
|
context['parent_categories'] = Category.objects.filter(parent=None). \
|
||||||
|
filter(active=True).order_by('name')
|
||||||
|
return context
|
||||||
Reference in New Issue
Block a user