Skip to content

Commit e0712f5

Browse files
committed
changed template file extension to .html
1 parent 285525b commit e0712f5

File tree

9 files changed

+152
-144
lines changed

9 files changed

+152
-144
lines changed

handlers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
3636
res := TemplateResponse{Talks: talks, Week: week, HumanWeek: human, NextWeek: addWeek(week), PrevWeek: subtractWeek(week)}
3737

3838
// Render the template
39-
err := tmpls.ExecuteTemplate(w, "future.gohtml", res)
39+
err := tmpls.ExecuteTemplate(w, "future.html", res)
4040
if err != nil {
4141
log.Println("[WARN] Failed to render template:", err)
4242
}
@@ -61,10 +61,10 @@ func weekHandler(w http.ResponseWriter, r *http.Request) {
6161
// Render the template
6262
if isPast(nextWednesday(), week) {
6363
res.Talks = talks.AllTalks(week)
64-
err = tmpls.ExecuteTemplate(w, "past.gohtml", res)
64+
err = tmpls.ExecuteTemplate(w, "past.html", res)
6565
} else {
6666
res.Talks = talks.VisibleTalks(week)
67-
err = tmpls.ExecuteTemplate(w, "future.gohtml", res)
67+
err = tmpls.ExecuteTemplate(w, "future.html", res)
6868
}
6969

7070
if err != nil {
@@ -215,7 +215,7 @@ func markdownFactory(post string) func(http.ResponseWriter, *http.Request) {
215215
buff := bytes.NewBuffer(nil)
216216

217217
// Render the markdown
218-
err = tmpls.ExecuteTemplate(buff, "markdown.gohtml", Post{
218+
err = tmpls.ExecuteTemplate(buff, "markdown.html", Post{
219219
Title: post,
220220
Content: string(content),
221221
})

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func main() {
7878
log.Println("[INFO] Loaded", len(talks.talks), "talks")
7979

8080
// Load templates and add markdown function
81-
tmpls = template.Must(template.New("").Funcs(template.FuncMap{"safe_markdown": markDownerSafe, "unsafe_markdown": markDownerUnsafe}).ParseGlob("templates/*.gohtml"))
81+
tmpls = template.Must(template.New("").Funcs(template.FuncMap{"safe_markdown": markDownerSafe, "unsafe_markdown": markDownerUnsafe}).ParseGlob("templates/*.html"))
8282

8383
if err != nil {
8484
log.Fatalln("[ERROR] Failed to compile some template(s)", err)

templates/footer.gohtml

Lines changed: 0 additions & 5 deletions
This file was deleted.

templates/footer.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<footer>
2+
<b>
3+
<a href="/">Home</a> ---
4+
<a href="https://github.com/COSI-Lab/go-talks">Github Repository</a> ---
5+
<a href="/usage">Formatting</a>
6+
</b>
7+
</footer>

templates/future.gohtml

Lines changed: 0 additions & 73 deletions
This file was deleted.

templates/future.html

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Talks</title>
5+
<link rel="stylesheet" type="text/css" href="static/style.css" />
6+
<script>
7+
const week = {{ .Week }};
8+
const past = false;
9+
</script>
10+
<script type="text/javascript" src="static/site.js"></script>
11+
</head>
12+
13+
<body>
14+
<div class="header">
15+
<h1 class="talks"><a class="talks" href="/"> Talks </a></h1>
16+
<h3 class="talks">
17+
Upcoming Events For The Clarkson Open Source Institute Meetings
18+
</h3>
19+
<div class="week">
20+
<a class="grow" href="/{{.PrevWeek}}"> ⬅️ </a>
21+
<span class="grow"> Wed. {{.HumanWeek}} at 7pm </span>
22+
<a class="grow" href="/{{.NextWeek}}"> ➡️ </a>
23+
</div>
24+
</div>
25+
<br />
26+
<table class="content" id="table">
27+
<thead>
28+
<tr>
29+
<th style="display: none"></th>
30+
<th>Talk Presenter</th>
31+
<th>Type</th>
32+
<th>Description</th>
33+
<th></th>
34+
</tr>
35+
</thead>
36+
37+
<tbody id="tb">
38+
{{ range .Talks }}
39+
<tr class="event">
40+
<td style="display: none">{{.ID}}</td>
41+
<td class="name">{{.Name}}</td>
42+
<td class="type">{{.Type}}</td>
43+
<td class="description markdown">{{.Description | safe_markdown}}</td>
44+
<td class="actions">
45+
<button onclick="hide( {{ .ID }} )">x</button>
46+
</td>
47+
</tr>
48+
{{ end }}
49+
<tr>
50+
<th>
51+
<input
52+
id="name"
53+
type="text"
54+
placeholder="Name"
55+
value=""
56+
autocomplete="off"
57+
/>
58+
</th>
59+
<th>
60+
<select id="type">
61+
<option value="0">Forum Topic</option>
62+
<option value="1">Lightning Talk</option>
63+
<option value="2">Project Update</option>
64+
<option value="3">Announcement</option>
65+
<option value="4">After-Meeting Slot</option>
66+
</select>
67+
</th>
68+
<th>
69+
<textarea id="description" autocomplete="off" rows="1"></textarea>
70+
</th>
71+
<th>
72+
<button id="create" onclick="create()">create</button>
73+
</th>
74+
</tr>
75+
</tbody>
76+
</table>
77+
{{ template "footer.html" . }}
78+
</body>
79+
</html>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<!DOCTYPE html>
22
<html>
3-
4-
<head>
3+
<head>
54
<title>Talks - {{.Title}}</title>
6-
<link rel="stylesheet" type="text/css" href="static/style.css">
7-
</head>
5+
<link rel="stylesheet" type="text/css" href="static/style.css" />
6+
</head>
87

9-
<body>
8+
<body>
109
<div class="header">
11-
<h1 class="talks"><a class="talks" href="/"> Talks </a> </h1>
10+
<h1 class="talks"><a class="talks" href="/"> Talks </a></h1>
1211
</div>
1312
<div class="post markdown">{{.Content | unsafe_markdown}}</div>
14-
{{ template "footer.gohtml" . }}
15-
</body>
13+
{{ template "footer.html" . }}
14+
</body>
15+
</html>

templates/past.gohtml

Lines changed: 0 additions & 53 deletions
This file was deleted.

templates/past.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Talks</title>
5+
<link rel="stylesheet" type="text/css" href="static/style.css" />
6+
<script>
7+
const week = {{ .Week }};
8+
const past = true;
9+
</script>
10+
<script type="text/javascript" src="static/site.js"></script>
11+
</head>
12+
13+
<body>
14+
<div class="header">
15+
<h1 class="talks"><a class="talks" href="/"> Talks </a></h1>
16+
<h3 class="talks">
17+
Upcoming Events For The Clarkson Open Source Institute Meetings
18+
</h3>
19+
<div class="week">
20+
<a class="grow" href="/{{.PrevWeek}}"> ⬅️ </a>
21+
<span class="grow"> Wed. {{.HumanWeek}} at 7pm </span>
22+
<a class="grow" href="/{{.NextWeek}}"> ➡️ </a>
23+
</div>
24+
</div>
25+
<br />
26+
<table class="content" id="table">
27+
<thead>
28+
<tr>
29+
<th style="display: none"></th>
30+
<th>Talk Presenter</th>
31+
<th>Type</th>
32+
<th>Description</th>
33+
<th></th>
34+
</tr>
35+
</thead>
36+
37+
<tbody id="tb">
38+
{{ range .Talks }}
39+
<tr class="event">
40+
<td style="display: none">{{.ID}}</td>
41+
<td class="name">{{.Name}}</td>
42+
<td class="type">{{.Type}}</td>
43+
<td class="description markdown">{{.Description | safe_markdown}}</td>
44+
<td class="actions">
45+
<button onclick="del( {{ .ID }} )">x</button>
46+
</td>
47+
</tr>
48+
{{ end }}
49+
</tbody>
50+
</table>
51+
{{ template "footer.html" . }}
52+
</body>
53+
</html>

0 commit comments

Comments
 (0)