Register f.ArticlePreviewHtmlData in init()
This commit is contained in:
		@@ -16,6 +16,12 @@ import (
 | 
				
			|||||||
	b "streifling.com/jason/cpolis/cmd/backend"
 | 
						b "streifling.com/jason/cpolis/cmd/backend"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type ArticlePreviewHtmlData struct {
 | 
				
			||||||
 | 
						Title       string
 | 
				
			||||||
 | 
						Description string
 | 
				
			||||||
 | 
						Content     template.HTML
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func ShowHub(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
 | 
					func ShowHub(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
 | 
				
			||||||
	return func(w http.ResponseWriter, r *http.Request) {
 | 
						return func(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
		session, err := s.Get(r, "cookie")
 | 
							session, err := s.Get(r, "cookie")
 | 
				
			||||||
@@ -442,14 +448,8 @@ func UploadImage(c *b.Config) http.HandlerFunc {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func PreviewArticle(c *b.Config, s *b.CookieStore) http.HandlerFunc {
 | 
					func PreviewArticle(c *b.Config, s *b.CookieStore) http.HandlerFunc {
 | 
				
			||||||
	return func(w http.ResponseWriter, r *http.Request) {
 | 
						return func(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
		type htmlData struct {
 | 
					 | 
				
			||||||
			Title       string
 | 
					 | 
				
			||||||
			Description string
 | 
					 | 
				
			||||||
			Content     template.HTML
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		var err error
 | 
							var err error
 | 
				
			||||||
		data := new(htmlData)
 | 
							data := new(ArticlePreviewHtmlData)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		data.Title, err = b.ConvertToPlain(r.PostFormValue("article-title"))
 | 
							data.Title, err = b.ConvertToPlain(r.PostFormValue("article-title"))
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,6 +12,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	gob.Register(b.User{})
 | 
						gob.Register(b.User{})
 | 
				
			||||||
 | 
						gob.Register(f.ArticlePreviewHtmlData{})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user