uprava i napovedy u pozice
This commit is contained in:
7
admin.go
7
admin.go
@@ -495,7 +495,12 @@ func AdminPositionsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "GPS field cannot be empty", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
_, err := db.Exec("UPDATE positions SET gps = ? WHERE id = ?", gps, positionID)
|
||||
clue := r.FormValue("clue")
|
||||
if clue == "" {
|
||||
http.Error(w, "Clue field cannot be empty", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
_, err := db.Exec("UPDATE positions SET gps = ?, clue = ? WHERE id = ?", gps, clue, positionID)
|
||||
if err != nil {
|
||||
http.Error(w, "Database error", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
@@ -19,14 +19,16 @@
|
||||
{{range .}}
|
||||
<tr>
|
||||
<td>{{.ID}}</td>
|
||||
<td>
|
||||
<form action="/admin/positions" method="post">
|
||||
<input type="text" name="gps" value="{{.GPS}}">
|
||||
<input type="hidden" name="update" value="{{.ID}}">
|
||||
<input type="submit" value="Upravit">
|
||||
</form>
|
||||
<td>
|
||||
<input type="text" name="gps" value="{{.GPS}}">
|
||||
</td>
|
||||
<td>{{.Clue}}</td>
|
||||
<td>
|
||||
<input type="text" name="clue" value="{{.Clue}}">
|
||||
<input type="submit" value="Upravit">
|
||||
</td>
|
||||
</form>
|
||||
<td><a href="{{.URL}}">{{.URL}}</a></td>
|
||||
<td>
|
||||
<form action="/admin/positions" method="post">
|
||||
|
||||
Reference in New Issue
Block a user