|
|
@ -11,12 +11,13 @@ |
|
|
|
package writefreely |
|
|
|
package writefreely |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
|
|
|
|
"net/http" |
|
|
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gorilla/mux" |
|
|
|
"github.com/gorilla/mux" |
|
|
|
"github.com/writeas/impart" |
|
|
|
"github.com/writeas/impart" |
|
|
|
"github.com/writeas/web-core/log" |
|
|
|
"github.com/writeas/web-core/log" |
|
|
|
"github.com/writeas/writefreely/page" |
|
|
|
"github.com/writeas/writefreely/page" |
|
|
|
"net/http" |
|
|
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func handleViewPad(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
func handleViewPad(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
@ -54,16 +55,13 @@ func handleViewPad(app *App, w http.ResponseWriter, r *http.Request) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
padTmpl := app.cfg.App.Editor |
|
|
|
padTmpl := app.cfg.App.Editor |
|
|
|
if padTmpl == "" { |
|
|
|
if templates[padTmpl] == nil { |
|
|
|
|
|
|
|
log.Info("No template '%s' found. Falling back to default 'pad' template.", padTmpl) |
|
|
|
padTmpl = "pad" |
|
|
|
padTmpl = "pad" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if action == "" && slug == "" { |
|
|
|
if action == "" && slug == "" { |
|
|
|
// Not editing any post; simply render the Pad
|
|
|
|
// Not editing any post; simply render the Pad
|
|
|
|
if templates[padTmpl] == nil { |
|
|
|
|
|
|
|
log.Info("No template '%s' found. Falling back to default 'pad' template.", padTmpl) |
|
|
|
|
|
|
|
padTmpl = "pad" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if err = templates[padTmpl].ExecuteTemplate(w, "pad", appData); err != nil { |
|
|
|
if err = templates[padTmpl].ExecuteTemplate(w, "pad", appData); err != nil { |
|
|
|
log.Error("Unable to execute template: %v", err) |
|
|
|
log.Error("Unable to execute template: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|