issue #64 completed for editor route

This commit is contained in:
Henrique Dias
2016-03-12 09:25:15 +00:00
parent 3fd60e487a
commit 3301b60485
7 changed files with 52 additions and 63 deletions

View File

@@ -28,7 +28,7 @@ type editor struct {
}
// GET handles the GET method on editor page
func GET(w http.ResponseWriter, r *http.Request, c *config.Config, filename string) (int, error) {
func GET(w http.ResponseWriter, r *http.Request) (int, error) {
// Check if the file format is supported. If not, send a "Not Acceptable"
// header and an error
if !templates.CanBeEdited(filename) {
@@ -55,8 +55,8 @@ func GET(w http.ResponseWriter, r *http.Request, c *config.Config, filename stri
// Create a new editor variable and set the extension
page := new(editor)
page.Mode = strings.TrimPrefix(filepath.Ext(filename), ".")
page.Name = strings.Replace(filename, c.Path, "", 1)
page.Config = c
page.Name = strings.Replace(filename, conf.Path, "", 1)
page.Config = conf
page.IsPost = false
// Sanitize the extension