mirror of
https://github.com/documize/community.git
synced 2025-08-07 14:35:28 +02:00
report when smart-sections are not found
This commit is contained in:
parent
49d54d513f
commit
0616ba42d6
3 changed files with 22 additions and 6 deletions
|
@ -79,7 +79,11 @@ func AddDocumentPage(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
p.Context.Transaction = tx
|
||||
|
||||
output, _ := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody)
|
||||
output, ok := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody)
|
||||
if !ok {
|
||||
log.ErrorString("section.Render could not find: " + model.Page.ContentType)
|
||||
}
|
||||
|
||||
model.Page.Body = output
|
||||
|
||||
err = p.AddPage(*model)
|
||||
|
@ -418,7 +422,10 @@ func UpdateDocumentPage(w http.ResponseWriter, r *http.Request) {
|
|||
model.Page.SetDefaults()
|
||||
model.Meta.SetDefaults()
|
||||
|
||||
output, _ := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody)
|
||||
output, ok := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody)
|
||||
if !ok {
|
||||
log.ErrorString("section.Render could not find: " + model.Page.ContentType)
|
||||
}
|
||||
model.Page.Body = output
|
||||
|
||||
p.Context.Transaction = tx
|
||||
|
|
|
@ -59,7 +59,10 @@ func RunSectionCommand(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
section.Command(sectionName, w, r)
|
||||
if !section.Command(sectionName, w, r) {
|
||||
log.ErrorString("Unable to run section.Command() for: " + sectionName)
|
||||
writeNotFoundError(w, "RunSectionCommand", sectionName)
|
||||
}
|
||||
}
|
||||
|
||||
// RefreshSections updates document sections where the data
|
||||
|
@ -112,10 +115,16 @@ func RefreshSections(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
// Ask for data refresh
|
||||
data, _ := section.Refresh(page.ContentType, pm.Config, pm.RawBody)
|
||||
data, ok := section.Refresh(page.ContentType, pm.Config, pm.RawBody)
|
||||
if !ok {
|
||||
log.ErrorString("section.Refresh could not find: " + page.ContentType)
|
||||
}
|
||||
|
||||
// Render again
|
||||
body, _ := section.Render(page.ContentType, pm.Config, data)
|
||||
body, ok := section.Render(page.ContentType, pm.Config, data)
|
||||
if !ok {
|
||||
log.ErrorString("section.Render could not find: " + page.ContentType)
|
||||
}
|
||||
|
||||
// Compare to stored render
|
||||
if body != page.Body {
|
||||
|
|
|
@ -48,7 +48,7 @@ func Command(section string, w http.ResponseWriter, r *http.Request) bool {
|
|||
if ok {
|
||||
s.Command(w, r)
|
||||
}
|
||||
return false
|
||||
return ok
|
||||
}
|
||||
|
||||
// Render runs that operation for the given section id, the returned bool indicates success.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue