From 3393db0fbc69556ad09a18b840b6cf10eaf4f52c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 1 May 2021 18:35:08 +0100 Subject: [PATCH] Bigger buttons, phone compatible --- core/views/other.py | 12 +++--- media/css/trog3.css | 73 ++++++++++++++++++++++++++++++++--- templates/scanuploadform.html | 37 ++++++++---------- 3 files changed, 90 insertions(+), 32 deletions(-) diff --git a/core/views/other.py b/core/views/other.py index 0d096f2..c7d7eda 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -200,8 +200,7 @@ def ajax_test(request): -class MyForm(forms.Form): # not a model-form - title = forms.CharField(max_length=20) +class MyForm(forms.Form): # not a model-form, just a form-form scanfiles = forms.FileField() @login_required_if_public @@ -218,8 +217,13 @@ def scanupload(request, wallet=None): wallet = "2021:01" # improve this later year = wallet[:4] + if int(year) < 1977: + year = "1977" + if int(year) > 2050: + year = "2050" nexty = f'{int(year)+1}' prevy = f'{int(year)-1}' + wnumber = wallet[5:] next = f'{int(wnumber)+1:02d}' prev = f'{int(wnumber)-1:02d}' @@ -235,11 +239,9 @@ def scanupload(request, wallet=None): if request.method == 'POST': form = MyForm(request.POST,request.FILES) if form.is_valid(): - #form.save() # comment out so nothing saved in MEDIA_ROOT/fileuploads f = request.FILES["scanfiles"] - w = request.POST["title"] 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 = [] if multiple: diff --git a/media/css/trog3.css b/media/css/trog3.css index ad33b47..a3e622a 100644 --- a/media/css/trog3.css +++ b/media/css/trog3.css @@ -171,6 +171,12 @@ hr{ div.centre img { vertical-align: middle; } h1 { text-align: center; font-size: 210%; display: inline;} +h1 { + margin-top:0; + margin-left:10px; + vertical-align:top; +} + h2 { } h3 { color: #000 text-align:left; Dborder-bottom:thin solid black; margin-bottom:1em; margin-top:1em; font-weight:bold} h4 { color: #0d664c; } @@ -344,12 +350,6 @@ body { } -h1 { - margin-top:0; - margin-left:10px; - vertical-align:top; -} - .rightMargin { position:absolute; @@ -428,8 +428,69 @@ div#difflistajax 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*/ .addlink { background:transparent url("../icon_addlink.gif") no-repeat scroll 0 0.2em; diff --git a/templates/scanuploadform.html b/templates/scanuploadform.html index 4beae89..af14fbd 100644 --- a/templates/scanuploadform.html +++ b/templates/scanuploadform.html @@ -4,7 +4,7 @@ {% block content %} -

Scanned notes or survey upload into wallet

+

Upload scan into wallet {{wallet}}

{{prevy}}  ...  @@ -15,39 +15,34 @@ {{nexty}}

- -
+
{% csrf_token %} -
- -

- - -
- -
+
+
{% if filesaved %} -

- File(s) saved as +

+ File(s) saved as
{% for f in actual_saved %} - '{{f}}' + {{f}}
{% endfor %}

Upload more?


{% endif %} -
-

+

{% for f in files %} {{ f}}
{% endfor %}

- {% endblock %} +
{% endblock %}