Commit 52122433 authored by Ronny Bangsund's avatar Ronny Bangsund

Bugfixes.

-Removed unused template generation
-Corrected variable showing languages
parent 9452ff16
......@@ -7,6 +7,9 @@
<body style="background-color:#A7DBFF;">
<div style="position:absolute; top:1%; left:2%; width:80%;">
<h1>{{.Sitename}}</h1>
{{if .View}}
<p>Moo!</p>
{{end}}
<form name="scrap" style="position:relative; left:-9px; top:0;" method="post" action="/submit">
<select name="expiry" style="position:relative; left:10px; top:0;">
<option value="burn" >Burn after reading</option>
......@@ -16,7 +19,7 @@
</select>
<select name="language" style="position:relative; left:10px; top:0;">
{{with .}}
{{range $k,$v := .Folders}}
{{range $k,$v := .Languages}}
<option value="{{$k}}">{{$v}}</option>
{{end}}
{{end}}
......
......@@ -11,10 +11,11 @@ type IndexPage struct {
Title string
Sitename string
Languages map[string]string
View bool
Content string
}
var indexTemplate, _ = template.ParseFiles("tpl/index.tpl")
var userTemplate, _ = template.ParseFiles("tpl/user.tpl")
var webserver *web.Server
......@@ -34,10 +35,19 @@ func get_index(ctx *web.Context, p string) {
ctx.SetHeader("Content-type", "text/html", true)
title := cfg.Main.Sitename
name := cfg.Main.Sitename
view := false
if p != "" {
ctx.WriteString("Posted:")
view = true
}
indexTemplate.Execute(ctx.ResponseWriter, &IndexPage{Title: title, Sitename: name, Languages: languages})
var content string
indexTemplate.Execute(ctx.ResponseWriter, &IndexPage{
Title: title,
Sitename: name,
Languages: languages,
View: view,
Content: content,
})
}
func post_scrap(ctx *web.Context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment