diff --git a/editor.go b/editor.go index b574dea9..cf9cd39d 100644 --- a/editor.go +++ b/editor.go @@ -125,10 +125,10 @@ func serveSingle(w http.ResponseWriter, r *http.Request, c *FileManager, u *User return http.StatusInternalServerError, err } - return p.PrintAsHTML(w, c, "frontmatter", "editor") + return p.PrintAsHTML(w, c.assets.templates, "frontmatter", "editor") } - return p.PrintAsHTML(w, c, "single") + return p.PrintAsHTML(w, c.assets.templates, "single") } func editorClass(mode string) string { diff --git a/http_listing.go b/http_listing.go index 4e79eabd..69192caf 100644 --- a/http_listing.go +++ b/http_listing.go @@ -90,7 +90,7 @@ func serveListing(w http.ResponseWriter, r *http.Request, c *FileManager, u *Use Data: listing, } - return p.PrintAsHTML(w, c, "listing") + return p.PrintAsHTML(w, c.assets.templates, "listing") } // handleSortOrder gets and stores for a Listing the 'sort' and 'order', diff --git a/page.go b/page.go index 22a0beae..df0817e6 100644 --- a/page.go +++ b/page.go @@ -9,6 +9,7 @@ import ( "net/http" "strings" + rice "github.com/GeertJohan/go.rice" "github.com/hacdias/filemanager/variables" ) @@ -102,7 +103,7 @@ func (p page) PreviousLink() string { } // PrintAsHTML formats the page in HTML and executes the template -func (p page) PrintAsHTML(w http.ResponseWriter, m *FileManager, templates ...string) (int, error) { +func (p page) PrintAsHTML(w http.ResponseWriter, box *rice.Box, templates ...string) (int, error) { templates = append(templates, "actions") templates = append(templates, "templates") @@ -117,7 +118,7 @@ func (p page) PrintAsHTML(w http.ResponseWriter, m *FileManager, templates ...st // For each template, add it to the the tpl variable for i, t := range templates { // Get the template from the assets - Page, err := m.assets.templates.String(t + ".tmpl") + Page, err := box.String(t + ".tmpl") // Check if there is some error. If so, the template doesn't exist if err != nil {