Added link to parent cave in menu

This commit is contained in:
Martin Green 2022-06-24 19:28:31 +01:00
parent 54f47c58db
commit 7db7c67065
3 changed files with 36 additions and 3 deletions

View File

@ -174,10 +174,17 @@ def expowebpage(request, expowebpath, path):
menumatch = re.match(r'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE) menumatch = re.match(r'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE)
if menumatch: if menumatch:
has_menu = True has_menu = True
m = re.search(r"(162\d\/[^\/]+)[\/\.]", path, re.DOTALL + re.IGNORECASE)
if m:
path_start, = m.groups()
parent_caves = Cave.objects.filter(url__startswith = path_start)
else:
parent_caves = None
handbook = path.startswith("handbook") handbook = path.startswith("handbook")
return render(request, 'expopage.html', {'editable': editable, 'path': path, 'title': title, return render(request, 'expopage.html', {'editable': editable, 'path': path, 'title': title,
'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu, 'handbook': handbook}) 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu, 'handbook': handbook, 'parent_caves': parent_caves})
def mediapage(request, subpath=None, doc_root=None): def mediapage(request, subpath=None, doc_root=None):
'''This is for special prefix paths /photos/ /site_media/, /static/ etc. '''This is for special prefix paths /photos/ /site_media/, /static/ etc.

View File

@ -36,7 +36,15 @@
<table class="searchable"> <table class="searchable">
{% for cave in caves1623 %} {% for cave in caves1623 %}
<tr><td> <a href="{{ cave.url }}">{% if cave.kataster_number %}{{ cave.kataster_number }} {{cave.official_name|safe}}</a> {% if cave.unofficial_number %}({{cave.unofficial_number }}){% endif %}{% else %}{{cave.unofficial_number }} {{cave.official_name|safe}}</a> {% endif %}</td></tr> <tr><td> <a href="{{ cave.url }}">
{% if cave.kataster_number %}
{{ cave.kataster_number }} {{cave.official_name|safe}}</a>
{% if cave.unofficial_number %}
({{cave.unofficial_number }})
{% endif %}
{% else %}
{{cave.unofficial_number }} {{cave.official_name|safe}}</a>
{% endif %}</td></tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -13,7 +13,25 @@
</ul> </ul>
{% endif%}</li> {% endif%}</li>
<li><a href="/handbook/computing/onlinesystems.html">Online systems</a></li> <li><a href="/handbook/computing/onlinesystems.html">Online systems</a></li>
<li><a href="/caves">Caves</a></li> <li><a href="/caves">Caves</a>
{% if parent_caves %}
<ul>
{% for parent_cave in parent_caves %}
<li><a href="/{{ parent_cave.url }}">
{% if parent_cave.kataster_number %}
{{ parent_cave.kataster_number }} {{parent_cave.official_name|safe}}</a>
{% if parent_cave.unofficial_number %}
({{parent_cave.unofficial_number }})
{% endif %}
{% else %}
{{parent_cave.unofficial_number }} {{parent_cave.official_name|safe}}</a>
{% endif %}</li>
{% ifequal parent_cave.kataster_number "161" %}
<li><a href="/1623/161/names.htm">KH Glossary</a></li>
{% endifequal %}
{% endfor %}
</ul>
{% endif%}</li>
<li><a href="/infodx.htm">Site index</a></li> <li><a href="/infodx.htm">Site index</a></li>
<li><a href="/pubs.htm">Reports</a></li> <li><a href="/pubs.htm">Reports</a></li>
<li><a href="/guidebook/areas.htm">Areas</a></li> <li><a href="/guidebook/areas.htm">Areas</a></li>