//TimeOverrideDelete handles deleting of a time override. func TimeOverrideDelete(c util.Context) (err error) { key, err := datastore.DecodeKey(c.R.FormValue("key")) if err != nil { return } tc, err := timeConfig.GetByKey(key, c) if err != nil { return } err = tc.Delete(c) if err != nil { return } http.Redirect(c.W, c.R, "/admin/config", 303) return }
//TimeOverrideEdit handles editing of existing time overrides. //If it doesn't find id value in the path, it adds a new override. func TimeOverrideEdit(c util.Context) (err error) { var tc *timeConfig.TimeConfig if key := c.Vars["id"]; key == "" { tc = nil } else { var k *datastore.Key k, err = datastore.DecodeKey(key) if err != nil { return } tc, err = timeConfig.GetByKey(k, c) if err != nil { return } } c.Infof("%+v", tc) util.RenderLayout("timeConfigEdit.html", "Úprava výnimky", tc, c, "/static/js/editTC.js") return }