summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-07-25 15:38:23 +0000
committerStan Hu <stanhu@gmail.com>2015-07-25 15:38:23 +0000
commit4a76cbe21907b92e53b168f3085c19d00be11f0b (patch)
tree9ce5f110b75dc84c9ef689302a7fa3bdd3d7b2b8 /app
parentfffbc3693123c8d6e40b4378d5a69c4646c322ac (diff)
parentae3f869fd1f4326e26805606197dea4ea15c67bb (diff)
downloadgitlab-ce-4a76cbe21907b92e53b168f3085c19d00be11f0b.tar.gz
Merge branch 'fix-reload-with-full-diff-url' into 'master'
Fix the "Reload with full diff" URL button On the first load, the merge request tabs would be requested in JSON format to render the HTML. This would cause the "Reload with full diff" button to create a link to `diff.json`. Instead, generate the path in HTML mode. Closes #2041 See merge request !1019
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/merge_request_tabs.js.coffee10
-rw-r--r--app/views/projects/diffs/_warning.html.haml2
-rw-r--r--app/views/projects/merge_requests/_show.html.haml6
3 files changed, 5 insertions, 13 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.coffee b/app/assets/javascripts/merge_request_tabs.js.coffee
index a132a0a9dcc..19a07b6a033 100644
--- a/app/assets/javascripts/merge_request_tabs.js.coffee
+++ b/app/assets/javascripts/merge_request_tabs.js.coffee
@@ -49,12 +49,6 @@ class @MergeRequestTabs
# Store the `location` object, allowing for easier stubbing in tests
@_location = location
- switch @opts.action
- when 'commits'
- @commitsLoaded = true
- when 'diffs'
- @diffsLoaded = true
-
@bindEvents()
@activateTab(@opts.action)
@@ -102,7 +96,7 @@ class @MergeRequestTabs
action = 'notes' if action == 'show'
# Remove a trailing '/commits' or '/diffs'
- new_state = @_location.pathname.replace(/\/(commits|diffs)\/?$/, '')
+ new_state = @_location.pathname.replace(/\/(commits|diffs)(\.html)?\/?$/, '')
# Append the new action if we're on a tab other than 'notes'
unless action == 'notes'
@@ -133,7 +127,7 @@ class @MergeRequestTabs
return if @diffsLoaded
@_get
- url: "#{source}.json"
+ url: "#{source}.json" + @_location.search
success: (data) =>
document.getElementById('diffs').innerHTML = data.html
@diffsLoaded = true
diff --git a/app/views/projects/diffs/_warning.html.haml b/app/views/projects/diffs/_warning.html.haml
index da3d4be84ba..caed0e69dc8 100644
--- a/app/views/projects/diffs/_warning.html.haml
+++ b/app/views/projects/diffs/_warning.html.haml
@@ -3,7 +3,7 @@
Too many changes to show.
.pull-right
- unless diff_hard_limit_enabled?
- = link_to "Reload with full diff", url_for(params.merge(force_show_diff: true)), class: "btn btn-sm btn-warning"
+ = link_to "Reload with full diff", url_for(params.merge(force_show_diff: true, format: :html)), class: "btn btn-sm btn-warning"
- if current_controller?(:commit) or current_controller?(:merge_requests)
- if current_controller?(:commit)
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index faaa85896cf..c57eee14143 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -66,11 +66,9 @@
#notes.notes.tab-pane.voting_notes
= render "projects/merge_requests/discussion"
#commits.commits.tab-pane
- - if current_page?(action: 'commits')
- = render "projects/merge_requests/show/commits"
+ - # This tab is always loaded via AJAX
#diffs.diffs.tab-pane
- - if current_page?(action: 'diffs')
- = render "projects/merge_requests/show/diffs"
+ - # This tab is always loaded via AJAX
.mr-loading-status
= spinner