]> source.dussan.org Git - gitea.git/commitdiff
Dropdown on commits page to choose branch #1846
authorAngus Gibson <angus.gibson@anu.edu.au>
Wed, 9 Dec 2015 05:14:54 +0000 (16:14 +1100)
committerAngus Gibson <angus.gibson@anu.edu.au>
Wed, 9 Dec 2015 05:37:04 +0000 (16:37 +1100)
I've mostly duplicated the dropdown code from repo/home.tmpl, which
basically only required a change to the URL. This could probably be
broken out into something more modular.

public/js/gogs.js
templates/repo/commits.tmpl

index be17b8c8f25c1c8e206d9e49f733d86d9bd3432c..427280db54990fd9797ad82d7fe0e6adf719d84c 100644 (file)
@@ -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
+});
index 879f762dfa405b4c47eb5fb60473539182b994bf..0c8ca443c21282e84e0a015dac7d0e00abd9bf77 100644 (file)
@@ -2,6 +2,50 @@
 <div class="repository commits">
        {{template "repo/header" .}}
        <div class="ui container">
+               <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}}/commits/{{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}}/commits/{{EscapePound .}}">{{.}}</div>
+                                               {{end}}
+                                       </div>
+                               </div>
+                       </div>
+               </div>
                {{template "repo/commits_table" .}}
        </div>
 </div>