Bigger buttons, phone compatible

This commit is contained in:
Philip Sargent 2021-05-01 18:35:08 +01:00
parent 100209ea16
commit 3393db0fbc
3 changed files with 90 additions and 32 deletions

View File

@ -200,8 +200,7 @@ def ajax_test(request):
class MyForm(forms.Form): # not a model-form class MyForm(forms.Form): # not a model-form, just a form-form
title = forms.CharField(max_length=20)
scanfiles = forms.FileField() scanfiles = forms.FileField()
@login_required_if_public @login_required_if_public
@ -218,8 +217,13 @@ def scanupload(request, wallet=None):
wallet = "2021:01" # improve this later wallet = "2021:01" # improve this later
year = wallet[:4] year = wallet[:4]
if int(year) < 1977:
year = "1977"
if int(year) > 2050:
year = "2050"
nexty = f'{int(year)+1}' nexty = f'{int(year)+1}'
prevy = f'{int(year)-1}' prevy = f'{int(year)-1}'
wnumber = wallet[5:] wnumber = wallet[5:]
next = f'{int(wnumber)+1:02d}' next = f'{int(wnumber)+1:02d}'
prev = f'{int(wnumber)-1:02d}' prev = f'{int(wnumber)-1:02d}'
@ -235,11 +239,9 @@ def scanupload(request, wallet=None):
if request.method == 'POST': if request.method == 'POST':
form = MyForm(request.POST,request.FILES) form = MyForm(request.POST,request.FILES)
if form.is_valid(): if form.is_valid():
#form.save() # comment out so nothing saved in MEDIA_ROOT/fileuploads
f = request.FILES["scanfiles"] f = request.FILES["scanfiles"]
w = request.POST["title"]
multiple = request.FILES.getlist('scanfiles') multiple = request.FILES.getlist('scanfiles')
fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, year, w)) fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, year, wallet))
actual_saved = [] actual_saved = []
if multiple: if multiple:

View File

