Browse Source

auto-redirect when finish filter branch

Unknwon 9 years ago
parent
commit
43a87b0caf
2 changed files with 4 additions and 5 deletions
  1. 2 3
      public/js/gogs.js
  2. 2 2
      templates/repo/pulls/compare.tmpl

+ 2 - 3
public/js/gogs.js

@@ -97,10 +97,9 @@ function initRepository() {
     // Pull request
     if ($('.repository.compare.pull').length > 0) {
         $('.choose.branch .dropdown').dropdown({
-            action: 'hide',
             fullTextSearch: true,
-            onNoResults: function () {
-                $('.choose.branch .dropdown .active').addClass('selected');
+            onChange: function (text, value, $choice) {
+                window.location.href = $choice.data('url');
             }
         });
     }

+ 2 - 2
templates/repo/pulls/compare.tmpl

@@ -21,7 +21,7 @@
 	          </div>
 	          <div class="items">
 		        	{{range .Branches}}
-		          <a class="{{if eq $.BaseBranch .}}active selected{{end}} item" href="{{$.RepoLink}}/compare/{{.}}...{{$.SignedUser.Name}}:{{$.HeadBranch}}">{{.}}</a>
+		          <div class="{{if eq $.BaseBranch .}}active selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{.}}...{{$.SignedUser.Name}}:{{$.HeadBranch}}">{{.}}</div>
 		        	{{end}}
 	          </div>
 					</div>
@@ -39,7 +39,7 @@
 	          </div>
 	          <div class="items">
 		        	{{range .HeadBranches}}
-		          <a class="{{if eq $.HeadBranch .}}active selected{{end}} item" href="{{$.RepoLink}}/compare/{{$.BaseBranch}}...{{$.SignedUser.Name}}:{{.}}">{{.}}</a>
+		          <div class="{{if eq $.HeadBranch .}}active selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{$.BaseBranch}}...{{$.SignedUser.Name}}:{{.}}">{{.}}</div>
 		        	{{end}}
 	        	</div>
 					</div>