diff options
author | Unknwon <u@gogs.io> | 2015-12-09 01:42:26 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-09 01:42:26 -0500 |
commit | eec06fb3df7a9dc30f758bb1a100b5f1e8e01ab9 (patch) | |
tree | 88a2cd2aaf1b40456e91d083d7223e52f61a802e | |
parent | a576224d0ea0a6a48207002229ae38937bd038a3 (diff) | |
parent | df05134494ccc4cf53ff816a6457c7e21a69f730 (diff) |
Merge pull request #2126 from angus-g/fixes/commits-branches
Dropdown on commits page to choose branch #1846
-rw-r--r-- | public/js/gogs.js | 7 | ||||
-rw-r--r-- | templates/repo/branch_dropdown.tmpl | 44 | ||||
-rw-r--r-- | templates/repo/commits.tmpl | 1 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 45 |
4 files changed, 50 insertions, 47 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index be17b8c8..427280db 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -218,8 +218,9 @@ function initRepository() { }); } - // File list - if ($('.repository.file.list').length > 0) { + // File list and commits + if ($('.repository.file.list').length > 0 || + ('.repository.commits').length > 0) { initFilterSearchDropdown('.choose.reference .dropdown'); $('.reference.column').click(function () { @@ -1036,4 +1037,4 @@ $(window).load(function () { } }).trigger('hashchange'); } -});
\ No newline at end of file +}); diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl new file mode 100644 index 00000000..a825ee24 --- /dev/null +++ b/templates/repo/branch_dropdown.tmpl @@ -0,0 +1,44 @@ +<div class="fitted item choose reference"> + <div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}"> + <div class="ui basic small button"> + <span class="text"> + <i class="octicon octicon-git-branch"></i> + {{if .IsViewBranch}}{{.i18n.Tr "repo.branch"}}{{else}}{{.i18n.Tr "repo.tree"}}{{end}}: + <strong>{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</strong> + </span> + <i class="dropdown icon"></i> + </div> + <div class="menu"> + <div class="ui icon search input"> + <i class="filter icon"></i> + <input name="search" placeholder="{{.i18n.Tr "repo.filter_branch_and_tag"}}..."> + </div> + <div class="header"> + <div class="ui grid"> + <div class="two column row"> + <a class="reference column" href="#" data-target="#branch-list"> + <span class="text {{if .IsViewBranch}}black{{end}}"> + <i class="icon octicon octicon-git-branch"></i> {{.i18n.Tr "repo.branches"}} + </span> + </a> + <a class="reference column" href="#" data-target="#tag-list"> + <span class="text {{if .IsViewTag}}black{{end}}"> + <i class="reference tags icon"></i> {{.i18n.Tr "repo.tags"}} + </span> + </a> + </div> + </div> + </div> + <div id="branch-list" class="scrolling menu" {{if .IsViewTag}}style="display: none"{{end}}> + {{range .Branches}} + <div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/{{if $.PageIsCommits}}commits{{else}}src{{end}}/{{EscapePound .}}">{{.}}</div> + {{end}} + </div> + <div id="tag-list" class="scrolling menu" {{if .IsViewBranch}}style="display: none"{{end}}> + {{range .Tags}} + <div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/{{if $.PageIsCommits}}commits{{else}}src{{end}}/{{EscapePound .}}">{{.}}</div> + {{end}} + </div> + </div> + </div> +</div> diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 879f762d..88a87ef8 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -2,6 +2,7 @@ <div class="repository commits"> {{template "repo/header" .}} <div class="ui container"> + {{template "repo/branch_dropdown" .}} {{template "repo/commits_table" .}} </div> </div> diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index ccbe6639..22a2f839 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -15,50 +15,7 @@ </a> </div> {{end}} - <div class="fitted item choose reference"> - <div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}"> - <div class="ui basic small button"> - <span class="text"> - <i class="octicon octicon-git-branch"></i> - {{if .IsViewBranch}}{{.i18n.Tr "repo.branch"}}{{else}}{{.i18n.Tr "repo.tree"}}{{end}}: - <strong>{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</strong> - </span> - <i class="dropdown icon"></i> - </div> - <div class="menu"> - <div class="ui icon search input"> - <i class="filter icon"></i> - <input name="search" placeholder="{{.i18n.Tr "repo.filter_branch_and_tag"}}..."> - </div> - <div class="header"> - <div class="ui grid"> - <div class="two column row"> - <a class="reference column" href="#" data-target="#branch-list"> - <span class="text {{if .IsViewBranch}}black{{end}}"> - <i class="icon octicon octicon-git-branch"></i> {{.i18n.Tr "repo.branches"}} - </span> - </a> - <a class="reference column" href="#" data-target="#tag-list"> - <span class="text {{if .IsViewTag}}black{{end}}"> - <i class="reference tags icon"></i> {{.i18n.Tr "repo.tags"}} - </span> - </a> - </div> - </div> - </div> - <div id="branch-list" class="scrolling menu" {{if .IsViewTag}}style="display: none"{{end}}> - {{range .Branches}} - <div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/src/{{EscapePound .}}">{{.}}</div> - {{end}} - </div> - <div id="tag-list" class="scrolling menu" {{if .IsViewBranch}}style="display: none"{{end}}> - {{range .Tags}} - <div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/src/{{EscapePound .}}">{{.}}</div> - {{end}} - </div> - </div> - </div> - </div> + {{template "repo/branch_dropdown" .}} <div class="item fitted"> <div class="ui breadcrumb"> <a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchName}}">{{.Repository.Name}}</a> |