@ -171,6 +171,12 @@ hr{
div.centre img { vertical-align: middle; } div.centre img { vertical-align: middle; }
h1 { text-align: center; font-size: 210%; display: inline;} h1 { text-align: center; font-size: 210%; display: inline;}
h1 {
margin-top:0;
margin-left:10px;
vertical-align:top;
}
h2 { } h2 { }
h3 { color: #000 text-align:left; Dborder-bottom:thin solid black; margin-bottom:1em; margin-top:1em; font-weight:bold} h3 { color: #000 text-align:left; Dborder-bottom:thin solid black; margin-bottom:1em; margin-top:1em; font-weight:bold}
h4 { color: #0d664c; } h4 { color: #0d664c; }
@ -344,12 +350,6 @@ body {
} }
h1 {
margin-top:0;
margin-left:10px;
vertical-align:top;
}
.rightMargin { .rightMargin {
position:absolute; position:absolute;
@ -428,8 +428,69 @@ div#difflistajax
border: thin green solid; border: thin green solid;
} }
.fancybutton {
color: #ffffff;
font: 18px Georgia, "Times New Roman", Times, serif;
letter-spacing: 1px;
text-shadow: 0 1px 1px #000000;
#display: block;
/* margin: auto; */
font-size: 1.2em;
line-height: 1.25em;
padding: 7px 25px;
cursor: pointer;
position: static;
background: #bf3700;
border: 1px solid #60AABF;
/* -moz-border-radius: 20px;
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;*/
border-radius: 20px;
/*
-webkit-box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;
-moz-box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;
-o-box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;*/
box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;
background: #39b2e5;
background: -webkit-gradient(linear, left top, left bottom, from(#39b2e5), to(#6083BF));
background: -moz-linear-gradient(top, #39b2e5, #6083BF);
background: -o-linear-gradient(top, #39b2e5, #6083BF);
background: linear-gradient(top, #39b2e5, #6083BF);
}
.fancybutton:hover,
.fancybutton:focus {
cursor: pointer;
border-color: blue;
/* -webkit-box-shadow: aqua 0 0 8px;
-moz-box-shadow: aqua 0 0 8px;
-o-box-shadow: aqua 0 0 8px; */
box-shadow: aqua 0 0 8px;
} }
.fancybutton:active {
background: #39b2e5;
/* background: -webkit-gradient(linear, left bottom, left top, from(#39b2e5), to(#6083BF));
background: -moz-linear-gradient(bottom, #39b2e5, #6083BF);
background: -o-linear-gradient(bottom, #39b2e5, #6083BF); */
background: linear-gradient(bottom, #39b2e5, #6083BF);
}
/* For the Scan upload form - to be used with a phone */
::-webkit-file-upload-button {
padding: 0.3em;
font: 18px Georgia, "Times New Roman", Times, serif;
width:55%;
margin-left:20px;
margin-right:20px;
margin-top:5px;
margin-bottom: 5px;
}
/*The below are stolen from django admin css*/ /*The below are stolen from django admin css*/
.addlink { .addlink {
background:transparent url("../icon_addlink.gif") no-repeat scroll 0 0.2em; background:transparent url("../icon_addlink.gif") no-repeat scroll 0 0.2em;

View File

@ -4,7 +4,7 @@
{% block content %} {% block content %}
<h2>Scanned notes or survey upload into wallet </h2> <h2>Upload scan into wallet {{wallet}}</h2>
<p style="font-family: monospace; font-weight: bold; font-size: 130%; text-align: center"> <p style="font-family: monospace; font-weight: bold; font-size: 130%; text-align: center">
<a style="font-weight: normal;" href="/scanupload/{{prevy}}:01">{{prevy}}</a> <a style="font-weight: normal;" href="/scanupload/{{prevy}}:01">{{prevy}}</a>
&nbsp;...&nbsp; &nbsp;...&nbsp;
@ -15,39 +15,34 @@
<a style="font-weight: normal;" href="/scanupload/{{nexty}}:01">{{nexty}}</a> <a style="font-weight: normal;" href="/scanupload/{{nexty}}:01">{{nexty}}</a>
</p> </p>
<div style = "max-width:35%; margin-left:20%; text-align: center; " >
<div style = "max-width:40%;">
<form method ='post' enctype ="multipart/form-data"> <form method ='post' enctype ="multipart/form-data">
{% csrf_token %} {% csrf_token %}
<br> <br>
<input type = "file" multiple="multiple" style = "margin-left:20%;" <input class="fancybutton" type = "file" multiple="multiple"
placeholder = "Scanfiles" name = "scanfiles" id="scanfiles"> placeholder = "Scanfiles" name = "scanfiles" id="scanfiles" />
<br> <br>
<input type = "text" size = "8" style = "margin-left:20%;"
placeholder = "Wallet id e.g. 2021#23" name = "title" value='{{wallet}}'id="wallet"><label for="wallet"> Wallet id</label>
<center> <br><br><br>
<button style = "color: #fff; border:1px; background-color:#999; margin-top:8%; <button class="fancybutton" style="padding: 0.5em 25px; margin-left: 155px" type = "submit" value = "Upload" >
height:35px; width:80%; margin-left:19%;" type = "submit" value = "Upload" > Upload
<strong>Upload</strong>
</button> </button>
</center>
</form> </form>
</div>
<div style = "max-width:29%; margin-left:20%; text-align: left" >
{% if filesaved %} {% if filesaved %}
<p style="margin-left:20%;"> <p>
<b>File(s) saved as <b>File(s) saved as <br>
{% for f in actual_saved %} {% for f in actual_saved %}
<em>'{{f}}'</em> <em>{{f}}</em> <br>
{% endfor %} {% endfor %}
<br><br>Upload more?</b> <br><br>Upload more?</b>
</p> </p>
<br> <br>
{% endif %} {% endif %}
</div>
<p style="margin-left:20%;"> <p>
{% for f in files %} {% for f in files %}
<a href="/expofiles/surveyscans/{{year}}/{{wallet|urlencode}}/{{f}}">{{ f}}</a><br /> <a href="/expofiles/surveyscans/{{year}}/{{wallet|urlencode}}/{{f}}">{{ f}}</a><br />
{% endfor %} {% endfor %}
</p> </p>
{% endblock %} </div> {% endblock %}