diff --git a/pkg/web/templates/bug.html b/pkg/web/templates/bug.html index 1a9d8e4642fffeafcd1c5fdfbdcaafe337621352..80b3ac93374d219b359b27f00722a8af6d20d1d9 100644 --- a/pkg/web/templates/bug.html +++ b/pkg/web/templates/bug.html @@ -19,7 +19,7 @@ {{end}} - {{.Title}} + {{.Subject}} {{if .Labels}}

diff --git a/pkg/web/webui_bugs.go b/pkg/web/webui_bugs.go index cd709c162579847db82e94204b0f829b4cb99bfa..5a6269d8d236fee97127de7e793540ee2001a57d 100644 --- a/pkg/web/webui_bugs.go +++ b/pkg/web/webui_bugs.go @@ -24,18 +24,11 @@ import ( const defaultBugsPerPage = 20 type BugsData struct { - Repo proto.Repository - DefaultBranch string - ActiveTab string - ServerName string - HasGitBug bool - - Bugs []BugListItem - Status string - Page int - TotalPages int - HasPrevPage bool - HasNextPage bool + RepoBaseData + PaginationData + + Bugs []BugListItem + Status string } type BugListItem struct { @@ -52,14 +45,10 @@ type BugListItem struct { } type BugData struct { - Repo proto.Repository - DefaultBranch string - ActiveTab string - ServerName string - HasGitBug bool + RepoBaseData ID string - Title string + Subject string Status string Author string CreatedAt time.Time @@ -376,18 +365,30 @@ func repoBugs(w http.ResponseWriter, r *http.Request) { } defaultBranch := getDefaultBranch(gr) + repoDisplayName := repo.ProjectName() + if repoDisplayName == "" { + repoDisplayName = repo.Name() + } + data := BugsData{ - Repo: repo, - DefaultBranch: defaultBranch, - ActiveTab: "bugs", - ServerName: cfg.Name, - HasGitBug: true, - Bugs: pagedBugs, - Status: status, - Page: page, - TotalPages: totalPages, - HasPrevPage: page > 1, - HasNextPage: page < totalPages, + RepoBaseData: RepoBaseData{ + BaseData: BaseData{ + ServerName: cfg.Name, + ActiveTab: "bugs", + Title: "Bugs | " + repoDisplayName, + }, + Repo: repo, + DefaultBranch: defaultBranch, + HasGitBug: true, + }, + PaginationData: PaginationData{ + Page: page, + TotalPages: totalPages, + HasPrevPage: page > 1, + HasNextPage: page < totalPages, + }, + Bugs: pagedBugs, + Status: status, } renderHTML(w, "bugs.html", data) @@ -446,20 +447,30 @@ func repoBug(w http.ResponseWriter, r *http.Request) { } defaultBranch := getDefaultBranch(gr) + repoDisplayName := repo.ProjectName() + if repoDisplayName == "" { + repoDisplayName = repo.Name() + } + data := BugData{ - Repo: repo, - DefaultBranch: defaultBranch, - ActiveTab: "bugs", - ServerName: cfg.Name, - HasGitBug: true, - ID: snap.Id().Human(), - Title: snap.Title, - Status: snap.Status.String(), - Author: snap.Author.DisplayName(), - CreatedAt: snap.CreateTime, - Edited: edited, - Timeline: timeline, - Labels: labels, + RepoBaseData: RepoBaseData{ + BaseData: BaseData{ + ServerName: cfg.Name, + ActiveTab: "bugs", + Title: snap.Title + " | Bug " + snap.Id().Human() + " | " + repoDisplayName, + }, + Repo: repo, + DefaultBranch: defaultBranch, + HasGitBug: true, + }, + ID: snap.Id().Human(), + Subject: snap.Title, + Status: snap.Status.String(), + Author: snap.Author.DisplayName(), + CreatedAt: snap.CreateTime, + Edited: edited, + Timeline: timeline, + Labels: labels, } renderHTML(w, "bug.html", data)