don't truncate news notes display
This commit is contained in:
parent
62366427fb
commit
b45d101657
10
news/news.go
10
news/news.go
|
@ -8,6 +8,8 @@ import (
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
"html/template"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type News struct {
|
type News struct {
|
||||||
|
@ -17,6 +19,7 @@ type News struct {
|
||||||
Category_id int
|
Category_id int
|
||||||
Date time.Time
|
Date time.Time
|
||||||
Notes string
|
Notes string
|
||||||
|
htmlNotes template.HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -138,6 +141,10 @@ func (news *News) Id() int {
|
||||||
return news.id
|
return news.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (news *News) HTMLNotes() template.HTML {
|
||||||
|
return news.htmlNotes
|
||||||
|
}
|
||||||
|
|
||||||
func nullStringToString(str *sql.NullString) string {
|
func nullStringToString(str *sql.NullString) string {
|
||||||
if str.Valid {
|
if str.Valid {
|
||||||
return str.String
|
return str.String
|
||||||
|
@ -182,6 +189,9 @@ func scanNews(rows *sql.Rows) (*News, error) {
|
||||||
news.Url = nullStringToString(&url)
|
news.Url = nullStringToString(&url)
|
||||||
news.Title = nullStringToString(&title)
|
news.Title = nullStringToString(&title)
|
||||||
news.Notes = nullStringToString(¬es)
|
news.Notes = nullStringToString(¬es)
|
||||||
|
// support wordpress style <quote> tags
|
||||||
|
news.Notes = strings.Replace(news.Notes, "quote>", "blockquote>", -1)
|
||||||
|
news.htmlNotes = template.HTML(news.Notes)
|
||||||
|
|
||||||
if category_id.Valid {
|
if category_id.Valid {
|
||||||
news.Category_id = int(category_id.Int64)
|
news.Category_id = int(category_id.Int64)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dballard/transmet/categories"
|
"github.com/dballard/transmet/categories"
|
||||||
"github.com/gorilla/csrf"
|
"github.com/gorilla/csrf"
|
||||||
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-2"> </div>
|
<div class="col-xs-2"> </div>
|
||||||
<div class="col-xs-8 post-preview">{{truncate .post.Notes 500}}</div>
|
<div class="col-xs-8 post-content"> {{ .post.HTMLNotes }}</div>
|
||||||
<div class="col-xs-2 post-delete">
|
<div class="col-xs-2 post-delete">
|
||||||
<form method="POST" action="/news/{{.post.Id}}/delete" class="confirm-news-delete">{{ .csrfField }}
|
<form method="POST" action="/news/{{.post.Id}}/delete" class="confirm-news-delete">{{ .csrfField }}
|
||||||
<input type="submit" class="btn btn-sm btn-block" value="Delete" />
|
<input type="submit" class="btn btn-sm btn-block" value="Delete" />
|
||||||
|
|
Loading…
Reference in New Issue