Commit 43252ccb authored by Alfredo Sumaran's avatar Alfredo Sumaran

Fix tabs navigation and do not update URL via pushstate

parent 59fa031e
......@@ -15,6 +15,7 @@
function MergeRequestTabs(opts) {
this.opts = opts != null ? opts : {};
this.opts.setUrl = this.opts.setUrl !== undefined ? this.opts.setUrl : true;
this.setCurrentAction = bind(this.setCurrentAction, this);
this.tabShown = bind(this.tabShown, this);
this.showTab = bind(this.showTab, this);
......@@ -58,7 +59,9 @@
} else {
this.expandView();
}
return this.setCurrentAction(action);
if (this.opts.setUrl) {
this.setCurrentAction(action);
}
};
MergeRequestTabs.prototype.scrollToElement = function(container) {
......
......@@ -216,7 +216,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@base_commit = @merge_request.diff_base_commit
@diffs = @merge_request.diffs(diff_options) if @merge_request.compare
@diff_notes_disabled = true
@show_diff_tab = check_diff_tab
@pipeline = @merge_request.pipeline
@statuses = @pipeline.statuses.relevant if @pipeline
......@@ -520,4 +520,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
params[:merge_request] ||= ActionController::Parameters.new(source_project: @project)
@merge_request = MergeRequests::BuildService.new(project, current_user, merge_request_params).execute
end
private
def check_diff_tab
request.query_parameters[:view].present?
end
end
......@@ -20,7 +20,7 @@
.mr-compare.merge-request
%ul.merge-request-tabs.nav-links.no-top.no-bottom
%li.commits-tab
= link_to url_for(params), data: {target: 'div#commits', action: 'commits', toggle: 'tab'} do
= link_to url_for(params), data: {target: 'div#commits', action: 'new', toggle: 'tab'} do
Commits
%span.badge= @commits.size
- if @pipeline
......@@ -52,11 +52,8 @@
$('#merge_request_assignee_id').val("#{current_user.id}").trigger("change");
e.preventDefault();
});
:javascript
var merge_request
merge_request = new MergeRequest({
action: 'new',
diffs_loaded: true,
commits_loaded: true
var merge_request = new MergeRequest({
action: "#{(@show_diff_tab ? 'diffs' : 'new')}",
setUrl: false
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment