Plan search bar implementation
This commit is contained in:
@@ -54,6 +54,8 @@ type ProclamationOptions struct {
|
||||
|
||||
indentSize float32
|
||||
verticalMargin int32
|
||||
|
||||
isSearchActive bool
|
||||
}
|
||||
|
||||
func (p *ProclamationOptions) Init(ctx *PageCtx) error {
|
||||
@@ -62,6 +64,7 @@ func (p *ProclamationOptions) Init(ctx *PageCtx) error {
|
||||
p.activeMap = make(map[string]bool)
|
||||
p.allItems = []*FlatItem{}
|
||||
p.scrollOffset = 0
|
||||
p.isSearchActive = false
|
||||
|
||||
p.scrollTrackWidth = 30
|
||||
p.scrollTrackX = p.ScreenWidth - p.scrollTrackWidth
|
||||
@@ -237,12 +240,21 @@ func (p *ProclamationOptions) HandleEvent(event *sdl.Event) error {
|
||||
}
|
||||
case sdl.K_BACKSPACE, sdl.K_ESCAPE:
|
||||
p.Context.NavigateTo(SETTINGS)
|
||||
default:
|
||||
// Treat input as search intent, initiate search & filter
|
||||
p.toggleTextInput()
|
||||
p.isSearchActive = true
|
||||
}
|
||||
p.layout()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Turn on and off the text input capture.
|
||||
// Don't forget to capture the current event, so that you can
|
||||
// determine which character to start the search with.
|
||||
func (p *ProclamationOptions) toggleTextInput() {}
|
||||
|
||||
func (p *ProclamationOptions) acceptChanges() {
|
||||
p.Context.DbPtr.Transaction(func(tx *gorm.DB) error {
|
||||
tx.Model(&db.Proclamation{}).Where("1 = 1").Update("selected", false)
|
||||
|
||||
Reference in New Issue
Block a user