almost there but tasks dont disappear in UI and click&drag doesnt work
This commit is contained in:
@@ -3,6 +3,7 @@ package ajax
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"local/todo-server/server/ajax/form"
|
||||
"local/todo-server/server/ajax/list"
|
||||
"net/http"
|
||||
)
|
||||
@@ -14,15 +15,6 @@ func (a *Ajax) loadLists(w http.ResponseWriter, r *http.Request) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// TODO
|
||||
lists = append(lists, &list.List{
|
||||
ID: "Todo",
|
||||
UUID: "Todo",
|
||||
})
|
||||
if err := a.storageSetList(lists[0].ID, lists[0]); err != nil {
|
||||
return err
|
||||
}
|
||||
// /TODO
|
||||
return json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"total": len(lists),
|
||||
"list": lists,
|
||||
@@ -34,16 +26,43 @@ func (a *Ajax) changeOrder(w http.ResponseWriter, r *http.Request) error {
|
||||
}
|
||||
|
||||
func (a *Ajax) addList(w http.ResponseWriter, r *http.Request) error {
|
||||
// {"total":1,"list":[{"id":"21","name":"abc","sort":0,"published":0,"showCompl":0,"showNotes":0,"hidden":0}]}
|
||||
return errors.New("not impl")
|
||||
newList, err := list.New(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := a.storageSetList(newList); err != nil {
|
||||
return err
|
||||
}
|
||||
return json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"total": 1,
|
||||
"list": []*list.List{newList},
|
||||
})
|
||||
}
|
||||
|
||||
func (a *Ajax) renameList(w http.ResponseWriter, r *http.Request) error {
|
||||
return errors.New("not impl")
|
||||
uuid := form.Get(r, "list")
|
||||
renameList, err := a.storageGetList(uuid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
renameList.SetName(form.Get(r, "name"))
|
||||
if err := a.storageSetList(renameList); err != nil {
|
||||
return err
|
||||
}
|
||||
return json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"total": 1,
|
||||
"list": []*list.List{renameList},
|
||||
})
|
||||
}
|
||||
|
||||
func (a *Ajax) deleteList(w http.ResponseWriter, r *http.Request) error {
|
||||
return errors.New("not impl")
|
||||
uuid := form.Get(r, "list")
|
||||
if err := a.storageDelList(uuid); err != nil {
|
||||
return err
|
||||
}
|
||||
return json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"total": 1,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *Ajax) setSort(w http.ResponseWriter, r *http.Request) error {
|
||||
|
||||
Reference in New Issue
Block a user