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.
This commit is contained in:
parent
eb049790c3
commit
199f97c7b6
26
routes.go
26
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 {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -39,12 +39,24 @@
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.container{
|
||||
max-width: 800px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Fixed navbar -->
|
||||
<nav class="navbar navbar-default navbar-fixed-bottom">
|
||||
<div class="container">
|
||||
@ -68,6 +80,9 @@
|
||||
<li><a href="/{{ $.Title }}?version={{ .VersionNum }}">{{ .VersionDate }}</a></li>
|
||||
{{ end }}
|
||||
<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>
|
||||
</li>
|
||||
<li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li>
|
||||
@ -79,6 +94,7 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<form action='#' id="emit" method="post" name="emit">
|
||||
|
||||
<div>
|
||||
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user