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
|
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 {
|
func renderSignup(s models.TownSignup) string {
|
||||||
out := fmt.Sprintf("[-:-:b]submitted:[-:-:-] %s\n", s.Created.Format("2006-01-02 15:04"))
|
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 := tview.NewForm()
|
||||||
notate.AddTextArea("note", "", 80, 10, 1000, func(string) {})
|
notate.AddTextArea("note", "", 80, 10, 1000, func(string) {})
|
||||||
notate.AddButton("submit", func() {
|
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")
|
pages.SwitchToPage("main")
|
||||||
})
|
})
|
||||||
notate.AddButton("cancel", func() {
|
notate.AddButton("cancel", func() {
|
||||||
|
|
|
@ -9,11 +9,16 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO this is in flux; might want SignupNote and UserNote structs separately
|
// TODO this is in flux; might want SignupNote and UserNote structs separately
|
||||||
type AdminNote struct {
|
type SignupNote struct {
|
||||||
ID int64
|
ID int64
|
||||||
Admin string
|
Created time.Time
|
||||||
Note string
|
Author string
|
||||||
When time.Time
|
Content string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *SignupNote) Insert(db *sql.DB) error {
|
||||||
|
// TODO
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignupDecision string
|
type SignupDecision string
|
||||||
|
@ -34,7 +39,7 @@ type TownSignup struct {
|
||||||
Why string
|
Why string
|
||||||
Links string
|
Links string
|
||||||
|
|
||||||
Notes []AdminNote
|
Notes []SignupNote
|
||||||
Decision SignupDecision
|
Decision SignupDecision
|
||||||
DecisionTime time.Time
|
DecisionTime time.Time
|
||||||
DecidedBy string
|
DecidedBy string
|
||||||
|
|
Loading…
Reference in New Issue