Documentation
¶
Overview ¶
Package view builds the view models the render layer turns into HTML. It maps the domain types (a Repo, a User, a list of commits) into flat, presentation shaped structs with no behavior, and it owns the request-scoped contract the middleware fills in: the signed-in viewer, the color mode, the CSRF token and the one-shot flash messages. render renders a view model; view never renders. The import direction is one way: webmw and the handlers import view, view imports neither. See implementation/03 and implementation/06.
Index ¶
- Constants
- func CSRFFrom(ctx context.Context) string
- func EventsSummary(events []string) string
- func HookEventNames() []string
- func HookStatusGlyph(status string) (icon, kind string)
- func HookSubscribesAll(events []string) bool
- func ProfileTabOr(raw string) string
- func SearchTypeOr(raw, def string, allowed []string) string
- func ValidDarkTheme(t string) bool
- func ValidLightTheme(t string) bool
- func ValidMode(m string) bool
- func WithCSRF(ctx context.Context, token string) context.Context
- func WithColorMode(ctx context.Context, m ColorMode) context.Context
- func WithFlashes(ctx context.Context, f []Flash) context.Context
- func WithViewer(ctx context.Context, v *Viewer) context.Context
- type AboutVM
- type AppearanceOption
- type AppearanceVM
- type BlameLineVM
- type BlameVM
- type BlobLine
- type BlobVM
- type BranchRowVM
- type BranchesVM
- type Builder
- type CheckRunRowVM
- type ChecksPageVM
- type ChecksRollupVM
- type Chrome
- type CloneVM
- type CodeResultVM
- type ColorMode
- type CommentVM
- type CommitDateGroup
- type CommitRowVM
- type CommitStatusRowVM
- type CommitSummary
- type CommitVM
- type CommitsVM
- type CompareBranchVM
- type CompareCommitVM
- type ComparePickerVM
- type CompareRangeVM
- type ComposerVM
- type Crumb
- type DashboardVM
- type DiffContextVM
- type DiffExpand
- type DiffFileVM
- type DiffMode
- type DiffRow
- func (r DiffRow) CellClass() string
- func (r DiffRow) Commentable() bool
- func (r DiffRow) CommentsLeft() bool
- func (r DiffRow) CommentsRight() bool
- func (r DiffRow) IsAddition() bool
- func (r DiffRow) IsContext() bool
- func (r DiffRow) IsDeletion() bool
- func (r DiffRow) IsExpander() bool
- func (r DiffRow) IsHunkHeader() bool
- func (r DiffRow) IsReplace() bool
- func (r DiffRow) LeftClass() string
- func (r DiffRow) LeftText() template.HTML
- func (r DiffRow) NewLineLabel() string
- func (r DiffRow) OldLineLabel() string
- func (r DiffRow) RightClass() string
- func (r DiffRow) RightText() template.HTML
- type DiffToggleVM
- type FeedItemVM
- type FileFinderVM
- type FileStatus
- type FilterTab
- type FinderEntry
- type Flash
- type HeaderKV
- type HomeRepoVM
- type HomeVM
- type HookDeliveryDetailVM
- type HookDeliveryRowVM
- type HookEventChoice
- type HookFormVM
- type HookListVM
- type HookRowVM
- type InlineComposerVM
- type IssueDetailVM
- type IssueIndexVM
- type IssueResultVM
- type IssueRow
- type IssueStateVM
- type LabelVM
- type LabelsVM
- type MergeBoxState
- func (s MergeBoxState) Headline() string
- func (s MergeBoxState) IsBehind() bool
- func (s MergeBoxState) IsBlocked() bool
- func (s MergeBoxState) IsClean() bool
- func (s MergeBoxState) IsClosed() bool
- func (s MergeBoxState) IsComputing() bool
- func (s MergeBoxState) IsDirty() bool
- func (s MergeBoxState) IsDraft() bool
- func (s MergeBoxState) IsMerged() bool
- func (s MergeBoxState) MergeIcon() string
- func (s MergeBoxState) Mergeable() bool
- func (s MergeBoxState) Modifier() string
- type MergeBoxVM
- type MergeMethodVM
- type MilestoneDetailVM
- type MilestoneRowVM
- type MilestoneVM
- type MilestonesVM
- type NewIssueVM
- type NotificationFilterVM
- type NotificationRowVM
- type NotificationsVM
- type PRCheckDetailVM
- type PRCheckRunRowVM
- type PRCheckSuiteVM
- type PRChecksVM
- type PRCommitDateGroup
- type PRCommitRow
- type PRCommitsVM
- type PRConversationVM
- type PRFilesVM
- type PRIndexVM
- type PRRow
- type PRShellVM
- type PRState
- type PRStateVM
- type PRTimelineItem
- type Pager
- type ProfileHeaderVM
- type ProfileOverviewVM
- type ProfilePageVM
- type ProfilePeopleVM
- type ProfileReposVM
- type ProfileSettingsVM
- type ProfileStarsVM
- type ProfileTab
- type QuickSetupVM
- type ReactionVM
- type ReactionsVM
- type ReadmeVM
- type Ref
- type RefChoice
- type RefPickerVM
- type RepoGeneralVM
- type RepoHeaderVM
- type RepoHomeVM
- type RepoNewVM
- type RepoRef
- type RepoResultVM
- type ReviewCommentVM
- type ReviewOverlayVM
- type ReviewRollupVM
- type ReviewState
- type ReviewStateVM
- type ReviewSummaryVM
- type ReviewSurfaceVM
- type ReviewThreadVM
- type RowKind
- type SearchPageVM
- type SearchSortOption
- type SearchTab
- type SettingsNav
- type SettingsNavItem
- type Side
- type SidebarVM
- type StatusToken
- type TagRowVM
- type TagsVM
- type TreeEntryVM
- type TreeNav
- type TreeVM
- type UserCardVM
- type UserChipVM
- type Viewer
Constants ¶
const ( ProfileOverview = "overview" ProfileRepositories = "repositories" ProfileStars = "stars" ProfileFollowers = "followers" ProfileFollowing = "following" )
The profile tab keys. They are the ?tab= values and the keys the strip and the builder dispatch on. Overview is the default and carries no query, so a bookmarked bare /{owner} keeps working.
const ( SearchCode = "code" SearchRepos = "repositories" SearchIssues = "issues" SearchPulls = "pullrequests" )
The search type keys. They are the ?type= values and the keys the rail and the builder dispatch on. They match the GitHub vocabulary so a bookmarked ?type=code keeps working.
const ( ScopeGlobal = "global" ScopeRepo = "repo" )
SearchScope names whether a search spans the whole host or one repository. The scope drives the default type (repositories globally, code in a repo), the rail membership (no cross-repo types in a repo), and the implicit repo: qualifier the in-repo box injects.
Variables ¶
This section is empty.
Functions ¶
func EventsSummary ¶
EventsSummary renders a subscription as the one-line human summary the list row shows: "everything" for the wildcard, otherwise the events joined with a comma. An empty subscription reads as the push default the domain stores.
func HookEventNames ¶
func HookEventNames() []string
HookEventNames returns the closed set of individual event names the form offers, for the handler to validate a submission against.
func HookStatusGlyph ¶
HookStatusGlyph maps a delivery or last-response status string the domain reports to the icon and the style kind the row wears: a green check for OK, a muted dot for a hook that has not fired yet, and a red circle for a failure. The icon names are already in the registry, so they need no separate registration. The status strings are the ones domain.deliveryStatus and the last-response summary produce.
func HookSubscribesAll ¶
HookSubscribesAll reports whether a subscription is the wildcard, the state the form shows as "send me everything".
func ProfileTabOr ¶
ProfileTabOr validates a requested ?tab= against the two backed tabs and falls back to the overview when it is empty or unknown. A bad tab never errors, it degrades to the overview, matching the search type's tolerance for a human's URL.
func SearchTypeOr ¶
SearchTypeOr validates a requested ?type= against the allowed set for the page and falls back to def when it is empty or unknown. A bad type never errors, it degrades to the default, matching the parser's tolerance for a human's URL.
func ValidDarkTheme ¶
ValidDarkTheme reports whether t is one of the dark themes the form offers.
func ValidLightTheme ¶
ValidLightTheme reports whether t is one of the light themes the form offers.
func ValidMode ¶
ValidMode reports whether m is one of the three modes the appearance form offers, so the handler rejects a forged value before writing the cookie.
func WithColorMode ¶
WithColorMode stores the validated color mode on the context.
func WithFlashes ¶
WithFlashes stores the flash messages drained for this request.
Types ¶
type AboutVM ¶
AboutVM is the repo home sidebar: the description, homepage, and topic chips. The license chip and the languages bar are left for the milestones that add their domain fields (implementation/07 section 3.1). Topics render as plain chips since no topic browse surface exists to link them to yet.
type AppearanceOption ¶
AppearanceOption is one choice in a settings select or radio group: the stored value, the human label, and whether it is the current selection. The account appearance form and the webhook content-type select both render through it.
func AppearanceModeOptions ¶
func AppearanceModeOptions(selected string) []AppearanceOption
AppearanceModeOptions returns the mode radio group with selected marked.
func DarkThemeOptions ¶
func DarkThemeOptions(selected string) []AppearanceOption
DarkThemeOptions returns the dark-theme select with selected marked.
func HookContentTypeOptions ¶
func HookContentTypeOptions(selected string) []AppearanceOption
HookContentTypeOptions returns the content-type select with selected marked.
func LightThemeOptions ¶
func LightThemeOptions(selected string) []AppearanceOption
LightThemeOptions returns the light-theme select with selected marked.
type AppearanceVM ¶
type AppearanceVM struct {
Chrome Chrome
Action string
Modes []AppearanceOption
LightThemes []AppearanceOption
DarkThemes []AppearanceOption
}
AppearanceVM is the account appearance page: the color mode (auto, light, or dark) and the theme used under each of the light and dark slots. The form posts to Action and the handler writes the three preference cookies the color-mode middleware reads, so the choice survives with no JavaScript and no account column. The lists are built from the closed catalogs below, so the form can only ever offer a theme the asset build actually generated.
type BlameLineVM ¶ added in v0.1.3
type BlameLineVM struct {
LineNum int
Text string // raw source text (HTML-escaped in template)
SHA string
ShortSHA string // first 7 chars
AuthorName string
When string // human-readable date e.g. "Jan 2, 2006"
CommitURL string
NewGroup bool // true when this line starts a new commit group
}
BlameLineVM is one annotated source line in the blame view. NewGroup is true when this line opens a new commit hunk, which the template uses to show the commit metadata once per group rather than repeating it on every line.
type BlameVM ¶ added in v0.1.3
type BlameVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Ref Ref
Path string
Lines []BlameLineVM
BlobURL string // link back to the blob view
}
BlameVM is the line-by-line blame view: every source line annotated with the commit that last changed it. BlobURL links back to the normal blob view.
type BlobLine ¶
BlobLine is one source line: its 1-based number (the id="L{n}" anchor) and the highlighted HTML the markup highlighter produced. Text is trusted markup: the source text is HTML-escaped and only the pl-* token spans are raw, so the template emits it without re-escaping. A blob in an unknown language degrades to the escaped line with no spans.
type BlobVM ¶
type BlobVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Ref Ref
Path string
Crumbs []Crumb
RefPicker RefPickerVM
Name string
Kind string // text | markdown | image | pdf | binary | svg | toolarge
Lang string // the highlighter grammar label, shown in the blob header
Lines []BlobLine // the highlighted source lines for a text or svg blob
Body template.HTML // the rendered GFM for a markdown blob (Kind == "markdown")
RawText string
LineCount int
Size int64
SizeLabel string
RawURL string
Plain bool
Truncated bool
}
BlobVM is the single-file view. The handler classifies the blob into a kind that selects the body: text and svg carry the per-line highlighted HTML with stable ids so the line anchors resolve, a markdown blob (not viewed with ?plain=1) carries Body as rendered GFM, and an image or pdf embeds from the raw URL. See implementation/07 sections 5.1 and 5.2.
type BranchRowVM ¶
BranchRowVM is one branch row: the name and the precomputed tree and history URLs. The ahead/behind counts and PR status arrive with the compare domain.
type BranchesVM ¶
type BranchesVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Default string
Items []BranchRowVM
}
BranchesVM is the branch overview: the default branch first, then the rest.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder assembles a Chrome from the request context plus the static site configuration. One Builder is constructed at boot and shared; it reads only the request, so it is safe for concurrent use.
func NewBuilder ¶
NewBuilder returns a Builder for the given site name (shown in the title and the header). An empty name falls back to Githome.
func (*Builder) Chrome ¶
Chrome builds the shell model for a request, reading the viewer, color mode, CSRF token and flashes the middleware placed on the context. title is the page title; an empty title renders just the site name.
func (*Builder) Home ¶
Home builds the landing page model's shell; the home handlers fill the dashboard fields for a signed-in viewer.
func (*Builder) Notifications ¶ added in v0.1.3
func (b *Builder) Notifications(c *mizu.Ctx) NotificationsVM
Notifications builds the empty-inbox model for a viewer whose notifications service is unbacked: the chrome only. The handler builds the populated model directly when the service is present.
func (*Builder) SiteName ¶
SiteName returns the configured site name, for the rare caller that needs it outside a Chrome.
func (*Builder) WithHideAuth ¶ added in v0.1.3
WithHideAuth returns a copy of the builder that sets HideAuth on every Chrome it produces. Use this in browse mode where the auth routes are not mounted.
type CheckRunRowVM ¶
type CheckRunRowVM struct {
Name string
Token StatusToken
Summary string
DetailsURL string
HasDetails bool
WhenVerb string
WhenISO string
WhenHuman string
}
CheckRunRowVM is one check run in the list: its name, the shared status token, the optional one-line output summary, a details link out to the reporting app (sanitized by the handler, omitted when absent), and the precomputed time line. WhenVerb is "Finished", "Started", or "Queued" depending on how far the run got; WhenISO and WhenHuman feed the <relative-time> element the same way the rest of the front renders timestamps.
type ChecksPageVM ¶
type ChecksPageVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Ref string // the ref as navigated, shown in the heading
SHA string
ShortSHA string
Rollup StatusToken
RollupTitle string
Total int
Runs []CheckRunRowVM
Statuses []CommitStatusRowVM
Empty bool
}
ChecksPageVM is the checks page for a ref, /{owner}/{repo}/checks/{ref}. It carries the repo context bar so the page sits inside the repository like every other repo sub-page, the resolved sha the checks anchor to, the rollup verdict, and the two row sets. Empty is true when the ref resolved but nothing has reported against it, which renders the blankslate rather than a bare page.
type ChecksRollupVM ¶
type ChecksRollupVM struct {
Present bool
Headline string
Icon string // octicon name from the rollup token
ColorClass string // a check-state-* class from the rollup token
URL string // the checks page at the head sha
}
ChecksRollupVM is the status-checks summary the merge box shows above its merge control. F9 fills it from the head sha's status-check rollup: the shared status token (so the icon and color match the checks page and every other check surface), the worst-first headline, and the link to the full checks page at the head sha. It stays empty (Present false) on a merged or closed PR and when no checks have reported, which the box renders without a checks line.
type Chrome ¶
type Chrome struct {
Title string
SiteName string
ColorMode ColorMode
Viewer *Viewer
CSRFToken string
CurrentPath string
Flashes []Flash
HideAuth bool // suppress "Sign in" when auth routes are not mounted
}
Chrome is the shell view model shared by every full page: the title, the site name, the active color mode, the signed-in viewer (nil when anonymous), the CSRF token for forms in the shell, the current path for a sign-in return, and any flash messages to show once. HideAuth suppresses the "Sign in" link when the auth surface is intentionally absent (e.g. browse mode). A page view model embeds a Chrome so the layout renders the same shell around any content. Its field names are the contract the base layout reads; render keeps a structural fallback that mirrors them.
type CloneVM ¶
CloneVM carries the clone URLs the home and tree views show. F1 fills the HTTP and SSH forms from the presenter; the web download link is added with archives.
type CodeResultVM ¶
type CodeResultVM struct {
Name string
Path string
BlobURL string
RepoFullName string
RepoURL string
}
CodeResultVM is one matching file in the code results: its base name, its path within the repository, the blob URL that opens it, and the repository-context line. The domain code search returns a path and an object id, not a line snippet, so the row links to the file rather than showing a fabricated excerpt.
type ColorMode ¶
ColorMode is the trio the html element carries so CSS alone picks the theme. Mode is auto, light or dark; Light and Dark name the theme used under each. The values are validated by the color-mode middleware, so an unknown value never reaches a template.
func ColorModeFrom ¶
ColorModeFrom returns the stored color mode, or the default (auto, light, dark) when unset.
func DefaultColorMode ¶
func DefaultColorMode() ColorMode
DefaultColorMode follows the operating system with the stock light and dark themes, which needs no cookie and no JavaScript.
type CommentVM ¶
type CommentVM struct {
ID int64
Author UserChipVM
Body template.HTML // the GFM-rendered, sanitized comment HTML
BodySource string // the raw markdown, for the edit textarea
CreatedAt string
CreatedISO string
Edited bool
IsAuthor bool // whether the body is the issue's opening body (the first item)
Anchor string // "issuecomment-{id}" for the permalink fragment
URL string
Reactions ReactionsVM
CanEdit bool
EditURL string
DeleteURL string
}
CommentVM is one comment in the issue timeline: the author, the rendered body, the timestamps, the reaction rollup, the permalink, and the edit affordance when the viewer may edit it.
type CommitDateGroup ¶
type CommitDateGroup struct {
Date string
Commits []CommitRowVM
}
CommitDateGroup is one day's heading and the commits authored that day.
type CommitRowVM ¶
type CommitRowVM struct {
SHA string
ShortSHA string
Title string
Body string
AuthorName string
AuthorEmail string
When string
BrowseURL string // tree at this commit
CommitURL string // single-commit detail
}
CommitRowVM is one row in the history: the message title and body, the author, the abbreviated sha, and the precomputed browse and copy URLs.
type CommitStatusRowVM ¶
type CommitStatusRowVM struct {
Context string
Token StatusToken
Description string
TargetURL string
HasTarget bool
}
CommitStatusRowVM is one external commit status: the context it reported under, the shared status token, the optional description, and the optional target URL (the external build's page, sanitized by the handler). It is the older, flat signal a CI system posts with no check-run output.
type CommitSummary ¶
type CommitSummary struct {
SHA string
ShortSHA string
Title string
AuthorName string
When string // already formatted for the row; relativeTime handles the page
URL string // the single-commit URL, linked once that view ships
Present bool
}
CommitSummary is the latest-commit bar over a tree and each row in the commits list: the author, the abbreviated sha, the title, and the precomputed URLs.
type CommitVM ¶ added in v0.1.3
type CommitVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
SHA string
ShortSHA string
Title string
Body string
AuthorName string
AuthorEmail string
When string
ParentSHAs []string // short SHAs; empty for the initial commit
ParentURLs []string // tree browse URL for each parent
// Files is the commit's diff rendered through the shared per-file diff
// component, the same one the PR Files tab and the compare page use.
Files []DiffFileVM
// FilesTruncated marks Files as the bounded head of a larger change; the
// template shows a note pointing at the browse view for the rest.
FilesTruncated bool
FilesCount int // number of files changed, counted before the cap
Additions int // total added lines across all files
Deletions int // total deleted lines across all files
CommitsURL string // back link to the history page
TreeURL string // tree at this commit
Diff DiffToggleVM // the unified/split and hide-whitespace controls
}
CommitVM is the single-commit view: the commit metadata, parent links, and the rendered unified diff.
type CommitsVM ¶
type CommitsVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Ref Ref
Path string
Groups []CommitDateGroup
Pager Pager
FilterAction string // the GET form target, the page's own canonical URL
FilterAuthor string
FilterSince string
FilterUntil string
}
CommitsVM is the history list, grouped by calendar date in the viewer's view. Pager carries the newer/older hops with the filters preserved; the Filter fields echo the query back into the filter form.
type CompareBranchVM ¶ added in v0.1.3
type CompareBranchVM struct {
Name string
SHA string
ShortSHA string
URL string // tree at the branch tip
}
CompareBranchVM is the minimal branch identity on a comparison header: the name for display and the short SHA for the "View" link anchor.
type CompareCommitVM ¶ added in v0.1.3
type CompareCommitVM struct {
ShortSHA string
Title string
AuthorName string
When string
WhenISO string
URL string
}
CompareCommitVM is one commit row on the comparison page.
type ComparePickerVM ¶ added in v0.1.3
type ComparePickerVM struct {
Chrome Chrome
Header RepoHeaderVM
Branches []string
Base string
Head string
Action string // URL the form GETs (compares {base}...{head})
}
ComparePickerVM is the view model for GET /compare. It shows a two-branch selector (base and head) so the viewer can start a comparison or a PR.
type CompareRangeVM ¶ added in v0.1.3
type CompareRangeVM struct {
Chrome Chrome
Header RepoHeaderVM
Base CompareBranchVM
Head CompareBranchVM
MergeBase string // short SHA of the merge base commit
Commits []CompareCommitVM
TotalCommits int // the real range size; > len(Commits) when the list is capped
Files []DiffFileVM
Additions int
Deletions int
ChangedFiles int
HasDiff bool // false when base == head or no changed files
Expanded bool // true when ?expand=1, shows PR creation form
CreateURL string
CSRFToken string
ExpandURL string // the same range URL with ?expand=1
Diff DiffToggleVM // the unified/split and hide-whitespace controls
}
CompareRangeVM is the view model for GET /compare/{basehead...}. It shows the diff between base and head and, when Expanded is true, the PR creation form below the diff.
type ComposerVM ¶
type ComposerVM struct {
Action string // the POST target for a new comment
CanComment bool
CanClose bool
IssueOpen bool
CloseLabel string // "Close issue" | "Reopen issue"
CloseAction string // the POST target that toggles state (with a comment if filled)
}
ComposerVM is the new-comment box at the foot of the timeline: the form target, the CSRF token (carried via Chrome), and the close/reopen button state.
type Crumb ¶
Crumb is one path breadcrumb: a label and the tree URL it links to. The last crumb in a list is the current location and is rendered without a link.
type DashboardVM ¶ added in v0.1.3
type DashboardVM struct {
Chrome Chrome
Heading string // "Issues" | "Pull requests"
Icon string // the heading octicon
QueryValue string // the literal extra q the filter box shows
Action string // the GET form target, /issues or /pulls
Tab string // the active tab key, carried as the form's hidden field
Tabs []FilterTab
Rows []IssueResultVM
Pager Pager
Empty bool // true when the scoped list is empty
EmptyReason string // the blankslate line
}
DashboardVM is the global, viewer-scoped issues or pull-requests page at the reserved /issues and /pulls names: a tab row scoping the list to what the viewer created or is assigned, a cross-repo filter box, and the same result rows the search page renders (each row carries its repository line, since the path implies none). The handler precomputes every URL; the template only ranges. See spec doc 09 section 1.6.
type DiffContextVM ¶ added in v0.1.3
DiffContextVM is the data the unfold endpoint renders: the context rows revealed from the blob and whether they go into the split table (so the fragment shapes its cells the same way the file's table does).
type DiffExpand ¶ added in v0.1.3
type DiffExpand struct {
OldStart int // first hidden base-side line (1-based)
NewStart int // first hidden head-side line (1-based)
Count int // hidden line count, derived from the surrounding hunks
Dir string // "up" (gap above the first hunk) or "both" (between two hunks)
URL string // unfold link; empty in the pure builder, set by the web layer
}
DiffExpand describes the collapsed-context gap an expander row unfolds: the first hidden line on each side and how many lines the gap hides, plus the direction the unfold grows. The builder fills the line math (it is derivable from the patch); the web layer fills URL with the route that fetches those lines from the blob, since the pure builder knows neither the owner/repo/number nor the head SHA.
type DiffFileVM ¶
type DiffFileVM struct {
Path string
OldPath string // != "" for a rename or copy
PathHash string // the #diff-<hash> anchor id
Status FileStatus
Additions int
Deletions int
Mode DiffMode
Lang string
Rows []DiffRow
IsBinary bool
TooLarge bool
HeadSHA string
URL string // the head-side "View file" link
// OutdatedThreads are this file's review threads whose persisted anchor no
// longer maps onto a row in the current diff (the line moved or vanished under
// later commits). They are not placed against a row; the template renders them
// in a per-file outdated group so the conversation is not lost when the diff
// churns. The live-anchored threads hang off their DiffRow instead.
OutdatedThreads []ReviewThreadVM
}
DiffFileVM is one file's diff, the unit the diff_file partial renders. Rows is nil for a binary or otherwise special file (which renders a note, not rows) and for a file held back as too large to inline.
func BuildDiffFile ¶
func BuildDiffFile(path, oldPath string, status FileStatus, additions, deletions int, patch string, mode DiffMode) DiffFileVM
BuildDiffFile parses a file's unified-diff patch text and builds its row list in the given mode. status, path, oldPath, and the line counts come from the producer's per-file record; patch is the hunk text (empty for a binary file). A binary file (a non-empty change with no patch) yields no rows and IsBinary. A patch past the per-file caps yields no rows and TooLarge.
func (DiffFileVM) IsSplit ¶ added in v0.1.3
func (f DiffFileVM) IsSplit() bool
IsSplit reports whether the file renders side-by-side, the base column left of the head column. The same row list drives unified and split; only the template shaping differs, so the partial branches on this.
type DiffMode ¶
type DiffMode int
DiffMode is the page-level rendering mode. The same rows render either way.
type DiffRow ¶
type DiffRow struct {
Kind RowKind
OldLine int
NewLine int
Text template.HTML // unified single cell
OldText template.HTML // split left cell
NewText template.HTML // split right cell
Side Side
Position int
Hunk int
NoEOL bool
AnchorSide string // "LEFT", "RIGHT", or "" for a structural row
AnchorLine int // file line the comment anchors to, 0 when not commentable
Threads []ReviewThreadVM
// Expand is set on a RowExpander: the collapsed-context gap this row unfolds.
// It is nil on every other kind.
Expand *DiffExpand
// contains filtered or unexported fields
}
DiffRow is one rendered line. For unified, Text is the single code cell; for split, OldText and NewText are the two code cells. OldLine and NewLine are the base- and head-side line numbers (0 when the side does not apply). Position is the diff offset; 0 means the row is not commentable.
AnchorSide and AnchorLine are the (side, line) a review comment on this row anchors to, the persisted anchor model (never Position). A deletion anchors LEFT at its base line, an addition or a context line RIGHT at its head line, so a thread the domain stores against (path, line, side) finds its row again. Threads are the inline threads the build layer attaches at this row; the pure builder leaves the slice nil and the handler fills it after it loads the domain's resolved threads.
func BuildContextRows ¶ added in v0.1.3
BuildContextRows builds the rows an unfold reveals: count lines of the file starting at the given base/head line, taken from the head blob's content. The two sides advance together because an unfolded line is unchanged context, so OldLine and NewLine stay in lockstep. The rows carry Position 0: a line that was not in the patch is read-only context, never a comment anchor, which keeps the patch-offset space the review API resolves against untouched. A range past the end of the file stops early, so a too-eager unfold yields what exists and no more.
func (DiffRow) CellClass ¶
CellClass is the CSS modifier the template puts on the row's code cell so the stylesheet colors additions, deletions, and context distinctly.
func (DiffRow) Commentable ¶
Commentable reports whether a review comment could anchor to this row: it has a counted position and is a code line, not a structural header. F4 renders the diff read-only, so the template uses this only to mark anchorable lines; the inline composer arrives in F5.
func (DiffRow) CommentsLeft ¶ added in v0.1.3
CommentsLeft reports whether a split-mode inline composer for this row belongs in the base column, the case for a deletion the viewer anchors a comment to.
func (DiffRow) CommentsRight ¶ added in v0.1.3
CommentsRight reports whether a split-mode inline composer for this row belongs in the head column, the case for an addition or context line.
func (DiffRow) IsAddition ¶
IsAddition reports whether the row is an added line (head side).
func (DiffRow) IsDeletion ¶
IsDeletion reports whether the row is a removed line (base side).
func (DiffRow) IsExpander ¶ added in v0.1.3
IsExpander reports whether the row is a collapsed-context gap: the template renders it as an unfold control rather than a code line.
func (DiffRow) IsHunkHeader ¶
IsHunkHeader reports whether the row is an @@ hunk header, which the template renders as a full-width section divider rather than a code line.
func (DiffRow) IsReplace ¶ added in v0.1.3
IsReplace reports whether the row is a split-only paired change: a deletion in the base column lined up with the addition that replaced it in the head column. It exists only in split mode, where the builder zips contiguous deletion and addition runs together.
func (DiffRow) LeftClass ¶ added in v0.1.3
LeftClass is the CSS modifier for the base-column cell: a deletion tint for a removed or replaced line, an empty filler opposite an addition, context otherwise.
func (DiffRow) LeftText ¶ added in v0.1.3
LeftText is the base-column code cell in split mode: the deleted text for a replacement, the line itself for a deletion or context, and empty for an addition (which has no base side).
func (DiffRow) NewLineLabel ¶
NewLineLabel is the head-side line number for the gutter, blank when the row has no head side (a deletion or a hunk header).
func (DiffRow) OldLineLabel ¶
OldLineLabel is the base-side line number for the gutter, blank when the row has no base side (an addition or a hunk header).
func (DiffRow) RightClass ¶ added in v0.1.3
RightClass is the CSS modifier for the head-column cell: an addition tint for an added or replaced line, an empty filler opposite a deletion, context otherwise.
type DiffToggleVM ¶ added in v0.1.3
type DiffToggleVM struct {
Split bool
IgnoreWS bool
UnifiedURL string
SplitURL string
ShowWSURL string
HideWSURL string
}
DiffToggleVM is the unified/split and hide-whitespace controls on a diff page. Split and IgnoreWS report the current axes; each URL re-requests the same page flipping one axis while preserving the other, so toggling the mode keeps ?w=1 and toggling whitespace keeps ?diff=split.
type FeedItemVM ¶
type FeedItemVM struct {
Icon string
ActorLogin string
ActorURL string
Verb string // "opened an issue in", "pushed to", "created a branch in", ...
RepoFullName string
RepoURL string
Target string // "#5 Fix the parser", a branch name, or empty
TargetURL string // the link for the target, or empty for an unlinked target
CreatedAt string
CreatedISO string
}
FeedItemVM is one entry in the activity feed: the octicon the event reads as, the actor, the verb phrase ("opened an issue in", "pushed to", "starred"), the repository the event happened in, an optional target (an issue or pull number with its title) the verb points at, and the timestamps. The phrase is split into the verb and the target so the template links the repository and the target independently; the handler composes both from the stored event so the view stays pure data. The icon name is registered in the icon set because it is referenced through this field rather than a template literal.
type FileFinderVM ¶
type FileFinderVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Ref string
Files []FinderEntry
Truncated bool
}
FileFinderVM is the fuzzy file index at a ref: the flattened file list as plain links, plus a truncation flag the handler logs when the recursive tree is capped. See implementation/07 section 10.4.
type FileStatus ¶
type FileStatus string
FileStatus is the change kind, GitHub's vocabulary. It drives the status icon and the added/removed styling.
const ( StatusAdded FileStatus = "added" StatusModified FileStatus = "modified" StatusRemoved FileStatus = "removed" StatusRenamed FileStatus = "renamed" StatusCopied FileStatus = "copied" StatusTypeChange FileStatus = "changed" )
FileStatus values follow GitHub's change vocabulary, from a newly added file to a type change.
func (FileStatus) StatusIcon ¶
func (s FileStatus) StatusIcon() string
StatusIcon is the octicon for a file's change kind, every name registered in the icon set (the coverage test guarantees it).
func (FileStatus) StatusLabel ¶
func (s FileStatus) StatusLabel() string
StatusLabel is the human word for a file's change kind, for the file-row aria label and tooltip.
type FilterTab ¶
FilterTab is one state tab in the index bar: the label, the count, the filter href, and whether it is the active state.
type FinderEntry ¶
FinderEntry is one file in the finder: the path and its blob URL.
type Flash ¶
Flash is one server-set message shown once. Kind is success, error or info and maps to a CSS modifier.
func FlashesFrom ¶
FlashesFrom returns the stored flashes, or nil when none.
type HeaderKV ¶
HeaderKV is one header line in a delivery's request or response, kept as an ordered pair so the template prints the headers without ranging a map (whose order Go randomizes). The handler sorts them for a stable view.
type HomeRepoVM ¶ added in v0.1.3
HomeRepoVM is one repository line in the dashboard sidebar: the full name the link shows and the lock the private ones carry.
type HomeVM ¶
type HomeVM struct {
Chrome Chrome
Repos []HomeRepoVM // the viewer's repositories, newest activity first
ReposURL string // the "show all" link to the profile repositories tab
NewRepoURL string // the create-repository form, /new
Feed []FeedItemVM // the viewer's recent activity, the profile catalog's lines
FeedEmpty bool
}
HomeVM is the landing page model: the dashboard for a signed-in viewer, the sign-in blankslate for an anonymous one, switched on Chrome.Viewer. The dashboard carries the viewer's repositories for the sidebar and their recent activity for the feed; the fe/web/home handlers fill both, so / and /dashboard render the same page from the same model.
type HookDeliveryDetailVM ¶
type HookDeliveryDetailVM struct {
Chrome Chrome
BackURL string
Row HookDeliveryRowVM
RequestHeaders []HeaderKV
RequestBody string
ResponseHeaders []HeaderKV
ResponseBody string
}
HookDeliveryDetailVM is one recorded delivery in full: the request and response headers and bodies the worker stored, so an integrator can see exactly what Githome sent and what the endpoint answered. BackURL returns to the hook.
type HookDeliveryRowVM ¶
type HookDeliveryRowVM struct {
URL string
GUID string
Event string
StatusIcon string
StatusKind string
StatusLabel string
Redelivery bool
DeliveredAt string
DeliveredISO string
RedeliverAction string
}
HookDeliveryRowVM is one entry in a webhook's delivery history (and the header of the delivery detail page): the event, the status of the attempt, whether it was a manual redelivery, and the link to its full record. RedeliverAction is the POST target that replays it.
type HookEventChoice ¶
HookEventChoice is one event checkbox on the webhook form: the stored event name, its human label, and whether the hook currently subscribes to it.
func HookEventChoices ¶
func HookEventChoices(events []string) []HookEventChoice
HookEventChoices returns the event checkboxes with the hook's current subscription checked. A subscription carrying the wildcard checks nothing here; the form drives the wildcard through its own "everything" control, read with HookSubscribesAll.
type HookFormVM ¶
type HookFormVM struct {
Chrome Chrome
Title string
Action string
IsNew bool
DeleteAction string
FormError string
PayloadURL string
ContentType string
HasSecret bool
InsecureSSL bool
Active bool
ContentTypes []AppearanceOption
Events []HookEventChoice
Everything bool
Deliveries []HookDeliveryRowVM
}
HookFormVM is the shared create-and-edit webhook form. IsNew picks the heading, the submit label, and whether the delete control and the delivery history show. The secret is never rendered back: HasSecret reports only whether one is set, so the field is always blank and a save that leaves it blank keeps the stored secret (the handler reads a separate clear control to remove it). FormError carries an inline validation message so a bad URL re-renders the filled form rather than an error page.
type HookListVM ¶
type HookListVM struct {
Chrome Chrome
RepoFullName string
NewURL string
Hooks []HookRowVM
Empty bool
}
HookListVM is a repository's webhooks list: a row per hook with its delivery target, its active state, the events it fires on, and the status of its most recent delivery. Empty drives the blankslate for a repository with no hooks.
type HookRowVM ¶
type HookRowVM struct {
URL string
Target string
Active bool
Events string
StatusIcon string
StatusKind string
StatusLabel string
}
HookRowVM is one row in the webhooks list. Target is the delivery URL shown as the row title and linking to the hook's edit page; Events is the human summary of the subscription; the status pair reads the most recent delivery so a viewer sees at a glance whether the endpoint is answering.
type InlineComposerVM ¶
type InlineComposerVM struct {
Action string
Path string
Side string
Line int
CommitID string
CSRFToken string
}
InlineComposerVM is the new-thread composer a commentable diff row reveals: the POST target, the anchor fields it submits (path, side, line, and the head commit id the comment pins to), and the CSRF token. The UI never submits a diff position; the anchor is the persisted (path, line, side) the domain validates against the diff for CommitID.
type IssueDetailVM ¶
type IssueDetailVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Number int64
Title string
State IssueStateVM
Author UserChipVM
OpenedAt string
OpenedISO string
Locked bool
EditURL string // the edit-title form target, shown when the viewer can edit
CanEdit bool
Timeline []CommentVM
TimelinePager Pager // prev/next over a long comment thread; zero value hides it
Sidebar SidebarVM
Composer ComposerVM
Reactions ReactionsVM // the rollup on the opening body
FormError string // a validation message echoed back into the page
}
IssueDetailVM is the issue detail page: the title and state header, the comment timeline, the sidebar, and the composer.
type IssueIndexVM ¶
type IssueIndexVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
QueryValue string
OpenTab FilterTab
ClosedTab FilterTab
ActiveChips []LabelVM // the active label filters, each with a remove URL
Rows []IssueRow
NewIssueURL string
Pager Pager
Empty bool // true when the filtered list is empty
EmptyReason string // a human line for the blankslate
}
IssueIndexVM is the issues index: the header, the search-and-filter bar, the list, and the pagination. QueryValue is the literal q string the search input shows; the tabs and chips carry composed hrefs built by the Query composer.
type IssueResultVM ¶
type IssueResultVM struct {
Number int64
Title string
URL string
State IssueStateVM
Author UserChipVM
OpenedAt string
OpenedISO string
CommentCount int
RepoFullName string
RepoURL string
}
IssueResultVM is one issue or pull request in the cross-repository results: the issue-row fields plus the repository-context line a cross-repo result needs, since the request path does not imply the repo. The same shape backs both the issues and the pull-requests rails; the URL already points at /issues/{n} or /pull/{n}, so the template does not branch.
type IssueRow ¶
type IssueRow struct {
Number int64
Title string
URL string
State IssueStateVM
Author UserChipVM
OpenedAt string // already formatted, relativeTime handles the page
OpenedISO string // the machine-readable timestamp for <time datetime>
Labels []LabelVM
Assignees []UserChipVM
Milestone *MilestoneVM
CommentCount int
}
IssueRow is one row in the index list: the state badge, the number and title link, the meta line (opened by, when), the labels, the assignee avatars, and the comment count.
type IssueStateVM ¶
type IssueStateVM struct {
State string // "open" | "closed"
Reason string // "completed" | "not_planned" | "reopened" | ""
Label string // "Open" | "Closed"
Icon string // the octicon name
Modifier string // "open" | "closed" | "not-planned"
}
IssueStateVM is the open/closed badge shared by the index rows and the detail header: a label, an octicon, and a CSS modifier the stylesheet colors (green open, purple completed, gray not-planned).
type LabelVM ¶
type LabelVM struct {
Name string
R, G, B int // the label color channels, 0-255
Description string
URL string
}
LabelVM is one issue label as a chip: the name, the label color split into its RGB channels (the template emits them as --label-r/g/b custom properties and the theme recipe mixes the final colors, so the chip re-themes in dark modes), and the index URL that filters to it.
type LabelsVM ¶ added in v0.1.3
type LabelsVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Labels []LabelVM
Count int
}
LabelsVM is the repository label list page: every label with its color chip, description, and the issues-index URL that filters to it.
type MergeBoxState ¶
type MergeBoxState int
MergeBoxState is the visual state of the merge box, derived once from the cached mergeability columns. The template is a switch on this; each state renders its own control cluster.
const ( MergeComputing MergeBoxState = iota // mergeable_state unknown: spinner, poll MergeDraft // a draft PR: Ready-for-review control MergeClean // mergeable: the green Merge control MergeBehind // clean but behind base: Update-branch note MergeDirty // conflicts: Resolve-conflicts entry, no merge MergeBlocked // F5: required reviews/checks not satisfied MergeUnstable // F9: a non-required check failed MergeHasHooks // pre-receive hooks present MergeQueue // merge queue enabled MergeMerged // post-merge panel MergeClosed // closed unmerged )
MergeBoxState values: from the still-computing spinner through the clean, behind, dirty, blocked, and unstable states the merge box renders.
func DeriveMergeBoxState ¶
func DeriveMergeBoxState(merged bool, state, mergeableState string) MergeBoxState
DeriveMergeBoxState maps the domain mergeability and lifecycle columns onto the visual state. It does no git work: it reads the columns the mergeability worker filled, so the box and a concurrent API read agree. It takes primitives, not a domain value, to keep fe/view domain-free. The blocked, unstable, has_hooks, and queue states are not produced by the live worker yet (F5 and F9); they are in the enum so the template and the next milestone do not need a reshape.
func (MergeBoxState) Headline ¶
func (s MergeBoxState) Headline() string
Headline is the one-line status the box header shows for the state.
func (MergeBoxState) IsBehind ¶
func (s MergeBoxState) IsBehind() bool
IsBehind reports whether the head trails the base but does not conflict, which still merges (a merge commit subsumes the catch-up) but shows an update note.
func (MergeBoxState) IsBlocked ¶
func (s MergeBoxState) IsBlocked() bool
IsBlocked reports whether a required review or check is unmet (F5/F9 fill this).
func (MergeBoxState) IsClean ¶
func (s MergeBoxState) IsClean() bool
IsClean reports whether the PR is mergeable with no conflicts, the green-control state.
func (MergeBoxState) IsClosed ¶
func (s MergeBoxState) IsClosed() bool
IsClosed reports whether the PR is closed unmerged.
func (MergeBoxState) IsComputing ¶
func (s MergeBoxState) IsComputing() bool
IsComputing reports whether the box is still waiting on the mergeability worker, the one state that polls itself until it resolves.
func (MergeBoxState) IsDirty ¶
func (s MergeBoxState) IsDirty() bool
IsDirty reports whether the PR has conflicts that block an in-app merge.
func (MergeBoxState) IsDraft ¶
func (s MergeBoxState) IsDraft() bool
IsDraft reports whether the PR is a draft, which shows the ready-for-review note instead of a merge control.
func (MergeBoxState) IsMerged ¶
func (s MergeBoxState) IsMerged() bool
IsMerged reports whether the PR is already merged, the post-merge panel.
func (MergeBoxState) MergeIcon ¶
func (s MergeBoxState) MergeIcon() string
MergeIcon is the octicon the box header shows for the state, every name registered in the icon set (the coverage test guarantees it).
func (MergeBoxState) Mergeable ¶
func (s MergeBoxState) Mergeable() bool
Mergeable reports whether the box should offer a green merge control: a clean or a behind-but-not-conflicting PR. The handler gates ViewerCanMerge on write access on top of this; the template shows the control only when both agree.
func (MergeBoxState) Modifier ¶
func (s MergeBoxState) Modifier() string
Modifier is the CSS token the stylesheet colors the box header by.
type MergeBoxVM ¶
type MergeBoxVM struct {
State MergeBoxState
Checks ChecksRollupVM
Reviews ReviewRollupVM
HeadSHA string
Methods []MergeMethodVM
PrimaryMethod string
BlockReasons []string
ViewerCanMerge bool
HeadRefExists bool
CanReopen bool
MergeURL string // POST target for the merge
PollURL string // GET target the Computing state re-fetches
DefaultCommitTitle string
// CSRFToken is read from Chrome on the full page; the standalone fragment
// carries it directly so the merge form posts with a token either way.
CSRFToken string
}
MergeBoxVM is the merge box on the Conversation tab: the derived state, the two rollups, the merge control, and the lifecycle affordances. HeadSHA rides along as the optimistic-concurrency token every merge form submits, so a merge of a head that moved out from under the viewer is rejected rather than silently merging the wrong tip. The box re-fetches itself while Computing.
type MergeMethodVM ¶
MergeMethodVM is one selectable merge strategy in the merge control: the method key the form submits, its human label, and whether it is the default. F4 offers all three git strategies; the per-repo allow-list that hides some arrives with the repository settings milestone (F8).
type MilestoneDetailVM ¶ added in v0.1.3
type MilestoneDetailVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Milestone MilestoneRowVM
OpenTab FilterTab
ClosedTab FilterTab
Rows []IssueRow
Pager Pager
Empty bool
EmptyReason string
}
MilestoneDetailVM is one milestone's page: the header block plus its issues, the same bounded rows the issues index renders, tabbed open/closed.
type MilestoneRowVM ¶ added in v0.1.3
type MilestoneRowVM struct {
Number int64
Title string
URL string
State string // open | closed
Description string
DueOn string // formatted; empty when the milestone has no due date
DueISO string
Overdue bool
ClosedAt string // formatted; set when the milestone is closed
OpenIssues int
ClosedIssues int
Percent int // completeness, 0-100
}
MilestoneRowVM is one milestone in the list and the header block of the milestone page: the title, the due and closed lines, the rendered progress, and the open/closed issue counts.
type MilestoneVM ¶
MilestoneVM is the milestone chip shown on a row and in the sidebar: the title and the index URL that filters to it.
type MilestonesVM ¶ added in v0.1.3
type MilestonesVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
OpenTab FilterTab
ClosedTab FilterTab
Items []MilestoneRowVM
NewURL string // left empty until a milestone create form exists
}
MilestonesVM is the milestone list page with its open/closed state tabs.
type NewIssueVM ¶
type NewIssueVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Action string
Title string
Body string
Labels []string // label names applied on creation, from ?labels= or the template
Assignees []string // assignee logins applied on creation, from ?assignees=
Milestone string // milestone number applied on creation, from ?milestone=
CanSubmit bool
FormError string
}
NewIssueVM is the new-issue form: the title and body fields (seeded from the documented prefill query or echoed back on a validation miss), the metadata the prefill asked to apply on creation, the submit target, and any form error.
type NotificationFilterVM ¶ added in v0.1.3
NotificationFilterVM is one link in the inbox's left rail: a label, the URL it points at, and whether it is the filter currently in effect.
type NotificationRowVM ¶ added in v0.1.3
type NotificationRowVM struct {
Title string
URL string
RepoFullName string
RepoURL string
Reason string // humanized, e.g. "mentioned", "review requested"
Unread bool
IsPull bool
UpdatedAt string
UpdatedISO string
}
NotificationRowVM is one thread in the inbox list: the subject and its link, the repository it belongs to, the humanized reason the viewer is subscribed, the unread marker, and when it last changed.
type NotificationsVM ¶ added in v0.1.3
type NotificationsVM struct {
Chrome Chrome
Filters []NotificationFilterVM // the left-rail filter links
Threads []NotificationRowVM // one row per thread on this page
Pager Pager // prev/next, omitted when a post-filter is active
Empty bool // true when no thread matches the current filter
// EmptyAll distinguishes a genuinely empty account (no notifications at all)
// from a filter that simply matched nothing, so the blankslate copy matches
// GitHub's two messages.
EmptyAll bool
}
NotificationsVM is the notifications inbox model. The inbox is backed by the notifications domain layer when it is available; when nil, an authenticated viewer sees the empty-inbox blankslate. An anonymous viewer is not shown an inbox — mountNotifications redirects before the view model is built.
type PRCheckDetailVM ¶ added in v0.1.3
type PRCheckDetailVM struct {
ID int64
Name string
App string
Token StatusToken
Duration string
WhenVerb string
WhenISO string
WhenHuman string
DetailsURL string
HasDetails bool
Title string
Summary string
SummaryHTML template.HTML
Text string
TextHTML template.HTML
HasOutput bool
}
PRCheckDetailVM is the selected run's detail pane under the list: the run's identity and status, its timing, and the reported output. The summary and the text render through the shared markup pipeline (a check run's output is markdown, the same dialect a comment body speaks); the raw strings ride along so an unconfigured markup falls back to escaped text instead of nothing.
type PRCheckRunRowVM ¶ added in v0.1.3
type PRCheckRunRowVM struct {
ID int64
Name string
Token StatusToken
Summary string
Duration string // "1m 32s" once started and completed, else empty
DetailsURL string
HasDetails bool
WhenVerb string
WhenISO string
WhenHuman string
// SelectURL is the tab URL with ?check_run_id= naming this run, the no-JS
// link that opens the detail pane; Selected marks the open run's row.
SelectURL string
Selected bool
}
PRCheckRunRowVM is one check run row on the Checks tab: the shared status token, the one-line output summary, the run's duration once it has both timestamps, the sanitized external details link, and the precomputed time line the standalone checks page also shows.
type PRCheckSuiteVM ¶ added in v0.1.3
type PRCheckSuiteVM struct {
App string
Runs []PRCheckRunRowVM
}
PRCheckSuiteVM is one check suite's group in the list: the reporting app's slug as the group heading and the suite's check runs.
type PRChecksVM ¶ added in v0.1.3
type PRChecksVM struct {
Chrome Chrome
Shell PRShellVM
SHA string
ShortSHA string
Rollup StatusToken
RollupTitle string
Total int
Suites []PRCheckSuiteVM
Statuses []CommitStatusRowVM
// Detail is the selected run's pane, present when ?check_run_id= names a
// run reported against this head. An id that matches nothing renders the
// plain list, never an error.
Detail *PRCheckDetailVM
Empty bool
}
PRChecksVM is the Checks tab: the shell every PR tab renders inside, the head sha the checks anchor to, the rollup verdict pill, the suite groups, and the commit-status rows. Empty is true when nothing has reported against the head, which renders the blankslate rather than a bare page.
type PRCommitDateGroup ¶
type PRCommitDateGroup struct {
Date string
Commits []PRCommitRow
}
PRCommitDateGroup is one day's heading and the commits authored that day.
type PRCommitRow ¶
type PRCommitRow struct {
SHA string
ShortSHA string
Title string
AuthorName string
When string
WhenISO string
}
PRCommitRow is one commit in the PR: the short and full sha, the title, the author, and the formatted authored-at time.
type PRCommitsVM ¶
type PRCommitsVM struct {
Chrome Chrome
Shell PRShellVM
Groups []PRCommitDateGroup
}
PRCommitsVM is the Commits tab: the shell plus the PR's commits grouped by calendar date, each row a short sha, a title, and an author.
type PRConversationVM ¶
type PRConversationVM struct {
Chrome Chrome
Shell PRShellVM
Timeline []PRTimelineItem
Composer ComposerVM
Reactions ReactionsVM
MergeBox MergeBoxVM
FormError string
}
PRConversationVM is the Conversation tab: the shell plus the comment timeline, the new-comment composer, the opening-body reaction rollup, and the merge box. The timeline is the same CommentVM stream the issue detail renders, because a PR shares its number and its comments with an issue.
type PRFilesVM ¶
type PRFilesVM struct {
Chrome Chrome
Shell PRShellVM
ChangedFiles int
Additions int
Deletions int
Files []DiffFileVM
Truncated bool // true when the file list was capped, logged by the handler
Review ReviewSurfaceVM // the inline-comment and review-verdict context (F5)
Diff DiffToggleVM // the unified/split control and which mode is current
}
PRFilesVM is the Files-changed tab: the shell plus the diff. It carries the per-file diff stats summary line and the list of file diffs the shared diff component built. The Files tab is read-only in F4; the inline review threads and the review state machine arrive in F5 over this same model.
type PRIndexVM ¶
type PRIndexVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
QueryValue string
OpenTab FilterTab
ClosedTab FilterTab
ActiveChips []LabelVM
Rows []PRRow
Pager Pager
Empty bool
EmptyReason string
}
PRIndexVM is the pull-request index: the header, the search-and-filter bar, the list, and the pagination. It is the issue index frame pre-filtered to PRs, so the open and closed tabs and the query input behave the same; only the rows and the empty line speak pull requests.
type PRRow ¶
type PRRow struct {
Number int64
Title string
URL string
State PRStateVM
Author UserChipVM
OpenedAt string
OpenedISO string
Labels []LabelVM
Assignees []UserChipVM
Milestone *MilestoneVM
CommentCount int
}
PRRow is one row in the pull-request index: the derived state mini-icon, the number and title link, the meta line, the labels, and the comment count. It mirrors IssueRow so the two lists read alike, with the four-state pill standing in for the issue's open/closed badge.
type PRShellVM ¶
type PRShellVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Number int64
Title string
State PRStateVM
Author UserChipVM
OpenedAt string
OpenedISO string
BaseRef string
HeadRef string
HeadLabel string // owner:branch for a cross-repo head, the bare ref otherwise
IsCrossRepo bool
CommitCount int
ChangedFiles int
CommentCount int
Additions int
Deletions int
IsMerged bool
IsClosed bool
MergedAt string
ActiveTab string // conversation | commits | checks | files
CanEdit bool
EditURL string
// The Checks tab shows only when the checks service is wired, the same gate
// the standalone checks page mounts behind. CheckCount is the head sha's
// rollup total (check runs plus commit statuses), so the tab badge, the
// merge box, and the tab page all count the same signals.
ShowChecksTab bool
CheckCount int
// The tab URLs, precomputed so the shell partial never builds a link.
ConversationURL string
CommitsURL string
ChecksURL string
FilesURL string
}
PRShellVM is the context every /pull/{n} tab renders inside: the four-state pill, the "wants to merge N commits into BASE from HEAD" byline, the tab bar with its counts, and the active-tab marker. All four tab handlers build the same shell so the header and tabs are byte-identical across tabs, only the slotted content differs.
type PRState ¶
type PRState int
PRState is the four-way display state of a pull request. REST carries only open/closed (merged is closed plus merged:true); the UI splits it four ways for the header pill and the list mini-icon, derived once by DerivePRState so the two never drift.
const ( PRStateOpen PRState = iota // green, git-pull-request PRStateDraft // gray, git-pull-request-draft PRStateMerged // purple, git-merge PRStateClosed // red, git-pull-request-closed )
PRState values: open, draft, merged, and closed, the four-way display state.
func DerivePRState ¶
DerivePRState maps the domain columns onto the four-way state. It takes the raw open/closed state string and the merged and draft flags rather than a domain value so fe/view stays free of a domain import. Merged wins over closed because a merged PR is stored closed; draft only applies to an otherwise-open PR.
func (PRState) Icon ¶
Icon is the octicon name for the state. Every name is registered in the icon set (the coverage test guarantees it).
type PRStateVM ¶
PRStateVM is the derived pill the index rows and the shell header both render, flattened so a template prints fields instead of calling methods.
type PRTimelineItem ¶
type PRTimelineItem struct {
Kind string // "comment" or "review"
Comment CommentVM
Review ReviewSummaryVM
}
PRTimelineItem is one entry in the merged Conversation timeline: either a comment or a submitted review, tagged so the template dispatches to the right partial. The handler builds the merged list sorted by time, because a review and a comment interleave by when they happened, not by type.
func (PRTimelineItem) IsReview ¶
func (i PRTimelineItem) IsReview() bool
IsReview reports whether the item is a submitted review, for the template switch.
type Pager ¶
Pager is the prev/next pagination for a list: the page number and the URLs, empty when there is no previous or next page.
type ProfileHeaderVM ¶
type ProfileHeaderVM struct {
Login string
Name string
AvatarURL string
IsOrg bool
Bio string // the account's short bio, shown as escaped plain text
Company string
Location string
Blog string // the display text for the website row
BlogURL string // the href for the website row, normalized to an absolute URL
Email string // shown only when the account made it public
TwitterHandle string // without the leading @, shown only when set
TwitterURL string
Joined string // the human "Joined Jan 2006" line
JoinedISO string // the machine datetime for the relative-time element
PublicRepos int
Followers int
Following int
}
ProfileHeaderVM is the identity card a profile wears: the login and display name, the avatar, the organization flag that swaps the icon and drops the person-only vcard rows, the bio, and the vcard details. Each vcard row is a resolved string with its optional link already built, so the template only decides whether the string is present. Counts are plain integers; the followers and following lists are not a backed surface, so the header shows the numbers without linking them, never a dead link.
type ProfileOverviewVM ¶
type ProfileOverviewVM struct {
PopularRepos []RepoResultVM
ReposURL string // the "show all" link to the repositories tab
Activity []FeedItemVM
ActivityEmpty bool
Empty bool // true when the account has no public repos and no activity yet
}
ProfileOverviewVM is the overview tab body: a short grid of the owner's most recently updated repositories and the recent-activity timeline. The Empty flag and the activity blankslate carry the honest empty states (a fresh account with no public repositories, an account with no public activity yet).
type ProfilePageVM ¶
type ProfilePageVM struct {
Chrome Chrome
Header ProfileHeaderVM
Tabs []ProfileTab
ActiveTab string
FollowersURL string
FollowingURL string
Overview ProfileOverviewVM
Repos ProfileReposVM
Stars ProfileStarsVM
People ProfilePeopleVM
}
ProfilePageVM is the whole profile page: the shell, the identity header, the tab strip, and exactly one tab body filled (the overview, repositories, stars, or a people list). The template switches on ActiveTab so the unused bodies are zero. FollowersURL and FollowingURL link the identity card's count line to the people tabs, the way GitHub's profile sidebar does.
type ProfilePeopleVM ¶ added in v0.1.3
type ProfilePeopleVM struct {
Heading string
Users []UserCardVM
Pager Pager
Empty bool
EmptyReason string
}
ProfilePeopleVM is a followers or following tab body: a list of accounts with the pager, and the blankslate for an account with no followers (or that follows no one). The Heading names which list it is so the template needs no per-tab branch.
type ProfileReposVM ¶
type ProfileReposVM struct {
Items []RepoResultVM
Sorts []SearchSortOption
Pager Pager
Query string // the active ?q= filter, echoed back into the find-a-repo box
OwnerLogin string // the account login, the find-a-repo form's action target
Empty bool
EmptyReason string
}
ProfileReposVM is the repositories tab body: the owner's visible repositories, the sort menu, the pager, and the blankslate for an owner with no repositories (or none matching the in-tab filter). It reuses the search row and sort models because the tab is backed by the same domain repository search scoped to the owner, so the two surfaces render the same row.
type ProfileSettingsVM ¶ added in v0.1.3
type ProfileSettingsVM struct {
Chrome Chrome
Action string
Name string
Email string
Bio string
Location string
Company string
Blog string
TwitterUsername string
FormError string
}
ProfileSettingsVM is the account profile settings page: the current field values prefilled into the form, so the viewer sees what is stored today and edits only what they want to change.
type ProfileStarsVM ¶ added in v0.1.3
type ProfileStarsVM struct {
Items []RepoResultVM
Pager Pager
Empty bool
EmptyReason string
}
ProfileStarsVM is the stars tab body: the repositories the account has starred, filtered by the viewer's visibility, with a pager. It reuses the search row the repositories tab and the search page render, so a starred repository looks the same wherever it appears. An account that has starred nothing the viewer can see renders the blankslate.
type ProfileTab ¶
type ProfileTab struct {
Key string
Label string
Icon string
URL string
IsActive bool
Count int
HasCount bool
}
ProfileTab is one entry in the tab strip: its key, label, the URL that selects it, whether it is current, and an optional count badge (the repositories tab shows the public-repo total). Overview carries no count.
type QuickSetupVM ¶
type QuickSetupVM struct {
Chrome Chrome
Header RepoHeaderVM
Clone CloneVM
}
QuickSetupVM is the empty-repo home: the header plus the clone-and-push setup blocks instead of a tree. See implementation/07 section 1.11.
type ReactionVM ¶
type ReactionVM struct {
Content string
Emoji string
Count int
Reacted bool
URL string // the POST target that toggles this reaction
}
ReactionVM is one reaction summary on the rollup bar: the content key, the emoji glyph, the count, whether the viewer reacted, and the toggle form URL.
type ReactionsVM ¶
type ReactionsVM struct {
Subject string // "issue" | "comment", for the form's subject field
Items []ReactionVM // the eight contents, in canonical order
Total int
CanReact bool
}
ReactionsVM is the reaction rollup under a comment or issue body: the visible reactions (count > 0) and the picker of all eight contents.
type ReadmeVM ¶
type ReadmeVM struct {
Name string
Source string
Body template.HTML // empty for a non-markdown README; the template falls back to Source
}
ReadmeVM is the rendered README shown under a tree. Body carries the GFM-rendered, sanitized HTML the markup package produced (the only path from file content to trusted HTML); Source is the decoded bytes the template falls back to as escaped preformatted text when Body is empty (a non-markdown README, or markup unconfigured). See implementation/07 section 3.2.
type Ref ¶
Ref is the resolved-ref context shared by the tree, blob, and commits views: the ref as it appears in the URL (a branch, tag, or sha) and the commit it resolves to, which the permalink and the "browse at this commit" links use.
type RefChoice ¶
RefChoice is one entry in the ref picker: the ref name and the URL that switches to it while keeping the current view kind and path.
type RefPickerVM ¶
type RefPickerVM struct {
Current string
IsTag bool
Branches []RefChoice
Tags []RefChoice
MoreBranchesURL string // set when the branch list was capped
MoreTagsURL string // set when the tag list was capped
}
RefPickerVM is the branch/tag switcher. It lists the refs inline (bounded) and each entry carries the URL that keeps the viewer on the same view kind and path. The entries render as plain links so the picker works with no JS. Each group is capped; when the cap bites, the More URL points at the full branches or tags page so every ref stays reachable.
type RepoGeneralVM ¶ added in v0.1.3
type RepoGeneralVM struct {
Chrome Chrome
RepoFullName string
Action string
Name string
Description string
Branches []AppearanceOption
HasBranches bool
Private bool
VisibilityAction string
DeleteAction string
FormError string
}
RepoGeneralVM is a repository's General settings page: the first thing /{owner}/{repo}/settings shows. The main form renames the repository, edits its description, and changes its default branch, all backed by the domain UpdateRepo the REST surface writes through. The danger zone flips the repository between public and private and deletes it, each its own post the page confirms. FormError carries an inline message so a rejected change re-renders the filled form rather than an error page. Sections Githome does not yet back (collaborators, branch protection, deploy keys) get no form here, the same honest absence the rest of the settings tree took.
type RepoHeaderVM ¶
type RepoHeaderVM struct {
Owner string
Name string
OwnerURL string
URL string
Description string
Private bool
Fork bool
ParentName string // owner/name of the fork parent, empty when not a fork
ParentURL string
ActiveTab string // code | issues | pulls | commits | branches | tags | settings, drives the underline nav
OpenIssues int // open-issue count for the Issues tab counter, 0 hides it
CanSettings bool // the viewer administers the repo, so the Settings tab shows (github.com hides it otherwise)
}
RepoHeaderVM is the context bar above every repo page: the owner/name with the visibility pill and the fork-of line. OpenIssues feeds the counter chip on the Issues tab; the star/watch/fork counts stay absent until the domain tracks them (implementation/07 section 3.1 notes the gap).
type RepoHomeVM ¶
type RepoHomeVM struct {
Chrome Chrome
Header RepoHeaderVM
Tree TreeVM
About AboutVM
Readme *ReadmeVM // nil when the root has no README
}
RepoHomeVM is the repo home: the header, the default-root tree, the About sidebar, and the README.
type RepoNewVM ¶ added in v0.1.3
type RepoNewVM struct {
Chrome Chrome
Owner string // the viewer's login, the one owner the create accepts
Action string // the POST target, /new
NameValue string
DescriptionValue string
Private bool
FormError string // the inline validation message, empty on a fresh form
}
RepoNewVM is the create-repository form. Owner is the login the repository is created under: Githome's create gate is the viewer themself (the same rule the REST create enforces), so the owner control shows the one owner the service will accept. The Value fields carry the submitted input back into a re-rendered form so a validation miss never eats what the viewer typed. The repository is created empty; the redirect lands on the repo home, whose quick-setup view walks the first push, so the form carries no init checkboxes for content the create service does not write.
type RepoRef ¶
RepoRef is the small identity every repo view carries: the owner login, the repo name, and the precomputed home URL. Templates use it for the breadcrumb root and the clone block heading.
type RepoResultVM ¶
type RepoResultVM struct {
FullName string
URL string
OwnerURL string
OwnerLogin string
Description string
Private bool
Fork bool
Archived bool
UpdatedAt string
UpdatedISO string
}
RepoResultVM is one repository in the repositories results: its full name and URL, the owner link, the one-line description, the state badges, and the last push time. It carries no star button because the web front's domain repo value does not surface a star count yet; the row links to the repo where stars live.
type ReviewCommentVM ¶
type ReviewCommentVM struct {
ID int64
Author UserChipVM
Body template.HTML
BodySource string
CreatedAt string
CreatedISO string
Edited bool
Anchor string // "discussion_r{id}" for the permalink fragment
URL string
}
ReviewCommentVM is one comment inside an inline thread: the author chip, the GFM-rendered body, the raw source for an edit box, the timestamps, and the permalink anchor. It mirrors CommentVM but carries the discussion anchor the review thread uses rather than the issuecomment anchor.
type ReviewOverlayVM ¶
type ReviewOverlayVM struct {
Action string
CanApprove bool // write access and not the PR author
CanComment bool // any signed-in viewer who can see the repo
CSRFToken string
}
ReviewOverlayVM is the "Review changes" panel that submits a PR-level verdict: the POST target, whether the viewer may approve or request changes (write access and not the PR author, the same rule the domain enforces), and the CSRF token. A viewer who can only comment still sees the overlay with the approve and request options disabled, so the affordance never lies about what the submit will accept.
type ReviewRollupVM ¶
type ReviewRollupVM struct {
Decision string // Approved | Changes requested | Review required
Present bool
}
ReviewRollupVM is the review-decision summary. It is empty until the code-review milestone (F5) fills it.
type ReviewState ¶
type ReviewState int
ReviewState is the display state of a submitted review, the same five the domain ReviewService stores. PENDING never reaches the timeline (a draft is private to its author until submitted), but it is in the enum so the mapping is total.
const ( ReviewStatePending ReviewState = iota // a private draft, never shown ReviewStateApproved // green check ReviewStateChangesRequested // red request-changes ReviewStateCommented // gray comment ReviewStateDismissed // struck-through, no longer counts )
ReviewState values: from a private pending draft through approved, changes requested, commented, and dismissed.
func DeriveReviewState ¶
func DeriveReviewState(state string) ReviewState
DeriveReviewState maps the domain review state string onto the display state. It takes the raw string rather than a domain value so fe/view stays domain-free; an unknown value reads as a plain comment, the most neutral rendering.
func (ReviewState) Icon ¶
func (s ReviewState) Icon() string
Icon is the octicon for the review state, every name registered in the icon set (the coverage test guarantees it).
func (ReviewState) Label ¶
func (s ReviewState) Label() string
Label is the human phrase the timeline header shows after the reviewer's login.
func (ReviewState) Modifier ¶
func (s ReviewState) Modifier() string
Modifier is the CSS modifier the stylesheet colors the review header by: approved green, changes requested red, dismissed and commented gray.
func (ReviewState) StateVM ¶
func (s ReviewState) StateVM() ReviewStateVM
StateVM flattens the derived review state.
type ReviewStateVM ¶
ReviewStateVM flattens the derived state into the printable header model, so the template prints fields instead of calling methods.
type ReviewSummaryVM ¶
type ReviewSummaryVM struct {
Author UserChipVM
State ReviewStateVM
Body template.HTML
HasBody bool
SubmittedAt string
SubmittedISO string
CommentCount int
Anchor string
URL string
}
ReviewSummaryVM is a submitted review as the Conversation timeline shows it: the reviewer chip, the derived state header, the optional rendered body, the count of inline comments the review carried, and the permalink. A pending draft never becomes a summary; only submitted reviews reach the timeline.
type ReviewSurfaceVM ¶
type ReviewSurfaceVM struct {
CanComment bool
CommentAction string
CommitID string
CSRFToken string
Overlay ReviewOverlayVM
}
ReviewSurfaceVM is the page-level review context the Files tab carries: whether the viewer may open inline threads, the POST target a new inline comment submits to, the head commit id every new thread pins to, the CSRF token, and the overlay model for the PR-level verdict. The per-row composer reads the file's path and the row's (side, line); the surface supplies the rest so a row never builds a form on its own.
type ReviewThreadVM ¶
type ReviewThreadVM struct {
ID int64
Path string
Side string // "LEFT" or "RIGHT"
Line int
IsResolved bool
IsOutdated bool
Comments []ReviewCommentVM
CanReply bool
CanResolve bool
ReplyURL string // POST target that appends a reply to this thread
ResolveURL string // POST target that toggles resolved
CSRFToken string
}
ReviewThreadVM is one inline review thread anchored to a diff row by its persisted (path, line, side): the comments in posting order, the resolved and outdated flags, and the reply and resolve form targets with the affordance gates. The builder leaves the form fields empty for a viewer who cannot act, so the template shows the thread read-only without a second permission check.
func (ReviewThreadVM) ReplyCount ¶
func (t ReviewThreadVM) ReplyCount() int
ReplyCount is the number of replies after the first comment, for the collapsed thread summary the template shows.
func (ReviewThreadVM) ResolveLabel ¶
func (t ReviewThreadVM) ResolveLabel() string
ResolveLabel is the verb the resolve button shows, the opposite of the current state so the one button toggles.
type RowKind ¶
type RowKind int
RowKind tags a row for the template. Replace is a split-only pairing of a deletion with the addition opposite it; Expander is a collapsed-context gap.
type SearchPageVM ¶
type SearchPageVM struct {
Chrome Chrome
Scope string
// Header and Nav render the repo context bar on an in-repo search; both are
// zero on a global search and the template omits the bar.
Header RepoHeaderVM
Repo RepoRef
QueryValue string // the raw q the input shows
Action string // the search form's GET target (/search or the repo search)
ActiveType string
Types []SearchTab
Sorts []SearchSortOption
Total int
Notes []string
Repos []RepoResultVM
Issues []IssueResultVM
Code []CodeResultVM
Pager Pager
Landing bool // true when q is empty: the search landing, no rows, no count
Empty bool // true when a non-empty query matched nothing
EmptyReason string // the blankslate line for an empty result
}
SearchPageVM is the search results page: the query box value, the scope, the optional repo header (in-repo search), the type rail, the sort menu, the active type's rows, any notes (an incomplete code walk, a missing scope), and the pager. Only the slice matching ActiveType is populated; the template switches on ActiveType so an unused slice is nil.
type SearchSortOption ¶
SearchSortOption is one entry in the sort menu: its label, the faceted URL that applies it, and whether it is the active sort. Code search has no sort, so its menu is empty and the template hides the control.
type SearchTab ¶
type SearchTab struct {
Key string
Label string
Icon string
URL string
IsActive bool
Count int
HasCount bool
}
SearchTab is one result-type tab in the rail: the type key it selects, its label and octicon, the faceted URL that switches to it (q and the sort kept intact), whether it is the active type, and an optional match count. Code carries no count off the active tab because counting code means walking a tree, so HasCount is false there rather than showing a misleading zero.
type SettingsNav ¶
type SettingsNav struct {
}
SettingsNav is the sidebar a settings page wears: a heading naming the account or repository the settings belong to, the link the heading points at, and the section links. The strip is text only, the way GitHub's settings sidebar is, so it needs no per-item icon. A section Githome does not back is simply not in Items, never a disabled row.
type SettingsNavItem ¶
type SettingsNavItem struct {
}
SettingsNavItem is one section link in the settings sidebar: its label, the URL that selects it, and whether it is the current section.
type Side ¶
type Side int
Side is which column a row belongs to. A deletion is LEFT (base), an addition RIGHT (head), a context row spans both, and a structural row (hunk header, expander) belongs to neither.
type SidebarVM ¶
type SidebarVM struct {
Assignees []UserChipVM
Labels []LabelVM
Milestone *MilestoneVM
CanEdit bool
EditURL string // the EditIssue form target for label/assignee/milestone edits
}
SidebarVM is the issue detail sidebar: the assignees, labels, and milestone as the viewer sees them, plus whether the viewer can edit them (which reveals the pickers).
type StatusToken ¶
type StatusToken struct {
Icon string // a registered octicon name
ColorClass string // a check-state-* CSS class (fe/assets settings/checks cascade)
Title string // the human label, e.g. "Successful"
Spin bool // an in-progress check animates its icon
}
StatusToken is the icon, color class, title, and spin flag for one check state. The view layer precomputes it into the row and pill VMs (the front's standing "view precomputes every string the template prints" rule), so a template prints .Token.Icon and .Token.ColorClass rather than calling a status helper. Spin is set only for an in-progress check, the one state the design system animates (and degrades to a static dot under prefers-reduced-motion or no-JS).
func CheckRunToken ¶
func CheckRunToken(status, conclusion string) StatusToken
CheckRunToken maps a check run's (status, conclusion) pair to its token. status is queued, in_progress, or completed (domain.CheckRun.Status); conclusion is set only once completed and is one of success, failure, neutral, cancelled, timed_out, action_required, skipped, or stale. An empty conclusion on a completed run reads as a bare completion. The enum strings are exactly the ones Spec 2003 doc 05 pins, so a renamed value surfaces as a drift the cross-product test catches rather than a silently wrong icon.
func CommitStatusToken ¶
func CommitStatusToken(state string) StatusToken
CommitStatusToken maps a commit status's flat state (error, failure, pending, success) to its token. The error and failure states both read as a red failing mark, matching how the combined status folds error into failure.
func RollupToken ¶
func RollupToken(state string) StatusToken
RollupToken maps a status-check rollup's worst-first verdict (the domain.Rollup* constants: ERROR, FAILURE, PENDING, SUCCESS, EXPECTED) to the token the page's summary pill shows. EXPECTED means a required context has not reported yet, so it reads as pending rather than as a pass.
type TagRowVM ¶
type TagRowVM struct {
Name string
ShortSHA string
Message string
TreeURL string
ZipURL string
TarGzURL string
}
TagRowVM is one tag row: the name, the commit it points at, the tree URL, and the source-archive download links.
type TagsVM ¶
type TagsVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Items []TagRowVM
}
TagsVM is the tag overview, version-aware descending.
type TreeEntryVM ¶
type TreeEntryVM struct {
Name string
Path string
Type string // dir | file | symlink | submodule
Icon string // the octicon name for the type
Href string
SymlinkTarget string
SubmoduleURL string
}
TreeEntryVM is one row in a tree listing: the name, the type-driven octicon, and the precomputed URL (a directory links to /tree, a file to /blob).
type TreeNav ¶
type TreeNav struct {
}
TreeNav is the per-tab link set the repo underline nav renders. It is computed once per repo so every repo page shows the same tabs with the same URLs. The Issues tab joins the set in F3 and the Pull requests tab in F4, so the code, commits, branches, and tags views all link into the issues and pulls surfaces with one shared header.
type TreeVM ¶
type TreeVM struct {
Chrome Chrome
Header RepoHeaderVM
Repo RepoRef
Ref Ref
Path string
Crumbs []Crumb
RefPicker RefPickerVM
Latest CommitSummary
Entries []TreeEntryVM
Readme *ReadmeVM
Clone CloneVM
Embedded bool // true when rendered inside the home page (skips the shell parts)
}
TreeVM is a directory listing at a ref: the breadcrumb, the ref picker, the latest-commit bar, the entries (directories first), and an optional README.
type UserCardVM ¶ added in v0.1.3
UserCardVM is one entry in a people list (followers, following): the account's login and display name, its avatar, a short bio line, and the link to its profile. Every field is resolved in the handler so the template only prints, the same contract the rest of the profile models follow.
type UserChipVM ¶
UserChipVM is a small user reference: the login, the avatar URL, and the profile URL. Used for authors, assignees, and the closed-by line.
type Viewer ¶
Viewer is the signed-in user as the shell needs them: enough to render the avatar menu and link to their profile, nothing more.
func ViewerFrom ¶
ViewerFrom returns the stored viewer, or nil when anonymous or unset.