Update and consolidate to-do list
This commit is contained in:
parent
591d81ff13
commit
0ff6402c34
@ -22,8 +22,6 @@ type Store struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewStore(filename string, genString GenString) (*Store, error) {
|
func NewStore(filename string, genString GenString) (*Store, error) {
|
||||||
// TODO This stat needs to change, though I can't remember how, now that
|
|
||||||
// SQLite has been updated.
|
|
||||||
var needCreate bool
|
var needCreate bool
|
||||||
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||||
needCreate = true
|
needCreate = true
|
||||||
|
@ -268,7 +268,6 @@ func (h *handler) handleCreate(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *handler) handleDoCreate(w http.ResponseWriter, r *http.Request) {
|
func (h *handler) handleDoCreate(w http.ResponseWriter, r *http.Request) {
|
||||||
// TODO consider redirecting to admin
|
|
||||||
earliest, err := date.Parse(formDateLayout, r.FormValue(fieldNameEarliest))
|
earliest, err := date.Parse(formDateLayout, r.FormValue(fieldNameEarliest))
|
||||||
if invalidForm(w, err) {
|
if invalidForm(w, err) {
|
||||||
return
|
return
|
||||||
@ -351,7 +350,6 @@ func (h *handler) handleCreateSuccess(w http.ResponseWriter, r *http.Request) {
|
|||||||
func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) {
|
func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) {
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
eventID := query.Get(fieldNameEventID)
|
eventID := query.Get(fieldNameEventID)
|
||||||
// TODO authenticate with admin code
|
|
||||||
metadata, err := h.store.GetEventMetadata(context.Background(), back.GetEventMetadataQuery{
|
metadata, err := h.store.GetEventMetadata(context.Background(), back.GetEventMetadataQuery{
|
||||||
AlphaID: eventID,
|
AlphaID: eventID,
|
||||||
})
|
})
|
||||||
@ -367,7 +365,6 @@ func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO show results (number of responses, grid)
|
|
||||||
body := hm.Terms{
|
body := hm.Terms{
|
||||||
e.Form()(
|
e.Form()(
|
||||||
e.Label(a.For(fieldNameEventName))(hm.Text("Event name")),
|
e.Label(a.For(fieldNameEventName))(hm.Text("Event name")),
|
||||||
@ -381,8 +378,6 @@ func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) {
|
|||||||
e.Textarea(a.Name(fieldNameDescription))(hm.Text(metadata.Description)),
|
e.Textarea(a.Name(fieldNameDescription))(hm.Text(metadata.Description)),
|
||||||
e.Br(),
|
e.Br(),
|
||||||
|
|
||||||
// TODO Should the date fields be disabled, or should we cull invalid
|
|
||||||
// response times after changing event dates?
|
|
||||||
e.Label(a.For(fieldNameEarliest))(hm.Text("Earliest date")),
|
e.Label(a.For(fieldNameEarliest))(hm.Text("Earliest date")),
|
||||||
e.Input(
|
e.Input(
|
||||||
a.Name(fieldNameEarliest),
|
a.Name(fieldNameEarliest),
|
||||||
@ -412,8 +407,6 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *handler) writePage(w io.Writer, title string, contents hm.Term) error {
|
func (h *handler) writePage(w io.Writer, title string, contents hm.Term) error {
|
||||||
// TODO Need optional subtitles, and titles should be optional.
|
|
||||||
// Take a Page struct with title, subtitle, and contents.
|
|
||||||
page := e.Html()(
|
page := e.Html()(
|
||||||
e.Head()(
|
e.Head()(
|
||||||
e.Title()(hm.Text(h.title+" — "+title)),
|
e.Title()(hm.Text(h.title+" — "+title)),
|
||||||
|
32
todo.txt
32
todo.txt
@ -1,8 +1,32 @@
|
|||||||
|
Essential:
|
||||||
|
------------
|
||||||
|
Show results on admin page
|
||||||
|
Make earliest and latest dates required for creation
|
||||||
|
Prevent blank event names and guest names
|
||||||
|
Consider some front-end, regex-based field validation
|
||||||
|
Authenticate admin page with admin code
|
||||||
|
It might be sufficient to require that when getting the response summary.
|
||||||
|
Deal with the admin date fields
|
||||||
|
Should the date fields be disabled, or should we cull invalid
|
||||||
|
response times after changing event dates?
|
||||||
|
Consider redirecting from /create/do to admin
|
||||||
|
|
||||||
|
Cleanup:
|
||||||
|
------------
|
||||||
Make the sqlite pool size configurable
|
Make the sqlite pool size configurable
|
||||||
Get rid of the surrogate keys
|
Get rid of the surrogate keys
|
||||||
|
Give response (and therefore response_time) a composite key
|
||||||
Rename all of the alpha ID nonsense
|
Rename all of the alpha ID nonsense
|
||||||
Show results on admin page
|
Get rid of the Stat call in NewStore.
|
||||||
|
I can't remember the details. I think the old version
|
||||||
|
of sqlitex was panicking if I failed to open a DB file.
|
||||||
|
Maybe instead of statting, I would try to open an
|
||||||
|
existing file, but instead create it on failure.
|
||||||
|
Add optional subtitles to (*front.handler).writePage
|
||||||
|
Take a Page struct with title, subtitle, and contents.
|
||||||
|
Make titles optional in (*front.handler).writePage
|
||||||
|
|
||||||
|
|
||||||
|
More features:
|
||||||
|
---------------
|
||||||
Allow updating metadata on admin page
|
Allow updating metadata on admin page
|
||||||
Prevent blank event names and guest names
|
|
||||||
Make earliest and latest dates required for creation
|
|
||||||
Consider some front-end, regex-based field validation
|
|
||||||
|
Loading…
Reference in New Issue
Block a user