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)
|
http.Error(w, "GPS field cannot be empty", http.StatusBadRequest)
|
||||||
return
|
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 {
|
if err != nil {
|
||||||
http.Error(w, "Database error", http.StatusInternalServerError)
|
http.Error(w, "Database error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -19,14 +19,16 @@
|
|||||||
{{range .}}
|
{{range .}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{.ID}}</td>
|
<td>{{.ID}}</td>
|
||||||
<td>
|
<form action="/admin/positions" method="post">
|
||||||
<form action="/admin/positions" method="post">
|
<input type="hidden" name="update" value="{{.ID}}">
|
||||||
|
<td>
|
||||||
<input type="text" name="gps" value="{{.GPS}}">
|
<input type="text" name="gps" value="{{.GPS}}">
|
||||||
<input type="hidden" name="update" value="{{.ID}}">
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="clue" value="{{.Clue}}">
|
||||||
<input type="submit" value="Upravit">
|
<input type="submit" value="Upravit">
|
||||||
</form>
|
</td>
|
||||||
</td>
|
</form>
|
||||||
<td>{{.Clue}}</td>
|
|
||||||
<td><a href="{{.URL}}">{{.URL}}</a></td>
|
<td><a href="{{.URL}}">{{.URL}}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<form action="/admin/positions" method="post">
|
<form action="/admin/positions" method="post">
|
||||||
|
|||||||
Reference in New Issue
Block a user