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>
This commit is contained in:
Jonathan Tran 2021-05-07 17:10:05 -04:00 committed by GitHub
parent 4900881924
commit 9557b8603a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 235 additions and 100 deletions

View file

@ -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);