mirror of
https://github.com/documize/community.git
synced 2025-08-10 07:55:25 +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
|
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
|
model.Page.Body = output
|
||||||
|
|
||||||
err = p.AddPage(*model)
|
err = p.AddPage(*model)
|
||||||
|
@ -418,7 +422,10 @@ func UpdateDocumentPage(w http.ResponseWriter, r *http.Request) {
|
||||||
model.Page.SetDefaults()
|
model.Page.SetDefaults()
|
||||||
model.Meta.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
|
model.Page.Body = output
|
||||||
|
|
||||||
p.Context.Transaction = tx
|
p.Context.Transaction = tx
|
||||||
|
|
|
@ -59,7 +59,10 @@ func RunSectionCommand(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
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
|
// RefreshSections updates document sections where the data
|
||||||
|
@ -112,10 +115,16 @@ func RefreshSections(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask for data refresh
|
// 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
|
// 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
|
// Compare to stored render
|
||||||
if body != page.Body {
|
if body != page.Body {
|
||||||
|
|
|
@ -48,7 +48,7 @@ func Command(section string, w http.ResponseWriter, r *http.Request) bool {
|
||||||
if ok {
|
if ok {
|
||||||
s.Command(w, r)
|
s.Command(w, r)
|
||||||
}
|
}
|
||||||
return false
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render runs that operation for the given section id, the returned bool indicates success.
|
// 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