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 @@ ...@@ -15,6 +15,7 @@
function MergeRequestTabs(opts) { function MergeRequestTabs(opts) {
this.opts = opts != null ? opts : {}; this.opts = opts != null ? opts : {};
this.opts.setUrl = this.opts.setUrl !== undefined ? this.opts.setUrl : true;
this.setCurrentAction = bind(this.setCurrentAction, this); this.setCurrentAction = bind(this.setCurrentAction, this);
this.tabShown = bind(this.tabShown, this); this.tabShown = bind(this.tabShown, this);
this.showTab = bind(this.showTab, this); this.showTab = bind(this.showTab, this);
...@@ -58,7 +59,9 @@ ...@@ -58,7 +59,9 @@
} else { } else {
this.expandView(); this.expandView();
} }
return this.setCurrentAction(action); if (this.opts.setUrl) {
this.setCurrentAction(action);
}
}; };
MergeRequestTabs.prototype.scrollToElement = function(container) { MergeRequestTabs.prototype.scrollToElement = function(container) {
......
...@@ -216,7 +216,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -216,7 +216,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@base_commit = @merge_request.diff_base_commit @base_commit = @merge_request.diff_base_commit
@diffs = @merge_request.diffs(diff_options) if @merge_request.compare @diffs = @merge_request.diffs(diff_options) if @merge_request.compare
@diff_notes_disabled = true @diff_notes_disabled = true
@show_diff_tab = check_diff_tab
@pipeline = @merge_request.pipeline @pipeline = @merge_request.pipeline
@statuses = @pipeline.statuses.relevant if @pipeline @statuses = @pipeline.statuses.relevant if @pipeline
...@@ -520,4 +520,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -520,4 +520,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
params[:merge_request] ||= ActionController::Parameters.new(source_project: @project) params[:merge_request] ||= ActionController::Parameters.new(source_project: @project)
@merge_request = MergeRequests::BuildService.new(project, current_user, merge_request_params).execute @merge_request = MergeRequests::BuildService.new(project, current_user, merge_request_params).execute
end end
private
def check_diff_tab
request.query_parameters[:view].present?
end
end end
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
.mr-compare.merge-request .mr-compare.merge-request
%ul.merge-request-tabs.nav-links.no-top.no-bottom %ul.merge-request-tabs.nav-links.no-top.no-bottom
%li.commits-tab %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 Commits
%span.badge= @commits.size %span.badge= @commits.size
- if @pipeline - if @pipeline
...@@ -52,11 +52,8 @@ ...@@ -52,11 +52,8 @@
$('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change");
e.preventDefault(); e.preventDefault();
}); });
:javascript :javascript
var merge_request var merge_request = new MergeRequest({
merge_request = new MergeRequest({ action: "#{(@show_diff_tab ? 'diffs' : 'new')}",
action: 'new', setUrl: false
diffs_loaded: true,
commits_loaded: true
}); });
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