From bc83b6a7e13f6076665c9c120131b03ef64b6348 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 14 Feb 2016 07:50:38 -0500 Subject: [PATCH] Anyone can erase now. Made navbar max 800px like text areas. Former-commit-id: 6cdd9322831d5b32016baef407895b89135bfe48 [formerly a3d2cf57c314d5b05037e16deb3e2ae187df3334] [formerly 3c9ca7015eda64bdd8ed2bb1d773b3e9eee54a4f [formerly 199f97c7b66ab0e50b1f59294867a1863056cb78]] Former-commit-id: 611575edf53a1ab832893cf0aac22df702a3a983 [formerly 58bdafbb39ccb690969651fb612b25dcb0b11ab3] Former-commit-id: c7f61ac6fafdff55cc66389b07b61929491f6f56 --- routes.go | 26 ++++++++++++++------------ static/css/view.css | 9 ++++++++- templates/index.tmpl | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/routes.go b/routes.go index 18b5471..657513c 100644 --- a/routes.go +++ b/routes.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "html/template" "io/ioutil" "net/http" @@ -9,7 +10,6 @@ import ( "strconv" "strings" "time" - "fmt" "github.com/boltdb/bolt" "github.com/gin-gonic/gin" @@ -257,17 +257,19 @@ func deleteListItem(c *gin.Context) { func deletePage(c *gin.Context) { deleteName := c.DefaultQuery("DeleteName", "None") adminKey := c.DefaultQuery("AdminKey", "None") - if adminKey == RuntimeArgs.AdminKey { - p := WikiData{deleteName, "", []string{}, []string{}} - p.save("") - c.JSON(200, gin.H{ - "message": "Done.", - }) - } else { - c.JSON(404, gin.H{ - "message": "?", - }) - } + fmt.Println(adminKey) + fmt.Println(deleteName) + // if adminKey == RuntimeArgs.AdminKey || true == true { + p := WikiData{strings.ToLower(deleteName), "", []string{}, []string{}} + p.save("") + c.JSON(200, gin.H{ + "message": "Done.", + }) + // } else { + // c.JSON(404, gin.H{ + // "message": "?", + // }) + // } } func listEverything() string { diff --git a/static/css/view.css b/static/css/view.css index 5123018..c82a0bd 100644 --- a/static/css/view.css +++ b/static/css/view.css @@ -301,6 +301,13 @@ padding: 0.4em 1em 6em; background: #fff; } .yue { -max-width: 700px; +max-width: 800px; margin: 0 auto; } + + +@media (min-width: 1200px) { +.container{ + max-width: 800px; +} +} diff --git a/templates/index.tmpl b/templates/index.tmpl index da90a31..2e7298b 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -39,12 +39,24 @@ max-width: 800px; margin: 0 auto; } + + + @media (min-width: 1200px) { + .container{ + max-width: 800px; + } + } + + + + + +
@@ -104,6 +120,25 @@ window.location = "/{{ .Title }}/list"; } }); + + + $('.deleteable').click(function(event) { + event.preventDefault(); + var deleteName = $(this).attr('id') + var href = $(this).attr('href') + console.log(deleteName) + $.ajax({ + url: "/deletepage" + '?' + $.param({ + "DeleteName": deleteName, + "AdminKey": "none" + }), + type: 'DELETE', + success: function() { + window.location.reload(true); + } + }); + + });