From 0f3033b3dfee7d1af7f03f6fa346d868b1c7bbbe Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 03 2018 14:30:33 +0000 Subject: [PATCH 1/2] Provide feedback to the user if PRs are disabled in the default target projects Fixes https://pagure.io/pagure/issue/4075 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/repo_master.html b/pagure/templates/repo_master.html index cda1cb7..0da420c 100644 --- a/pagure/templates/repo_master.html +++ b/pagure/templates/repo_master.html @@ -525,6 +525,16 @@ $("#pr-button").one("click", $.post(_pr_url, data, null, dataType='json').done( function(data) { process_task_results(data, generate_branch_list); + }).fail( + function(data) { + var _b = $("#pr-dropdown-mainlist"); + html = '' + + ' ' + + data.responseJSON.message + + ''; + _b.append(html); + _b.show(); + $("#pr-dropdown-mainlist .pr-dropdown-spinner").hide(); }) var data = { repo: "{{ repo.name }}", @@ -535,6 +545,16 @@ $("#pr-button").one("click", $.post(_pr_url, data, null, dataType='json').done( function(data) { process_task_results(data, generate_branch_list_fork); + }).fail( + function(data) { + var _b = $("#pr-dropdown-forklist"); + html = '' + + ' ' + + data.responseJSON.message + + ''; + _b.append(html); + _b.show(); + $("#pr-dropdown-forklist .pr-dropdown-spinner").hide(); }) _b.prepend(new_pr); } From d3af832e8e02b79715a26e4dac545af2a83746bd Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 03 2018 14:30:33 +0000 Subject: [PATCH 2/2] Small JS code clean up Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/repo_master.html b/pagure/templates/repo_master.html index 0da420c..294beaa 100644 --- a/pagure/templates/repo_master.html +++ b/pagure/templates/repo_master.html @@ -465,7 +465,6 @@ function process_task_results(_data, callback) { }); } - function generate_branch_list(data) { var _b = $("#pr-dropdown-mainlist"); for (branch in data.new_branch){ @@ -489,7 +488,6 @@ function generate_branch_list(data) { } function generate_branch_list_fork(data) { - console.log(data); var _b = $("#pr-dropdown-forklist"); for (branch in data.new_branch){ var url = "{{ url_for( @@ -556,7 +554,6 @@ $("#pr-button").one("click", _b.show(); $("#pr-dropdown-forklist .pr-dropdown-spinner").hide(); }) - _b.prepend(new_pr); } ); {% endif %}