diff options
Diffstat (limited to 'pkg/gui/context/tags_context.go')
-rw-r--r-- | pkg/gui/context/tags_context.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/pkg/gui/context/tags_context.go b/pkg/gui/context/tags_context.go index 5c2592cf9..b79e4d31f 100644 --- a/pkg/gui/context/tags_context.go +++ b/pkg/gui/context/tags_context.go @@ -7,7 +7,7 @@ import ( ) type TagsContext struct { - *TagsList + *TagsViewModel *BaseContext *ListContextTrait } @@ -35,7 +35,7 @@ func NewTagsContext( self := &TagsContext{} takeFocus := func() error { return c.PushContext(self) } - list := NewTagsList(getModel) + list := NewTagsViewModel(getModel) viewTrait := NewViewTrait(getView) listContextTrait := &ListContextTrait{ base: baseContext, @@ -56,21 +56,21 @@ func NewTagsContext( self.BaseContext = baseContext self.ListContextTrait = listContextTrait - self.TagsList = list + self.TagsViewModel = list return self } -type TagsList struct { +type TagsViewModel struct { *ListTrait getModel func() []*models.Tag } -func (self *TagsList) GetItemsLength() int { +func (self *TagsViewModel) GetItemsLength() int { return len(self.getModel()) } -func (self *TagsList) GetSelectedTag() *models.Tag { +func (self *TagsViewModel) GetSelectedTag() *models.Tag { if self.GetItemsLength() == 0 { return nil } @@ -78,13 +78,13 @@ func (self *TagsList) GetSelectedTag() *models.Tag { return self.getModel()[self.GetSelectedLineIdx()] } -func (self *TagsList) GetSelectedItem() (types.ListItem, bool) { - tag := self.GetSelectedTag() - return tag, tag != nil +func (self *TagsViewModel) GetSelectedItem() (types.ListItem, bool) { + item := self.GetSelectedTag() + return item, item != nil } -func NewTagsList(getModel func() []*models.Tag) *TagsList { - self := &TagsList{ +func NewTagsViewModel(getModel func() []*models.Tag) *TagsViewModel { + self := &TagsViewModel{ getModel: getModel, } |