| |
@@ -26,7 +26,7 @@
|
| |
{% endblock %}
|
| |
|
| |
{% block repo %}
|
| |
- <div class="row">
|
| |
+ <div class="row" id="pr-wrapper">
|
| |
<div class="col-md-12">
|
| |
{% if pull_request %}
|
| |
<h3><span class="label label-default">PR#{{requestid}}</span>
|
| |
@@ -1244,10 +1244,27 @@
|
| |
highlight_comment();
|
| |
} else {
|
| |
if (onload) {
|
| |
- $('#request_diff').addClass('active');
|
| |
- $('#comments').removeClass('active');
|
| |
+ // Hide all tabs, and then show the one pointed to by the hash.
|
| |
+ // This is neccessary to handle 'Back' button presses in the browser,
|
| |
+ // which otherwise break the tabs view .
|
| |
+ $('#pr-tabs .nav-item a.nav-link').removeClass('active');
|
| |
+ $('#pr-wrapper .tab-pane').removeClass('active');
|
| |
+ // When the hash points to 'Files Changed' tab, or a highlight.
|
| |
+ if (location.hash.indexOf("request_diff") > -1 ||
|
| |
+ location.hash.indexOf("_") === 1) {
|
| |
$('[href="#request_diff"]').addClass('active');
|
| |
- $('[href="#comments"]').removeClass('active');
|
| |
+ $('#request_diff').addClass('active');
|
| |
+ }
|
| |
+ // When the hash points to 'Commits' tab.
|
| |
+ else if (location.hash.indexOf("commit_list") > -1) {
|
| |
+ $('[href="#commit_list"]').addClass('active');
|
| |
+ $('#commit_list').addClass('active');
|
| |
+ }
|
| |
+ // If neither, then show the 'Comments' tab by default.
|
| |
+ else {
|
| |
+ $('#comments').addClass('active');
|
| |
+ $('[href="#comments"]').addClass('active');
|
| |
+ }
|
| |
}
|
| |
var file = parseInt(location.hash.substr(2).split(',')[0], 10);
|
| |
var lines = location.hash.split(',')[1].split('-').map(function (x) { return parseInt(x, 10) });
|
| |
@@ -1370,6 +1387,12 @@
|
| |
window.location.hash = hash;
|
| |
return false;
|
| |
});
|
| |
+
|
| |
+ // Update hash links in the addressbar according to which tab is clicked
|
| |
+ // on the PR page.
|
| |
+ $(document).on('click', '#pr-tabs a', function() {
|
| |
+ window.location.hash = $(this).attr('href');
|
| |
+ });
|
| |
</script>
|
| |
|
| |
|
| |
Fixed the issue where opening the 'Commits' tab in a new browser
tab showed the 'Files Changed' tab instead.
Fixes https://pagure.io/pagure/issue/787