Commit 9a26120c authored by Valery Sizov's avatar Valery Sizov Committed by Robert Speicher

Fix anchors to comments in diffs

parent b4963a75
...@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.0.4 v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu) - Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
- Fix referrals for :back and relative URL installs - Fix referrals for :back and relative URL installs
- Fix anchors to comments in diffs
v 8.0.3 v 8.0.3
- Fix URL shown in Slack notifications - Fix URL shown in Slack notifications
......
...@@ -66,6 +66,11 @@ class @MergeRequestTabs ...@@ -66,6 +66,11 @@ class @MergeRequestTabs
@setCurrentAction(action) @setCurrentAction(action)
scrollToElement: (container) ->
if window.location.hash
top = $(container + " " + window.location.hash).offset().top
$('body').scrollTo(top);
# Activate a tab based on the current action # Activate a tab based on the current action
activateTab: (action) -> activateTab: (action) ->
action = 'notes' if action == 'show' action = 'notes' if action == 'show'
...@@ -122,6 +127,7 @@ class @MergeRequestTabs ...@@ -122,6 +127,7 @@ class @MergeRequestTabs
document.getElementById('commits').innerHTML = data.html document.getElementById('commits').innerHTML = data.html
$('.js-timeago').timeago() $('.js-timeago').timeago()
@commitsLoaded = true @commitsLoaded = true
@scrollToElement(".commits")
loadDiff: (source) -> loadDiff: (source) ->
return if @diffsLoaded return if @diffsLoaded
...@@ -131,6 +137,7 @@ class @MergeRequestTabs ...@@ -131,6 +137,7 @@ class @MergeRequestTabs
success: (data) => success: (data) =>
document.getElementById('diffs').innerHTML = data.html document.getElementById('diffs').innerHTML = data.html
@diffsLoaded = true @diffsLoaded = true
@scrollToElement(".diffs")
toggleLoading: -> toggleLoading: ->
$('.mr-loading-status .loading').toggle() $('.mr-loading-status .loading').toggle()
......
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