| 1 | {{ define "repo-header" -}} |
| 2 | <header class="shithub-repo-header"> |
| 3 | <div class="shithub-repo-header-inner"> |
| 4 | <h1 class="shithub-repo-page-title"> |
| 5 | <span class="shithub-repo-title-icon">{{ octicon "repo" }}</span> |
| 6 | <a href="/{{ .Owner }}/{{ .Repo.Name }}" class="shithub-repo-name">{{ .Repo.Name }}</a> |
| 7 | {{ if eq (printf "%s" .Repo.Visibility) "private" }}<span class="shithub-pill shithub-pill-private">Private</span>{{ else }}<span class="shithub-pill">Public</span>{{ end }} |
| 8 | </h1> |
| 9 | {{ $root := . }} |
| 10 | <div class="shithub-repo-actions" aria-label="Repository actions"> |
| 11 | {{ with .RepoActions }} |
| 12 | {{ if .IsLoggedIn }} |
| 13 | <details class="shithub-repo-action-menu"> |
| 14 | <summary class="shithub-repo-action shithub-repo-action-button" aria-label="Notification settings"> |
| 15 | {{ octicon "bell" }} |
| 16 | <span class="shithub-repo-action-label">Notifications</span> |
| 17 | {{ octicon "triangle-down" }} |
| 18 | </summary> |
| 19 | <div class="shithub-repo-action-popover" role="menu" aria-label="Notification settings"> |
| 20 | <strong>Notifications</strong> |
| 21 | {{ range .WatchOptions }} |
| 22 | <form method="post" action="/{{ $root.Owner }}/{{ $root.Repo.Name }}/watch" class="shithub-repo-action-option-form"> |
| 23 | <input type="hidden" name="csrf_token" value="{{ $root.CSRFToken }}"> |
| 24 | <input type="hidden" name="level" value="{{ .Level }}"> |
| 25 | <input type="hidden" name="return_to" value="{{ $root.RepoActions.ReturnTo }}"> |
| 26 | <button type="submit" class="shithub-repo-action-option{{ if .Checked }} is-selected{{ end }}" role="menuitemradio" aria-checked="{{ .Checked }}"> |
| 27 | <span class="shithub-repo-action-radio" aria-hidden="true"></span> |
| 28 | <span> |
| 29 | <span class="shithub-repo-action-option-title">{{ .Label }}</span> |
| 30 | <span class="shithub-repo-action-option-description">{{ .Description }}</span> |
| 31 | </span> |
| 32 | </button> |
| 33 | </form> |
| 34 | {{ end }} |
| 35 | <a href="/{{ $root.Owner }}/{{ $root.Repo.Name }}/watchers" class="shithub-repo-action-popover-link">{{ $root.Repo.WatcherCount }} watcher{{ if ne $root.Repo.WatcherCount 1 }}s{{ end }}</a> |
| 36 | </div> |
| 37 | </details> |
| 38 | <form method="post" action="/{{ $root.Owner }}/{{ $root.Repo.Name }}/fork" class="shithub-repo-action-form"> |
| 39 | <input type="hidden" name="csrf_token" value="{{ $root.CSRFToken }}"> |
| 40 | <button type="submit" class="shithub-repo-action"> |
| 41 | {{ octicon "repo-forked" }} |
| 42 | <span class="shithub-repo-action-label">Fork</span> |
| 43 | <span class="shithub-counter">{{ $root.Repo.ForkCount }}</span> |
| 44 | </button> |
| 45 | </form> |
| 46 | <form method="post" action="/{{ $root.Owner }}/{{ $root.Repo.Name }}/{{ if .Starred }}unstar{{ else }}star{{ end }}" class="shithub-repo-action-form"> |
| 47 | <input type="hidden" name="csrf_token" value="{{ $root.CSRFToken }}"> |
| 48 | <input type="hidden" name="return_to" value="{{ .ReturnTo }}"> |
| 49 | <button type="submit" class="shithub-repo-action{{ if .Starred }} is-active{{ end }}" aria-pressed="{{ .Starred }}"> |
| 50 | {{ octicon "star" }} |
| 51 | <span class="shithub-repo-action-label">{{ if .Starred }}Starred{{ else }}Star{{ end }}</span> |
| 52 | <span class="shithub-counter">{{ $root.Repo.StarCount }}</span> |
| 53 | </button> |
| 54 | </form> |
| 55 | {{ else }} |
| 56 | <a href="{{ .LoginURL }}" class="shithub-repo-action" aria-label="You must be signed in to change notification settings"> |
| 57 | {{ octicon "bell" }} |
| 58 | <span class="shithub-repo-action-label">Notifications</span> |
| 59 | </a> |
| 60 | <a href="{{ .LoginURL }}" class="shithub-repo-action" aria-label="You must be signed in to fork a repository"> |
| 61 | {{ octicon "repo-forked" }} |
| 62 | <span class="shithub-repo-action-label">Fork</span> |
| 63 | <span class="shithub-counter">{{ $root.Repo.ForkCount }}</span> |
| 64 | </a> |
| 65 | <a href="{{ .LoginURL }}" class="shithub-repo-action" aria-label="You must be signed in to star a repository"> |
| 66 | {{ octicon "star" }} |
| 67 | <span class="shithub-repo-action-label">Star</span> |
| 68 | <span class="shithub-counter">{{ $root.Repo.StarCount }}</span> |
| 69 | </a> |
| 70 | {{ end }} |
| 71 | {{ else }} |
| 72 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/watchers" class="shithub-repo-action">{{ octicon "eye" }} Watch <span class="shithub-counter">{{ .Repo.WatcherCount }}</span></a> |
| 73 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/forks" class="shithub-repo-action">{{ octicon "repo-forked" }} Fork <span class="shithub-counter">{{ .Repo.ForkCount }}</span></a> |
| 74 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/stargazers" class="shithub-repo-action">{{ octicon "star" }} Star <span class="shithub-counter">{{ .Repo.StarCount }}</span></a> |
| 75 | {{ end }} |
| 76 | </div> |
| 77 | </div> |
| 78 | </header> |
| 79 | {{- end }} |