diff options
-rw-r--r-- | internal/models/engagement.go | 8 | ||||
-rw-r--r-- | ui/html/pages/operations/list.tmpl.html | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/internal/models/engagement.go b/internal/models/engagement.go index 26b468a..87e0786 100644 --- a/internal/models/engagement.go +++ b/internal/models/engagement.go @@ -2,6 +2,8 @@ package models import ( "database/sql" + "fmt" + "strconv" "time" ) @@ -12,6 +14,12 @@ type EngagementStrategy struct { Operation Operation } +func (es *EngagementStrategy) FormatForTable() string { + startYear := strconv.Itoa(es.ValidFrom.Year()) + endYear := strconv.Itoa(es.ValidTo.Year()) + return fmt.Sprintf("%s-%s", startYear, endYear) +} + type EngagementStrategyModel struct { DB *sql.DB } diff --git a/ui/html/pages/operations/list.tmpl.html b/ui/html/pages/operations/list.tmpl.html index 240ba40..a619ea9 100644 --- a/ui/html/pages/operations/list.tmpl.html +++ b/ui/html/pages/operations/list.tmpl.html @@ -34,14 +34,14 @@ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod {{if .EngagementStrategies}} <ul> {{range .EngagementStrategies}} - <li> - Expires: <a href="#">{{.ValidTo.Format "Mon 2 Jan 2006" }}</a> + <li class="table-list"> + <a href="#">{{.FormatForTable }}</a> </li> {{end}} </ul> {{else}} - <p>NA</p> + NA {{end}} </td> <td><a href="#">Link</a></td> |