diff options
-rw-r--r-- | core/views_survex.py | 8 | ||||
-rw-r--r-- | templates/svxcavesingle.html | 127 |
2 files changed, 67 insertions, 68 deletions
diff --git a/core/views_survex.py b/core/views_survex.py index 89831e1..464b870 100644 --- a/core/views_survex.py +++ b/core/views_survex.py @@ -383,19 +383,15 @@ def survexcaveslist(request): def survexcavesingle(request, survex_cave): '''parsing all the survex files of a single cave and showing that it's consistent and can find all - the files and people. Currently not showing Explorers or Titles. link test from SurvexFile page - is "dates and explorers". Should explicity fix the kataster number thing. + the files and people. Should explicity fix the kataster number thing. ''' sc = survex_cave - breload = False - if breload: - parsers.survex.ReloadSurvexCave(sc) # does not exit now, needs re-writing to work. try: cave = Cave.objects.get(kataster_number=sc) return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave }) except ObjectDoesNotExist: # can get here if the survex file is in a directory labelled with unofficial number not kataster number. - # maybe - and _ mixed up, or CUCC-2017- instead of 2017-CUCC-, or CUCC2015DL01 ?? + # maybe - and _ mixed up, or CUCC-2017- instead of 2017-CUCC-, or CUCC2015DL01 . Let's not get carried away.. for unoff in [sc, sc.replace('-','_'), sc.replace('_','-')]: try: cave = Cave.objects.get(unofficial_number=unoff) diff --git a/templates/svxcavesingle.html b/templates/svxcavesingle.html index bf505dd..319cb4b 100644 --- a/templates/svxcavesingle.html +++ b/templates/svxcavesingle.html @@ -6,74 +6,77 @@ {% block content %} -<h1>Surveys for cave - kataster number:{{cave}}</h1> +{% autoescape off %} +<h1>Surveys for <a href="/{{cave.url}}">{{cave.official_name}}</a> - kataster:{{cave}}</h1> +{% endautoescape %} +<!-- the only thing passed into this temnplate is the object identifier for a cave. +All the processing to extract the survex subdriectories and survex files is done in this template --> +<p>Cave description: <a href="/{{cave.url}}">{{cave.url}}</a> +</p> <p> {% for survexdirectory in cave.survexdirectory_set.all %} <a href="#T_{{survexdirectory.primarysurvexfile.path}}">{{survexdirectory.path}}</a> {% endfor %} </p> - {% for survexdirectory in cave.survexdirectory_set.all %} -<h3 id="T_{{survexdirectory.primarysurvexfile.path}}">{{survexdirectory.path}}</h3> - -<table> -<tr><th>Survex file</th><th>Block</th><th>Date</th><th>Explorers</th><th>length</th><th>Titles</th><th>Scans</th></tr> - -{% for survexfile in survexdirectory.survexfile_set.all %} -<tr> - {% if survexfile.exists %} - <td rowspan="{{survexfile.survexblock_set.all|length|plusone}}"> - {% else %} - <td class="survexnewfile" rowspan="{{survexfile.survexblock_set.all|length|plusone}}"> - {% endif %} - - {% ifequal survexfile survexdirectory.primarysurvexfile %} - <a href="{% url "svx" survexfile.path %}"><b>{{survexfile.path}}</b></a> - {% else %} - <a href="{% url "svx" survexfile.path %}">{{survexfile.path}}</a> - {% endifequal %} - </td> -</tr> - -{% for survexblock in survexfile.survexblock_set.all %} -<tr> - <td style="width:10 em">{{survexblock.name}}</td> - <td style="white-space:nowrap"> - {% if survexblock.expedition %} - <a href="{{survexblock.expedition.get_absolute_url}}">{{survexblock.date|date:"D d M Y"}}</a> - {% else %} - <!--{{survexblock.date}}--> - {% endif %} - </td> - - <td> - {% for personrole in survexblock.survexpersonrole_set.all %} - {% if personrole.personexpedition %} - <a href="{{personrole.personexpedition.get_absolute_url}}">{{personrole.personname}}</a> - {% else %} - {{personrole.personname}} - {% endif %} - {% endfor %} - </td> - - <td style="padding-right: 3px; text-align:right">{{survexblock.legslength|stringformat:".1f"}}</td> - - <td style="padding-left: 3px;"> - {{survexblock.title}} - </td> - - <td> - {% if survexblock.scansfolder %} - <b><a href="{{survexblock.scansfolder.get_absolute_url}}">{{survexblock.scansfolder.walletname}}</a></b> - {% endif %} - </td> -</tr> + <h3 id="T_{{survexdirectory.primarysurvexfile.path}}">{{survexdirectory.path}}</h3> + <table> + <tr><th>Survex file</th><th>Block</th><th>Date</th><th>Explorers</th><th>length</th><th>Titles</th><th>Scans</th></tr> + {% for survexfile in survexdirectory.survexfile_set.all %} + <tr> + {% if survexfile.exists %} + <td rowspan="{{survexfile.survexblock_set.all|length|plusone}}"> + {% else %} + <td class="survexnewfile" rowspan="{{survexfile.survexblock_set.all|length|plusone}}"> + {% endif %} + + {% ifequal survexfile survexdirectory.primarysurvexfile %} + <a href="{% url "svx" survexfile.path %}"><b>{% url "svx" survexfile.path %}</b></a> + {% else %} + <a href="{% url "svx" survexfile.path %}"><i><small>{% url "svx" survexfile.path %}</small></i></a><!-- would like to extract only the last bit. Some javascript useful ?--> + {% endifequal %} + </td> + </tr> + {% for survexblock in survexfile.survexblock_set.all %} + <tr> + <!-- Block --> + <td style="width:10 em"><a href="{% url "svx" survexfile.path %}">{{survexblock.name}}</a></td> + + <!-- Date --> + <td style="white-space:nowrap"> + {% if survexblock.expedition %} + <a href="{{survexblock.expedition.get_absolute_url}}">{{survexblock.date|date:"D d M Y"}}</a> + {% else %} + <!--{{survexblock.date}}--> + {% endif %} + </td> + <!-- Explorers --> + <td> + {% for personrole in survexblock.survexpersonrole_set.all %} + {% if personrole.personexpedition %} + <a href="{{personrole.personexpedition.get_absolute_url}}">{{personrole.personname}}</a> + {% else %} + {{personrole.personname}} + {% endif %} + {% endfor %} + </td> + <!-- length --> + <td style="padding-right: 3px; text-align:right">{{survexblock.legslength|stringformat:".1f"}}</td> + + <!-- Titles --> + <td style="padding-left: 3px;"> + {{survexblock.title}} + </td> + <!-- Scans --> + <td> + {% if survexblock.scansfolder %} + <b><a href="{{survexblock.scansfolder.get_absolute_url}}">{{survexblock.scansfolder.walletname}}</a></b> + {% endif %} + </td> + </tr> + {% endfor %} + {% endfor %} + </table> {% endfor %} -{% endfor %} -</table> - -{% endfor %} - {% endblock %} - |