forked from tildetown/town
WIP adding signup notes
parent
df41bb4df2
commit
8ecfe7a940
|
@ -49,6 +49,17 @@ func (r *reviewer) Review(s *models.TownSignup, decision models.SignupDecision)
|
|||
return nil
|
||||
}
|
||||
|
||||
func (r *reviewer) AddNote(s *models.TownSignup, content string) error {
|
||||
note := &models.SignupNote{
|
||||
Created: time.Now(),
|
||||
Author: r.adminName,
|
||||
Content: content,
|
||||
}
|
||||
note.Insert(r.db)
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func renderSignup(s models.TownSignup) string {
|
||||
out := fmt.Sprintf("[-:-:b]submitted:[-:-:-] %s\n", s.Created.Format("2006-01-02 15:04"))
|
||||
|
||||
|
@ -157,7 +168,16 @@ func _main() error {
|
|||
notate := tview.NewForm()
|
||||
notate.AddTextArea("note", "", 80, 10, 1000, func(string) {})
|
||||
notate.AddButton("submit", func() {
|
||||
// add note and update
|
||||
fi := notate.GetFormItemByLabel("note").(*tview.TextArea)
|
||||
err = r.AddNote(signups[signupIx], fi.GetText())
|
||||
if err != nil {
|
||||
errorModal.SetText(fmt.Sprintf("error! failed to add note: %s", err.Error()))
|
||||
pages.SwitchToPage("error")
|
||||
return
|
||||
}
|
||||
|
||||
// TODO force redraw of current item
|
||||
|
||||
pages.SwitchToPage("main")
|
||||
})
|
||||
notate.AddButton("cancel", func() {
|
||||
|
|
|
@ -9,11 +9,16 @@ import (
|
|||
)
|
||||
|
||||
// TODO this is in flux; might want SignupNote and UserNote structs separately
|
||||
type AdminNote struct {
|
||||
type SignupNote struct {
|
||||
ID int64
|
||||
Admin string
|
||||
Note string
|
||||
When time.Time
|
||||
Created time.Time
|
||||
Author string
|
||||
Content string
|
||||
}
|
||||
|
||||
func (n *SignupNote) Insert(db *sql.DB) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
type SignupDecision string
|
||||
|
@ -34,7 +39,7 @@ type TownSignup struct {
|
|||
Why string
|
||||
Links string
|
||||
|
||||
Notes []AdminNote
|
||||
Notes []SignupNote
|
||||
Decision SignupDecision
|
||||
DecisionTime time.Time
|
||||
DecidedBy string
|
||||
|
|
Loading…
Reference in New Issue