1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

per space templates

This commit is contained in:
Harvey Kandola 2017-08-17 09:37:33 +01:00
parent 574139ae21
commit 558d90d2ba
10 changed files with 73 additions and 36 deletions

View file

@ -49,7 +49,13 @@ func (h *Handler) SavedList(w http.ResponseWriter, r *http.Request) {
method := "template.saved"
ctx := domain.GetRequestContext(r)
documents, err := h.Store.Document.Templates(ctx)
folderID := request.Param(r, "folderID")
if len(folderID) == 0 {
response.WriteMissingDataError(w, method, "folderID")
return
}
documents, err := h.Store.Document.TemplatesBySpace(ctx, folderID)
if err != nil {
response.WriteServerError(w, method, err)
h.Runtime.Log.Error(method, err)
@ -67,7 +73,9 @@ func (h *Handler) SavedList(w http.ResponseWriter, r *http.Request) {
t.Dated = d.Created
t.Type = template.TypePrivate
templates = append(templates, t)
if d.LabelID == folderID {
templates = append(templates, t)
}
}
response.WriteJSON(w, templates)