diff options
author | Jonathan Tran <jonnytran@gmail.com> | 2021-05-07 17:10:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 23:10:05 +0200 |
commit | 9557b8603aa05458a9b262d254a809d083657e62 (patch) | |
tree | 25abc1db9983b7cc3ccc1c7e1d3e75a015022d91 /web_src/js | |
parent | 4900881924b3762e10b01d67565035faf7cb02da (diff) | |
download | gitea-9557b8603aa05458a9b262d254a809d083657e62.tar.gz gitea-9557b8603aa05458a9b262d254a809d083657e62.zip |
Add selecting tags on the compare page (#15723)
* Add selecting tags on the compare page
* Remove unused condition and change indentation
* Fix tag tab in dropdown to be black
* Add compare tag integration test
Co-authored-by: Jonathan Tran <jon@allspice.io>
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/index.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js index 2d9f7f4caf..6ffff9cb19 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -1241,10 +1241,16 @@ async function initRepository() { $(this).select(); }); + // Compare or pull request + const $repoDiff = $('.repository.diff'); + if ($repoDiff.length) { + initBranchOrTagDropdown('.choose.branch .dropdown'); + initFilterSearchDropdown('.choose.branch .dropdown'); + } + // Pull request const $repoComparePull = $('.repository.compare.pull'); if ($repoComparePull.length > 0) { - initFilterSearchDropdown('.choose.branch .dropdown'); // show pull request form $repoComparePull.find('button.show-form').on('click', function (e) { e.preventDefault(); @@ -3447,6 +3453,17 @@ function initIssueTimetracking() { }); } +function initBranchOrTagDropdown(selector) { + $(selector).each(function() { + const $dropdown = $(this); + $dropdown.find('.reference.column').on('click', function () { + $dropdown.find('.scrolling.reference-list-menu').hide(); + $($(this).data('target')).show(); + return false; + }); + }); +} + function initFilterBranchTagDropdown(selector) { $(selector).each(function () { const $dropdown = $(this); |