diff --git a/templates/comments.html b/templates/comments.html new file mode 100644 index 0000000..37e2af7 --- /dev/null +++ b/templates/comments.html @@ -0,0 +1,25 @@ +
+ + Show {{ (len .Comments) }} comments + +
+ {{ range $comment := .Comments }} +
+
+
+ {{ $comment.Text }} +
+
+ Commented {{ $comment.Timestamp }} by + {{ $comment.AuthorName }}. +
+
+
+ {{end}} +
+
diff --git a/templates/question.html b/templates/question.html index ac498f4..8360c23 100644 --- a/templates/question.html +++ b/templates/question.html @@ -47,31 +47,7 @@
{{ .question.Body }}
{{ if .question.Comments }} -
- - Show {{ (len .question.Comments) }} comments - -
- {{ range $comment := .question.Comments }} -
-
-
- {{ $comment.Text }} -
-
- Commented {{ $comment.Timestamp }} by - {{ $comment.AuthorName }}. -
-
-
- {{end}} -
-
+ {{ template "comments.html" .question }} {{end}} @@ -98,31 +74,7 @@ {{ if $answer.Comments }} -
- - Show {{ (len $answer.Comments) }} comments - -
- {{ range $comment := $answer.Comments }} -
-
-
- {{ $comment.Text }} -
-
- Commented {{ $comment.Timestamp }} by - {{ $comment.AuthorName }}. -
-
-
- {{end}} -
-
+ {{ template "comments.html" $answer }} {{end}}