BigW Consortium Gitlab

Commit 27a0310f by Alfredo Sumaran

Make diff view name getter less error prone

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