Page render html takes only the neccessary arguments
Former-commit-id: 430478c3f2c79b66612a694e93519004d0301c43 [formerly 3b8626ea2747caca09046d3b51bf4695dc9262ee] [formerly 6e380fdbb14c16433118e5f721ccf6fd394d820d [formerly 3b3643be0557cacd84db5c6684d938c92d0825cc]] Former-commit-id: 885786dd7846946f1b277ae599678c5154b360cc [formerly 0a588d179d42c51866bf15c879c5c746c5357b69] Former-commit-id: dd52d340773b8fec2d3bc3f54da15d8a9434c1e0
This commit is contained in:
parent
9d8928362d
commit
a3941facd9
|
@ -125,10 +125,10 @@ func serveSingle(w http.ResponseWriter, r *http.Request, c *FileManager, u *User
|
||||||
return http.StatusInternalServerError, err
|
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 {
|
func editorClass(mode string) string {
|
||||||
|
|
|
@ -90,7 +90,7 @@ func serveListing(w http.ResponseWriter, r *http.Request, c *FileManager, u *Use
|
||||||
Data: listing,
|
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',
|
// handleSortOrder gets and stores for a Listing the 'sort' and 'order',
|
||||||
|
|
5
page.go
5
page.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
rice "github.com/GeertJohan/go.rice"
|
||||||
"github.com/hacdias/filemanager/variables"
|
"github.com/hacdias/filemanager/variables"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ func (p page) PreviousLink() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrintAsHTML formats the page in HTML and executes the template
|
// 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, "actions")
|
||||||
templates = append(templates, "templates")
|
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 each template, add it to the the tpl variable
|
||||||
for i, t := range templates {
|
for i, t := range templates {
|
||||||
// Get the template from the assets
|
// 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
|
// Check if there is some error. If so, the template doesn't exist
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue