Commit 27a0310f authored by Alfredo Sumaran's avatar Alfredo Sumaran

Make diff view name getter less error prone

parent ebceae3e
......@@ -179,11 +179,9 @@ class @MergeRequestTabs
$.ajax(options)
# Returns diff view type
diffViewMode: ->
# Gets diff view mode based from its ID
# See diff_btn helper method
btnID = $('a[id$="-diff-btn"].active').attr('id')
btnID.substr(0, btnID.indexOf('-'))
$('.diffs a[id$="-diff-btn"].active').data('view-type')
expandViewContainer: ->
$('.container-fluid').removeClass('container-limited')
......@@ -137,7 +137,7 @@ module DiffHelper
# Always use HTML to handle case where JSON diff rendered this button
params_copy.delete(:format)
link_to url_for(params_copy), id: "#{name}-diff-btn", class: (selected ? 'btn active' : 'btn') do
link_to url_for(params_copy), id: "#{name}-diff-btn", class: (selected ? 'btn active' : 'btn'), data: {view_type: name} do
title
end
end
......
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