Editor section to request location

This commit is contained in:
Jan-Lukas Else 2021-06-18 16:35:48 +02:00
parent 6e121347be
commit 878f3a52a9
6 changed files with 48 additions and 8 deletions

View File

@ -118,7 +118,7 @@ form {
.fw-form {
@extend .fw;
input:not([type]), input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea {
input:not([type]), input[type="submit"], input[type="button"], input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea {
@extend .fw;
}
}

View File

@ -163,7 +163,7 @@ footer * {
display: inline;
}
.fw, .fw-form, .fw-form input:not([type]), .fw-form input[type=text], .fw-form input[type=email], .fw-form input[type=url], .fw-form input[type=password], .fw-form textarea {
.fw, .fw-form, .fw-form input:not([type]), .fw-form input[type=submit], .fw-form input[type=button], .fw-form input[type=text], .fw-form input[type=email], .fw-form input[type=url], .fw-form input[type=password], .fw-form textarea {
width: 100%;
}

View File

@ -0,0 +1,26 @@
(function () {
let geoBtn = document.querySelector('#geobtn')
function geo() {
let status = document.querySelector('#geostatus')
status.classList.add('hide')
status.value = ''
function success(position) {
let latitude = position.coords.latitude
let longitude = position.coords.longitude
status.value = `geo:${latitude},${longitude}`
status.classList.remove('hide')
}
function error() {
alert(geoBtn.dataset.failed)
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success, error)
} else {
alert(geoBtn.dataset.notsupported)
}
}
geoBtn.addEventListener('click', geo)
})()

View File

@ -18,7 +18,7 @@ tags:
-
---
</textarea>
<input class="fw" type="submit" value="{{ string .Blog.Lang "create" }}">
<input type="submit" value="{{ string .Blog.Lang "create" }}">
</form>
<h2 id="update">{{ string .Blog.Lang "update" }}</h2>
<form class="fw-form p" method="post" action="#update">
@ -30,25 +30,25 @@ tags:
<input type="hidden" name="editoraction" value="loadupdate">
<input type="url" name="url" placeholder="URL">
{{ end }}
<input class="fw" type="submit" value="{{ string .Blog.Lang "update" }}">
<input type="submit" value="{{ string .Blog.Lang "update" }}">
</form>
<h2 id="delete">{{ string .Blog.Lang "delete" }}</h2>
<form class="fw-form p" method="post" action="#delete">
{{ if .Data.DeleteURL }}
<input type="hidden" name="action" value="delete">
<input type="url" name="url" placeholder="URL" value="{{ .Data.DeleteURL }}">
<input class="fw" type="submit" value="{{ string .Blog.Lang "confirmdelete" }}">
<input type="submit" value="{{ string .Blog.Lang "confirmdelete" }}">
{{ else }}
<input type="hidden" name="editoraction" value="loaddelete">
<input type="url" name="url" placeholder="URL">
<input class="fw" type="submit" value="{{ string .Blog.Lang "delete" }}">
<input type="submit" value="{{ string .Blog.Lang "delete" }}">
{{ end }}
</form>
<h2>{{ string .Blog.Lang "upload" }}</h2>
<form class="fw-form p" method="post" enctype="multipart/form-data">
<input type="hidden" name="editoraction" value="upload">
<input class="fw" type="file" name="file">
<input class="fw" type="submit" value="{{ string .Blog.Lang "upload" }}">
<input type="submit" value="{{ string .Blog.Lang "upload" }}">
</form>
<h2>{{ string .Blog.Lang "drafts" }}</h2>
<form class="fw-form p" method="post">
@ -58,8 +58,14 @@ tags:
<option value="{{ absolute $draft.Path }}">{{ with ($draft.Title) }}{{ . }}{{ else }}{{ $draft.Path }}{{ end }}</option>
{{ end }}
</select>
<input class="fw" type="submit" value="{{ string .Blog.Lang "update" }}">
<input type="submit" value="{{ string .Blog.Lang "update" }}">
</form>
<h2>{{ string .Blog.Lang "location" }}</h2>
<form class="fw-form p">
<input id="geobtn" type="button" class="fw" value="{{ string .Blog.Lang "locationget" }}" data-failed="{{ string .Blog.Lang "locationfailed" }}" data-notsupported="{{ string .Blog.Lang "locationnotsupported" }}">
<input id="geostatus" type="text" class="hide" readonly>
</form>
<script defer src="{{ asset "js/geohelper.js" }}"></script>
<script defer src="{{ asset "js/formcache.js" }}"></script>
</main>
{{ end }}

View File

@ -15,6 +15,10 @@ interactions: "Interaktionen & Kommentare"
interactionslabel: "Hast du eine Antwort hierzu veröffentlicht? Füge hier die URL ein."
likeof: "Gefällt mir von"
loading: "Laden..."
location: "Standort"
locationfailed: "Abfragen des Standorts fehlgeschlagen"
locationget: "Standort abfragen"
locationnotsupported: "Die Standort-API wird von diesem Browser nicht unterstützt"
next: "Weiter"
noposts: "Hier sind keine Posts."
oldcontent: "⚠️ Dieser Eintrag ist bereits über ein Jahr alt. Er ist möglicherweise nicht mehr aktuell. Meinungen können sich geändert haben."

View File

@ -22,6 +22,10 @@ interactions: "Interactions & Comments"
interactionslabel: "Have you published a response to this? Paste the URL here."
likeof: "Like of"
loading: "Loading..."
location: "Location"
locationfailed: "Failed to request the location"
locationget: "Request location"
locationnotsupported: "The location API is not supported by this browser"
login: "Login"
logout: "Logout"
nameopt: "Name (optional)"