forked from andreaskoch/allmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
titles.go
35 lines (26 loc) · 804 Bytes
/
titles.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2014 Andreas Koch. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package orchestrator
import (
"github.com/andreaskoch/allmark/web/view/viewmodel"
"strings"
)
type TitlesOrchestrator struct {
*Orchestrator
}
func (orchestrator *TitlesOrchestrator) GetTitles() []viewmodel.Title {
rootItem := orchestrator.rootItem()
if rootItem == nil {
orchestrator.logger.Fatal("No root item found")
}
titleModels := make([]viewmodel.Title, 0)
for _, item := range orchestrator.getAllItems() {
titleModels = append(titleModels, viewmodel.Title{
Value: item.Title,
Tokens: strings.Split(item.Title, " "),
Route: orchestrator.itemPather().Path(item.Route().Value()),
})
}
return titleModels
}