2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

Logbook entry initial form

This commit is contained in:
Philip Sargent 2023-08-06 13:47:09 +03:00
parent 1baf528d0a
commit 9269d1ec52
3 changed files with 105 additions and 1 deletions

View File

@ -52,6 +52,29 @@ class TextForm(forms.Form): # not a model-form, just a form-form
class ExpofileRenameForm(forms.Form): # not a model-form, just a form-form
renameto = forms.CharField(strip=True, required=False)
class LogbookEditForm(forms.Form): # not a model-form, just a form-form
author = forms.CharField(strip=True, required=False)
@login_required_if_public
def logbookedit(request, year=None):
"""Type in a logbook entry.
No editing yet, name is implying a future enhancement
"""
author = "Zonker"
if not year:
year = 2023
form = LogbookEditForm()
return render(
request,
"logbookform.html",
{
"form": form,
"year": year,
"author": author,
},
)
@login_required_if_public
def expofilerename(request, filepath):
"""Rename any single file in /expofiles/ - eventually.

View File

@ -0,0 +1,79 @@
{% extends "base.html" %}
{% block title %}New Logbook Entry form{% endblock %}
{% block content %}
<h2>New Logbook Entry in {{year}}</h2>
{% if save_bad %}
<p style="font-family: monospace; font-weight: bold; color: red; font-size: 130%; text-align: center">
Cannot save to '{{save_bad}}' as a file of that name already exists here.
</p>
{% endif %}
<style>
input, textarea {font-family: monospace; font-weight: bold; text-align:center; font-size: 100%; padding: 0.5em; }
textarea {text-align:left }
</style>
<div style = "max-width:100%; margin-left:15%; font-family: monospace; font-weight: bold; font-size: 150%; text-align: right; " >
<form method ='post' >
{% csrf_token %}
<br />
<label for="date">Date of the activity</label>
<input {% if not user.username %} disabled{% endif %}
label = "Date" name = "date" size="12"
title="Date of the activity, a single day, in ISO format: 2020-08-17"
placeholder="{% if date %}{{date}}{% else %}2023-08-01{% endif %}" " required />
<br /><br />
<label for="author">Your name (author) <a href="/aliases/{{year}}">[valid authors]</a></label>
<input {% if not user.username %} disabled{% endif %}
label = "author" name = "author" size="20"
title="The person writing the logbook entry"
placeholder="{{author}}" required />
<br /><br />
<label for="others">Other names (comma separated) <a href="/aliases/{{year}}">[valid aliases]</a></label>
<input {% if not user.username %} disabled{% endif %}
label = "others" name = "others" size="20"
title="Everyone else involved"
placeholder="Phil T, Chas, Planc" />
<br /><br />
<label for="place">Place: cave name, or 'plateau', 'topcamp' etc.</label>
<input {% if not user.username %} disabled{% endif %}
label = "Place" name = "place" size="15"
title="Place: cave name, or 'plateau', 'topcamp' "
placeholder="basecamp" required />
<br /><br />
<label for="title">Title</label>
<input {% if not user.username %} disabled{% endif %}
label = "Title" name = "title" size="30"
title="What we did on our holidays"
placeholder="What we did on our holidays" required />
<br /><br />
<label for="title"></label>
<textarea {% if not user.username %} disabled{% endif %}
rows="5" cols="60"
label = "" name = "text"
title="We had a lot of fun..."
placeholder="We had a lot of fun..." required />We had a lot of fun...
</textarea>
<br><br><br>
<button class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px" type = "submit" value = "save" >
Save logbook entry
</button>
</form>
<br /><br /><br />
Full logbook for this year: <a href="/years/{{year}}/logbook.html"><em>Logbook {{year}}</em></a>
</div>
<br />
<hr />
{% endblock %}

View File

@ -24,7 +24,7 @@ from troggle.core.views.other import (controlpanel, exportlogbook, frontpage,
from troggle.core.views.prospect import prospecting
from troggle.core.views.scans import (allscans, cavewallets, scansingle,
walletslistperson, walletslistyear)
from troggle.core.views.uploads import dwgupload, photoupload, expofilerename
from troggle.core.views.uploads import dwgupload, photoupload, expofilerename, logbookedit
from troggle.core.views.wallets_edit import walletedit
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
to resolve urls - in both directions as these are declarative.
@ -109,6 +109,8 @@ trogglepatterns = [
path('dwgupload/', dwgupload, name='dwgupload'),
path('dwguploadnogit/', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing
path('dwguploadnogit/<path:folder>', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing
path('logbookedit/', logbookedit, name='logbookedit'),
path('logbookedit/<int:year>', logbookedit, name='logbookedit'), # year=2023
# Renaming an uploaded file
path('expofilerename/<path:filepath>', expofilerename, name='expofilerename'),