Added support for versions, made slightly prettier
This commit is contained in:
parent
b0d5b191ce
commit
2210185f33
2
main.go
2
main.go
|
@ -491,7 +491,7 @@ func Main(information library.ServiceInitializationInformation) *chi.Mux {
|
||||||
|
|
||||||
router.Get("/api/rfc/list", func(w http.ResponseWriter, r *http.Request) {
|
router.Get("/api/rfc/list", func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Get the list of RFCs
|
// Get the list of RFCs
|
||||||
rows, err := conn.DB.Query("SELECT name, id, year, version FROM rfc")
|
rows, err := conn.DB.Query("SELECT name, id, year, version FROM rfc ORDER BY year DESC, id DESC")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
renderJSON(500, w, map[string]interface{}{"error": "Internal server error", "code": "01"}, information)
|
renderJSON(500, w, map[string]interface{}{"error": "Internal server error", "code": "01"}, information)
|
||||||
return
|
return
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<input type="text" id="rfcTitle" placeholder="Title">
|
<input type="text" id="rfcTitle" placeholder="Title">
|
||||||
<input type="text" id="rfcYear" placeholder="Year">
|
<input type="text" id="rfcYear" placeholder="Year">
|
||||||
<input type="text" id="rfcId" placeholder="ID">
|
<input type="text" id="rfcId" placeholder="ID">
|
||||||
|
<input type="text" id="rfcVersion" placeholder="Version">
|
||||||
<textarea id="rfcText"></textarea>
|
<textarea id="rfcText"></textarea>
|
||||||
<button id="submitRfc">Submit</button>
|
<button id="submitRfc">Submit</button>
|
||||||
<h2>Remove an RFC</h2>
|
<h2>Remove an RFC</h2>
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
const year = document.getElementById("rfcYear").value;
|
const year = document.getElementById("rfcYear").value;
|
||||||
const id = document.getElementById("rfcId").value;
|
const id = document.getElementById("rfcId").value;
|
||||||
const text = document.getElementById("rfcText").value;
|
const text = document.getElementById("rfcText").value;
|
||||||
|
const version = document.getElementById("rfcVersion").value;
|
||||||
fetch("/api/rfc/add", {
|
fetch("/api/rfc/add", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -35,7 +37,7 @@
|
||||||
name: title,
|
name: title,
|
||||||
year: parseInt(year),
|
year: parseInt(year),
|
||||||
id: parseInt(id),
|
id: parseInt(id),
|
||||||
version: "1.0.0",
|
version: version,
|
||||||
content: text,
|
content: text,
|
||||||
token: localStorage.getItem("SECRET-token")
|
token: localStorage.getItem("SECRET-token")
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
height: 50px;
|
height: 50px;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#rfcList button:hover {
|
#rfcList button:hover {
|
||||||
|
|
Loading…
Reference in New Issue