forked from expo/troggle
Split up tags such that they use ajax
This commit is contained in:
parent
861daee66f
commit
5cbfa6d8b1
@ -35,6 +35,31 @@ def cave(request, cave_id='', offical_name=''):
|
|||||||
else:
|
else:
|
||||||
return render_with_context(request,'cave.html', {'cave': cave, 'cavepage': True})
|
return render_with_context(request,'cave.html', {'cave': cave, 'cavepage': True})
|
||||||
|
|
||||||
|
def caveEntrance(request, slug):
|
||||||
|
cave = Cave.objects.get(slug = slug)
|
||||||
|
if cave.non_public and not request.user.is_authenticated():
|
||||||
|
return render_with_context(request,'nonpublic.html', {'instance': cave})
|
||||||
|
else:
|
||||||
|
return render_with_context(request,'cave_entrances.html', {'cave': cave})
|
||||||
|
def caveDescription(request, slug):
|
||||||
|
cave = Cave.objects.get(slug = slug)
|
||||||
|
if cave.non_public and not request.user.is_authenticated():
|
||||||
|
return render_with_context(request,'nonpublic.html', {'instance': cave})
|
||||||
|
else:
|
||||||
|
return render_with_context(request,'cave_uground_description.html', {'cave': cave})
|
||||||
|
def caveQMs(request, slug):
|
||||||
|
cave = Cave.objects.get(slug = slug)
|
||||||
|
if cave.non_public and not request.user.is_authenticated():
|
||||||
|
return render_with_context(request,'nonpublic.html', {'instance': cave})
|
||||||
|
else:
|
||||||
|
return render_with_context(request,'cave_qms.html', {'cave': cave})
|
||||||
|
def caveLogbook(request, slug):
|
||||||
|
cave = Cave.objects.get(slug = slug)
|
||||||
|
if cave.non_public and not request.user.is_authenticated():
|
||||||
|
return render_with_context(request,'nonpublic.html', {'instance': cave})
|
||||||
|
else:
|
||||||
|
return render_with_context(request,'cave_logbook.html', {'cave': cave})
|
||||||
|
|
||||||
def caveSlug(request, slug):
|
def caveSlug(request, slug):
|
||||||
cave = Cave.objects.get(slug = slug)
|
cave = Cave.objects.get(slug = slug)
|
||||||
if cave.non_public and not request.user.is_authenticated():
|
if cave.non_public and not request.user.is_authenticated():
|
||||||
|
@ -29,96 +29,13 @@
|
|||||||
|
|
||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#entrances">Entrances</a></li>
|
<li><a href="/cave/description/{{cave.slug}}">Description</a></li>
|
||||||
<li><a href="#cave">Cave</a></li>
|
<li><a href="/cave/entrance/{{cave.slug}}">Entrances</a></li>
|
||||||
<li><a href="#logbook">Logbook</a></li>
|
<li><a href="/cave/logbook/{{cave.slug}}">Logbook</a></li>
|
||||||
<li><a href="#qms">QMs</a></li>
|
<li><a href="/cave/qms/{{cave.slug}}">QMs</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="entrances">
|
|
||||||
<p>{% if cave.entrances %}
|
|
||||||
<h2>Entrances</h2>
|
|
||||||
{% for ent in cave.entrances %}
|
|
||||||
<a href = "./{{ ent.entrance_letter|safe }}">{{ ent.entrance_letter|safe }}</a>
|
|
||||||
{% if ent.entrance.marking %}
|
|
||||||
Marking: {{ ent.entrance.marking_val|safe }}
|
|
||||||
{% endif %}
|
|
||||||
<br>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}</p>
|
|
||||||
</div>
|
|
||||||
<div id="cave">
|
|
||||||
<p>{% if cave.explorers %}
|
|
||||||
<h2>Explorers</h2>
|
|
||||||
{{ cave.explorers|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.underground_description %}
|
|
||||||
<h2>Underground Description</h2>
|
|
||||||
{{ cave.underground_description|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.equipment %}
|
|
||||||
<h2>Equipment</h2>
|
|
||||||
{{ cave.equipment|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.references %}
|
|
||||||
<h2>References</h2>
|
|
||||||
{{ cave.references|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.survey %}
|
|
||||||
<h2>Survey</h2>
|
|
||||||
{{ cave.survey|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.kataster_status %}
|
|
||||||
<h2>Kataster_status</h2>
|
|
||||||
{{ cave.kataster_status|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.underground_centre_line %}
|
|
||||||
<h2>Underground Centre Line</h2>
|
|
||||||
{{ cave.underground_centre_line|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.survex_file %}
|
|
||||||
<h2>Survex File</h2>
|
|
||||||
{{ cave.survex_file|safe }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cave.notes %}
|
|
||||||
<h2>Notes</h2>
|
|
||||||
{{ cave.notes|safe }}
|
|
||||||
{% endif %}</p>
|
|
||||||
</div>
|
|
||||||
<div id="logbook">
|
|
||||||
<p>
|
|
||||||
<table>
|
|
||||||
{% for logbookentry in cave.logbookentry_set.all %}
|
|
||||||
{% if logbookentry.title %}
|
|
||||||
<tr>
|
|
||||||
<td>{{logbookentry.date}}</td>
|
|
||||||
<td><a href="{{ logbookentry.get_absolute_url }}">{{logbookentry.title|safe}}</a></td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div id="qms">
|
<div id="qms">
|
||||||
<p>{% if cave.get_QMs %}
|
|
||||||
<h2>Question marks</h2>
|
|
||||||
<h3>Extant</h3>
|
|
||||||
<ul id="cavelist">
|
|
||||||
{% for QM in cave.get_QMs %}
|
|
||||||
{% if QM.ticked_off_by %}
|
|
||||||
{% else %}
|
|
||||||
<li><a href="{{QM.get_absolute_url}}">{{QM}}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
<h3>Ticked off</h3>
|
|
||||||
<ul>
|
|
||||||
{% for QM in cave.get_QMs %}
|
|
||||||
{% if QM.ticked_off_by %}
|
|
||||||
<li><a href="{{QM.get_absolute_url}}">{{QM}}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
12
templates/cave_entrances.html
Normal file
12
templates/cave_entrances.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<div id="entrances">
|
||||||
|
<p>{% if cave.entrances %}
|
||||||
|
<h2>Entrances</h2>
|
||||||
|
{% for ent in cave.entrances %}
|
||||||
|
<a href = "./{{ ent.entrance_letter|safe }}">{{ ent.entrance_letter|safe }}</a>
|
||||||
|
{% if ent.entrance.marking %}
|
||||||
|
Marking: {{ ent.entrance.marking_val|safe }}
|
||||||
|
{% endif %}
|
||||||
|
<br>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}</p>
|
||||||
|
</div>
|
12
templates/cave_logbook.html
Normal file
12
templates/cave_logbook.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<p>
|
||||||
|
<table>
|
||||||
|
{% for logbookentry in cave.logbookentry_set.all %}
|
||||||
|
{% if logbookentry.title %}
|
||||||
|
<tr>
|
||||||
|
<td>{{logbookentry.date}}</td>
|
||||||
|
<td><a href="{{ logbookentry.get_absolute_url }}">{{logbookentry.title|safe}}</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</p>
|
20
templates/cave_qms.html
Normal file
20
templates/cave_qms.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<p>{% if cave.get_QMs %}
|
||||||
|
<h2>Question marks</h2>
|
||||||
|
<h3>Extant</h3>
|
||||||
|
<ul id="cavelist">
|
||||||
|
{% for QM in cave.get_QMs %}
|
||||||
|
{% if QM.ticked_off_by %}
|
||||||
|
{% else %}
|
||||||
|
<li><a href="{{QM.get_absolute_url}}">{{QM}}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
<h3>Ticked off</h3>
|
||||||
|
<ul>
|
||||||
|
{% for QM in cave.get_QMs %}
|
||||||
|
{% if QM.ticked_off_by %}
|
||||||
|
<li><a href="{{QM.get_absolute_url}}">{{QM}}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}</p>
|
36
templates/cave_uground_description.html
Normal file
36
templates/cave_uground_description.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<p>{% if cave.explorers %}
|
||||||
|
<h2>Explorers</h2>
|
||||||
|
{{ cave.explorers|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.underground_description %}
|
||||||
|
<h2>Underground Description</h2>
|
||||||
|
{{ cave.underground_description|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.equipment %}
|
||||||
|
<h2>Equipment</h2>
|
||||||
|
{{ cave.equipment|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.references %}
|
||||||
|
<h2>References</h2>
|
||||||
|
{{ cave.references|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.survey %}
|
||||||
|
<h2>Survey</h2>
|
||||||
|
{{ cave.survey|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.kataster_status %}
|
||||||
|
<h2>Kataster_status</h2>
|
||||||
|
{{ cave.kataster_status|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.underground_centre_line %}
|
||||||
|
<h2>Underground Centre Line</h2>
|
||||||
|
{{ cave.underground_centre_line|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.survex_file %}
|
||||||
|
<h2>Survex File</h2>
|
||||||
|
{{ cave.survex_file|safe }}
|
||||||
|
{% endif %}
|
||||||
|
{% if cave.notes %}
|
||||||
|
<h2>Notes</h2>
|
||||||
|
{{ cave.notes|safe }}
|
||||||
|
{% endif %}</p>
|
8
urls.py
8
urls.py
@ -45,8 +45,12 @@ actualurlpatterns = patterns('',
|
|||||||
|
|
||||||
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"),
|
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"),
|
||||||
url(r'^caveslug/([^/]+)/?$', views_caves.caveSlug, name="caveSlug"),
|
url(r'^caveslug/([^/]+)/?$', views_caves.caveSlug, name="caveSlug"),
|
||||||
url(r'^cavedescription/(?P<cavedescription_name>[^/]+)/?$', views_caves.cave_description, name="cavedescription"),
|
url(r'^cave/entrance/([^/]+)/?$', views_caves.caveEntrance),
|
||||||
url(r'^cavedescription/?$', object_list, {'queryset':CaveDescription.objects.all(),'template_name':'object_list.html'}, name="cavedescriptions"),
|
url(r'^cave/description/([^/]+)/?$', views_caves.caveDescription),
|
||||||
|
url(r'^cave/qms/([^/]+)/?$', views_caves.caveQMs),
|
||||||
|
url(r'^cave/logbook/([^/]+)/?$', views_caves.caveLogbook),
|
||||||
|
#url(r'^cavedescription/(?P<cavedescription_name>[^/]+)/?$', views_caves.cave_description, name="cavedescription"),
|
||||||
|
#url(r'^cavedescription/?$', object_list, {'queryset':CaveDescription.objects.all(),'template_name':'object_list.html'}, name="cavedescriptions"),
|
||||||
#url(r'^cavehref/(.+)$', views_caves.cave, name="cave"),url(r'cave'),
|
#url(r'^cavehref/(.+)$', views_caves.cave, name="cave"),url(r'cave'),
|
||||||
|
|
||||||
url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
||||||
|
Loading…
Reference in New Issue
Block a user