From 9557b8603aa05458a9b262d254a809d083657e62 Mon Sep 17 00:00:00 2001 From: Jonathan Tran Date: Fri, 7 May 2021 17:10:05 -0400 Subject: 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 --- web_src/js/index.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'web_src/js') 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); -- cgit v1.2.3