Browse Source

UI: Always show menu on repo pages

Merges repo/sidebar.tmpl with repo/header.tmpl and makes every repo page use
middleware.RepoRef() necessary to display information on this menu.
for-closed-social
Adam Strzelecki 9 years ago
parent
commit
2580e7b57e
23 changed files with 36 additions and 56 deletions
  1. +2
    -2
      cmd/web.go
  2. +0
    -1
      templates/repo/commits.tmpl
  3. +0
    -1
      templates/repo/forks.tmpl
  4. +34
    -0
      templates/repo/header.tmpl
  5. +0
    -1
      templates/repo/home.tmpl
  6. +0
    -1
      templates/repo/issue/labels.tmpl
  7. +0
    -1
      templates/repo/issue/list.tmpl
  8. +0
    -1
      templates/repo/issue/milestones.tmpl
  9. +0
    -1
      templates/repo/release/list.tmpl
  10. +0
    -1
      templates/repo/release/new.tmpl
  11. +0
    -1
      templates/repo/settings/collaboration.tmpl
  12. +0
    -1
      templates/repo/settings/deploy_keys.tmpl
  13. +0
    -1
      templates/repo/settings/githook_edit.tmpl
  14. +0
    -1
      templates/repo/settings/githooks.tmpl
  15. +0
    -1
      templates/repo/settings/hook_new.tmpl
  16. +0
    -1
      templates/repo/settings/hooks.tmpl
  17. +0
    -1
      templates/repo/settings/options.tmpl
  18. +0
    -34
      templates/repo/sidebar.tmpl
  19. +0
    -1
      templates/repo/watchers.tmpl
  20. +0
    -1
      templates/repo/wiki/new.tmpl
  21. +0
    -1
      templates/repo/wiki/pages.tmpl
  22. +0
    -1
      templates/repo/wiki/start.tmpl
  23. +0
    -1
      templates/repo/wiki/view.tmpl

+ 2
- 2
cmd/web.go View File

