1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Convert the bulk of modules over to RedrawFunc

This commit is contained in:
Sean Smith
2019-08-26 23:07:02 -04:00
parent 51e4325f0b
commit 3a716bcf9a
25 changed files with 214 additions and 224 deletions

View File

@@ -53,13 +53,14 @@ func (widget *Widget) Refresh() {
/* -------------------- Unexported Functions -------------------- */
func (widget *Widget) Render() {
title := fmt.Sprintf("%s (%d)", widget.CommonSettings().Title, widget.result.Count)
widget.Redraw(title, widget.textContent(widget.result.Tickets), false)
widget.RedrawFunc(widget.content)
}
func (widget *Widget) textContent(items []Ticket) string {
func (widget *Widget) content() (string, string, bool) {
title := fmt.Sprintf("%s (%d)", widget.CommonSettings().Title, widget.result.Count)
items := widget.result.Tickets
if len(items) == 0 {
return fmt.Sprintf("No unassigned tickets in queue - woop!!")
return title, "No unassigned tickets in queue - woop!!", false
}
str := ""
@@ -67,7 +68,7 @@ func (widget *Widget) textContent(items []Ticket) string {
str += widget.format(data, idx)
}
return str
return title, str, false
}
func (widget *Widget) format(ticket Ticket, idx int) string {