1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Anyone can erase now.

Made navbar max 800px like text areas.


Former-commit-id: 6cdd9322831d5b32016baef407895b89135bfe48 [formerly a3d2cf57c314d5b05037e16deb3e2ae187df3334] [formerly 3c9ca7015eda64bdd8ed2bb1d773b3e9eee54a4f [formerly 6101e5ded83e0082ad2de3c1f239c8f1c59ff7aa [formerly 199f97c7b6]]]
Former-commit-id: 611575edf53a1ab832893cf0aac22df702a3a983 [formerly 58bdafbb39ccb690969651fb612b25dcb0b11ab3]
Former-commit-id: c7f61ac6fafdff55cc66389b07b61929491f6f56
Former-commit-id: bc83b6a7e1
This commit is contained in:
Zack Scholl 2016-02-14 07:50:38 -05:00
parent ba45d14253
commit 884b19e536
3 changed files with 57 additions and 13 deletions

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"html/template" "html/template"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
@ -9,7 +10,6 @@ import (
"strconv" "strconv"
"strings" "strings"
"time" "time"
"fmt"
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -257,17 +257,19 @@ func deleteListItem(c *gin.Context) {
func deletePage(c *gin.Context) { func deletePage(c *gin.Context) {
deleteName := c.DefaultQuery("DeleteName", "None") deleteName := c.DefaultQuery("DeleteName", "None")
adminKey := c.DefaultQuery("AdminKey", "None") adminKey := c.DefaultQuery("AdminKey", "None")
if adminKey == RuntimeArgs.AdminKey { fmt.Println(adminKey)
p := WikiData{deleteName, "", []string{}, []string{}} fmt.Println(deleteName)
// if adminKey == RuntimeArgs.AdminKey || true == true {
p := WikiData{strings.ToLower(deleteName), "", []string{}, []string{}}
p.save("") p.save("")
c.JSON(200, gin.H{ c.JSON(200, gin.H{
"message": "Done.", "message": "Done.",
}) })
} else { // } else {
c.JSON(404, gin.H{ // c.JSON(404, gin.H{
"message": "?", // "message": "?",
}) // })
} // }
} }
func listEverything() string { func listEverything() string {

View File

@ -301,6 +301,13 @@ padding: 0.4em 1em 6em;
background: #fff; background: #fff;
} }
.yue { .yue {
max-width: 700px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
} }
@media (min-width: 1200px) {
.container{
max-width: 800px;
}
}

View File

@ -39,12 +39,24 @@
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
} }
@media (min-width: 1200px) {
.container{
max-width: 800px;
}
}
</style> </style>
</head> </head>
<body> <body>
<!-- Fixed navbar --> <!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-bottom"> <nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container"> <div class="container">
@ -68,6 +80,9 @@
<li><a href="/{{ $.Title }}?version={{ .VersionNum }}">{{ .VersionDate }}</a></li> <li><a href="/{{ $.Title }}?version={{ .VersionNum }}">{{ .VersionDate }}</a></li>
{{ end }} {{ end }}
<li><a href="/{{ .Title }}">Current</a></li> <li><a href="/{{ .Title }}">Current</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Options</li>
<li><a href="#" id="{{ .Title }}" class="deleteable">Erase</a></li>
</ul> </ul>
</li> </li>
<li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li> <li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li>
@ -79,6 +94,7 @@
</div> </div>
</nav> </nav>
<form action='#' id="emit" method="post" name="emit"> <form action='#' id="emit" method="post" name="emit">
<div> <div>
@ -104,6 +120,25 @@
window.location = "/{{ .Title }}/list"; 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);
}
});
});
</script> </script>