@ -514,11 +514,11 @@ func runWeb(ctx *cli.Context) {
m.Get("/edit/:tagname", repo.EditRelease)
m.Post("/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
m.Post("/delete", repo.DeleteRelease)
}, reqRepoAdmin, middleware.RepoRef())
}, reqRepoAdmin)
m.Combo("/compare/*").Get(repo.CompareAndPullRequest).
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
}, reqSignIn, middleware.RepoAssignment())
}, reqSignIn, middleware.RepoAssignment(), middleware.RepoRef())
m.Group("/:username/:reponame", func() {
m.Group("", func() {

+ 0
- 1
templates/repo/commits.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository commits">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
{{template "repo/commits_table" .}}
</div>

+ 0
- 1
templates/repo/forks.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository forks">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<h2 class="ui dividing header">
{{.i18n.Tr "repo.forks"}}

+ 34
- 0
templates/repo/header.tmpl View File

@ -45,3 +45,37 @@
</div><!-- end grid -->
</div><!-- end container -->
{{end}}
{{if not .IsBareRepo}}
<div class="ui tabs container">
<div class="ui tabular menu navbar">
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}">
<i class="icon octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
</a>
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
<i class="icon octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if eq 0 .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
</a>
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
<i class="icon octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui {{if eq 0 .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span>
</a>
<a class="{{if .PageIsCommits}}active{{end}} item" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}">
<i class="icon octicon octicon-history"></i> {{.i18n.Tr "repo.commits"}} <span class="ui {{if eq 0 .CommitsCount}}gray{{else}}blue{{end}} small label">{{.CommitsCount}}</span>
</a>
<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
<i class="icon octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if eq 0 .Repository.NumTags}}gray{{else}}blue{{end}} small label">{{.Repository.NumTags}}</span>
</a>
<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki">
<i class="icon octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}}
</a>
{{if .IsRepositoryAdmin}}
<div class="right menu">
<a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
<i class="icon octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}}
</a>
</div>
{{end}}
</div>
</div>
<div class="ui tabs divider"></div>
{{else}}
<div class="ui divider"></div>
{{end}}

+ 0
- 1
templates/repo/home.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository file list">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<p id="repo-desc">
{{if .Repository.DescriptionHtml}}<span class="description">{{.Repository.DescriptionHtml}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}

+ 0
- 1
templates/repo/issue/labels.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository labels">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="navbar">
{{template "repo/issue/navbar" .}}

+ 0
- 1
templates/repo/issue/list.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="navbar">
{{template "repo/issue/navbar" .}}

+ 0
- 1
templates/repo/issue/milestones.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository milestones">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="navbar">
{{template "repo/issue/navbar" .}}

+ 0
- 1
templates/repo/release/list.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository release">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
{{template "base/alert" .}}
<h2 class="ui header">

+ 0
- 1
templates/repo/release/new.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository new release">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<h2 class="ui dividing header">
{{if .PageIsEditRelease}}

+ 0
- 1
templates/repo/settings/collaboration.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository settings collaboration">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
{{template "repo/settings/navbar" .}}

+ 0
- 1
templates/repo/settings/deploy_keys.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository settings">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
{{template "repo/settings/navbar" .}}

+ 0
- 1
templates/repo/settings/githook_edit.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository settings edit githook">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
{{template "repo/settings/navbar" .}}

+ 0
- 1
templates/repo/settings/githooks.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository settings githooks">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
{{template "repo/settings/navbar" .}}

+ 0
- 1
templates/repo/settings/hook_new.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository settings new webhook">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
{{template "repo/settings/navbar" .}}

+ 0
- 1
templates/repo/settings/hooks.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository settings webhooks">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
{{template "repo/settings/navbar" .}}

+ 0
- 1
templates/repo/settings/options.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository settings options">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
{{template "repo/settings/navbar" .}}

+ 0
- 34
templates/repo/sidebar.tmpl View File

@ -1,34 +0,0 @@
{{if not .IsBareRepo}}
<div class="ui tabs container">
<div class="ui tabular menu navbar">
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}">
<i class="icon octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
</a>
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
<i class="icon octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if eq 0 .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
</a>
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
<i class="icon octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui {{if eq 0 .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span>
</a>
<a class="{{if .PageIsCommits}}active{{end}} item" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}">
<i class="icon octicon octicon-history"></i> {{.i18n.Tr "repo.commits"}} <span class="ui {{if eq 0 .CommitsCount}}gray{{else}}blue{{end}} small label">{{.CommitsCount}}</span>
</a>
<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
<i class="icon octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if eq 0 .Repository.NumTags}}gray{{else}}blue{{end}} small label">{{.Repository.NumTags}}</span>
</a>
<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki">
<i class="icon octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}}
</a>
{{if .IsRepositoryAdmin}}
<div class="right menu">
<a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
<i class="icon octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}}
</a>
</div>
{{end}}
</div>
</div>
<div class="ui tabs divider"></div>
{{else}}
<div class="ui divider"></div>
{{end}}

+ 0
- 1
templates/repo/watchers.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository watchers">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<h2 class="ui dividing header">
{{if .PageIsWatchers}}

+ 0
- 1
templates/repo/wiki/new.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository wiki new">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
{{template "base/alert" .}}
<div class="ui header">

+ 0
- 1
templates/repo/wiki/pages.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository wiki pages">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui header">
{{.i18n.Tr "repo.wiki.pages"}}

+ 0
- 1
templates/repo/wiki/start.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository wiki start">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui center segment">
<span class="mega-octicon octicon-book"></span>

+ 0
- 1
templates/repo/wiki/view.tmpl View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div class="repository wiki view">
{{template "repo/header" .}}
{{template "repo/sidebar" .}}
<div class="ui container">
<div class="ui grid">
<div class="ui ten wide column">

Loading…
Cancel
Save