summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorMartin Green <martin.speleo@gmail.com>2011-05-01 19:32:41 +0100
committerMartin Green <martin.speleo@gmail.com>2011-05-01 19:32:41 +0100
commitb001df1f5319dd8627faba3cd56c412e8584fc7d (patch)
tree37ad33f4ad34e36b594bb296e98fbe02ecee29e1 /templates
parent1cc7f2d92eef1acd6537453a866b7d2b117a7af0 (diff)
downloadtroggle-b001df1f5319dd8627faba3cd56c412e8584fc7d.tar.gz
troggle-b001df1f5319dd8627faba3cd56c412e8584fc7d.tar.bz2
troggle-b001df1f5319dd8627faba3cd56c412e8584fc7d.zip
edit logbooks, new logbook format, increased database normalisation
Diffstat (limited to 'templates')
-rw-r--r--templates/dataformat/logbookentry.html25
-rw-r--r--templates/expedition.html24
-rw-r--r--templates/logbookentry.html6
-rw-r--r--templates/newlogbookentry.html82
4 files changed, 122 insertions, 15 deletions
diff --git a/templates/dataformat/logbookentry.html b/templates/dataformat/logbookentry.html
new file mode 100644
index 0000000..e6b83ce
--- /dev/null
+++ b/templates/dataformat/logbookentry.html
@@ -0,0 +1,25 @@
+{% autoescape off %}
+<html>
+<head>
+<style type="text/css">.author {text-decoration:underline}</style>
+</head>
+<body>
+<H1>{{trip.title}}</H1>
+<span class="date">{{date}}</span> - <span class="expeditionyear">{{expeditionyear}}</span>
+
+{% if trip.caveOrLocation == "cave" %}
+<span class="cave">{{trip.cave}}</span>
+{% else %}
+<span class="location">{{trip.location}}</span>
+{% endif %}
+
+{% for person in persons %}
+<div class="person">
+<span class="name{% if person.author %} author{% endif %}">{{person.name}}</span>
+TU<span class="TU">{% if person.TU %}{{person.TU}}{% else %}0{% endif %}</span>hours
+</div>
+{% endfor %}
+<div class="report">{{trip.html}}</div>
+</body>
+</html>
+{% endautoescape %}
diff --git a/templates/expedition.html b/templates/expedition.html
index fd78eea..814b77e 100644
--- a/templates/expedition.html
+++ b/templates/expedition.html
@@ -67,22 +67,20 @@ an "S" for a survey trip. The colours are the same for people on the same trip.
<form action="" method="GET"><input type="submit" name="reload" value="Reload"></form>
<h3>Logbooks and survey trips per day</h3>
+<a href="{% url newLogBookEntry expeditionyear=expedition.year %}">New logbook entry</a>
<table class="expeditionlogbooks">
<tr><th>Date</th><th>Logged trips</th><th>Surveys</th></tr>
-{% for expeditionday in expedition.expeditionday_set.all %}
+{% regroup dateditems|dictsort:"date" by date as dates %}
+{% for date in dates %}
<tr>
- <td>{{expeditionday.date}}</td>
- <td>
- {% for logbookentry in expeditionday.logbookentry_set.all %}
- <a href="{{ logbookentry.get_absolute_url }}">{{logbookentry.title|safe}}</a><br/>
- {% endfor %}
- </td>
- <td>
- {% for survexblock in expeditionday.survexblock_set.all %}
- <a href="{% url svx survexblock.survexfile.path %}">{{survexblock.name}}</a>
- {% endfor %}
- </td>
-</tr>
+<td>{{date.grouper}}</td>
+<td>{% for item in date.list %}
+ {% if item.isLogbookEntry %}<a href="{{ item.get_absolute_url }}">{{item.title|safe}}</a><br/>{% endif %}
+ {% endfor %}</td>
+<td>{% for item in date.list %}
+ {% if item.isSurvexBlock %}<a href="{% url svx item.survexfile.path %}">{{item.name}}</a><br/>{% endif %}
+ {% endfor %}</td>
+</tr>
{% endfor %}
</table>
diff --git a/templates/logbookentry.html b/templates/logbookentry.html
index 03fc37e..19b8a30 100644
--- a/templates/logbookentry.html
+++ b/templates/logbookentry.html
@@ -45,12 +45,12 @@
<td>
{% if persontrip.persontrip_prev %}
- <a href="{{ persontrip.persontrip_prev.logbook_entry.get_absolute_url }}">{{persontrip.persontrip_prev.date}}</a>
+ <a href="{{ persontrip.persontrip_prev.logbook_entry.get_absolute_url }}">{{persontrip.persontrip_prev.logbook_entry.date}}</a>
{% endif %}
</td>
<td>
{% if persontrip.persontrip_next %}
- <a href="{{ persontrip.persontrip_next.logbook_entry.get_absolute_url }}">{{persontrip.persontrip_next.date}}</a>
+ <a href="{{ persontrip.persontrip_next.logbook_entry.get_absolute_url }}">{{persontrip.persontrip_next.logbook_entry.date}}</a>
{% endif %}
</td>
@@ -69,4 +69,6 @@
</div>
</div>
+{% if logbookentry.filename %}<a href="{% url editlogbookentry year=logbookentry.year pdate=logbookentry.date pslug=logbookentry.slug %}">Edit</a> <a href="{% url deletelogbookentry year=logbookentry.year date=logbookentry.date slug=logbookentry.slug %}">Delete</a>{%endif%}
+
{% endblock %}
diff --git a/templates/newlogbookentry.html b/templates/newlogbookentry.html
new file mode 100644
index 0000000..0cce46b
--- /dev/null
+++ b/templates/newlogbookentry.html
@@ -0,0 +1,82 @@
+{% extends "base.html" %}
+{% block title %}Logbook {{logbookentry.id}}{% endblock %}
+{% block head %}
+<script>
+ $(function() {
+ $("#id_date").datepicker({dateFormat: "yy-mm-dd"});
+ $('.persontrips tbody tr').formset();
+ $(":radio[name*='caveOrLocation']").change(setLocationType);
+ $(setLocationType());
+ function setLocationType () {
+ $("#cave").hide();
+ $("#location").hide();
+ $("#" + $(":radio[name*='caveOrLocation']:checked")[0].value).show();
+ };
+
+ });
+
+</script>
+<link rel="stylesheet" href="{{ settings.MEDIA_URL }}css/ui-lightness/jquery-ui-1.8.12.custom.css" type="text/css" media="all" />
+<script src="{{ settings.MEDIA_URL }}js/jquery-ui-1.8.12.custom.min.js" type="text/javascript"></script>
+<script src="{{ settings.MEDIA_URL }}js/jquery.formset.min.js" type="text/javascript"></script>
+<script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script>
+{{ tripForm.media }}
+{% endblock %}
+{% block content %}
+
+<form action="" method="post">
+ {{ tripForm.non_field_errors }}
+ <div class="fieldWrapper">
+ {{ tripForm.title.errors }}
+ <label for="id_title">Title:</label>
+ {{ tripForm.title }}
+ </div>
+ <div class="fieldWrapper">
+ {{ tripForm.date.errors }}
+ <label for="id_date">Date:</label>
+ {{ tripForm.date }}
+ </div>
+ <div class="fieldWrapper">
+ {{ tripForm.caveOrLocation.errors }}
+ <label for="id_caveOrLocation">Location Type:</label>
+ {{ tripForm.caveOrLocation }}
+ </div>
+ <div class="fieldWrapper" id="cave">
+ {{ tripForm.cave.errors }}
+ <label for="id_cave">Cave:</label>
+ {{ tripForm.cave }}
+ </div>
+ <div class="fieldWrapper" id="location">
+ {{ tripForm.location.errors }}
+ <label for="id_location">Location:</label>
+ {{ tripForm.location }}
+ </div>
+ <table class="persontrips" border="0" cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr>
+ <th>Person</th>
+ <th>TU /hours</th>
+ <th>Author</th>
+ <th></th>
+ </tr>
+ {% for form in personTripFormSet.forms %}
+ <tr>
+ <td>{{ form.name.errors }}{{ form.name }}</td>
+ <td>{{ form.TU.errors }}{{ form.TU }}</td>
+ <td>{{ form.author.errors }}{{ form.author }}</td>
+ <td></td>
+ {{ form.non_field_errors }}
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {{ personTripFormSet.management_form }}
+ <div class="fieldWrapper">
+ {{ tripForm.html.errors }}
+ <label for="id_date">Content:</label>
+ {{ tripForm.html }}
+ </div>
+ <p><input type="submit" value="Sumbit Trip Report" /></p>
+</form>
+
+{% endblock %}