Add raw link

This commit is contained in:
Eliot Whalan 2016-06-23 19:10:36 +10:00
parent 1da1dfe53d
commit f447299214
2 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,10 @@
<div class="page-header"> <div class="page-header">
<h1>{{.Title}}</h1> <h1>{{.Title}}</h1>
</div> </div>
<div class="pull-right">
<button type="submit" href="{{.Link}}" class="btn btn-raised btn-primary">Raw<div class="ripple-container"></div></button>
</div>
<div class="well" style="padding-top: 10px;"> <div class="well" style="padding-top: 10px;">
<div class="form-group is-empty" style="margin-top: 0px;"> <div class="form-group is-empty" style="margin-top: 0px;">
<textarea class="form-control" rows="20" id="textArea">{{printf "%s" .Body}}</textarea> <textarea class="form-control" rows="20" id="textArea">{{printf "%s" .Body}}</textarea>

View File

@ -40,6 +40,7 @@ type Response struct {
type Page struct { type Page struct {
Title string Title string
Body []byte Body []byte
Link string
} }
func check(err error) { func check(err error) {
@ -228,6 +229,7 @@ func pasteHandler(w http.ResponseWriter, r *http.Request) {
p := &Page{ p := &Page{
Title: paste, Title: paste,
Body: []byte(s), Body: []byte(s),
Link: ADDRESS + "/raw/" + paste
} }
t, err := template.ParseFiles("assets/paste.html") t, err := template.ParseFiles("assets/paste.html")
if err != nil { if err != nil {