Commit 22bd7f4d authored by Alfredo Sumaran's avatar Alfredo Sumaran

Allow to pass custom classes to button

parent 99296b2e
...@@ -129,14 +129,14 @@ module DiffHelper ...@@ -129,14 +129,14 @@ module DiffHelper
end end
end end
def commit_diff_whitespace_link(project, commit) def commit_diff_whitespace_link(project, commit, options)
url = namespace_project_commit_path(project.namespace, project, commit.id, params_with_whitespace) url = namespace_project_commit_path(project.namespace, project, commit.id, params_with_whitespace)
toggle_whitespace_link(url) toggle_whitespace_link(url, options)
end end
def diff_merge_request_whitespace_link(project, merge_request) def diff_merge_request_whitespace_link(project, merge_request, options)
url = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, params_with_whitespace) url = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, params_with_whitespace)
toggle_whitespace_link(url) toggle_whitespace_link(url, options)
end end
private private
...@@ -149,7 +149,10 @@ module DiffHelper ...@@ -149,7 +149,10 @@ module DiffHelper
hide_whitespace? ? request.query_parameters.except(:w) : request.query_parameters.merge(w: 1) hide_whitespace? ? request.query_parameters.except(:w) : request.query_parameters.merge(w: 1)
end end
def toggle_whitespace_link(url) def toggle_whitespace_link(url, options)
link_to "#{hide_whitespace? ? 'Show' : 'Hide'} whitespace changes", url, class: 'btn btn-default hidden-xs' options[:class] ||= ''
options[:class] << ' btn btn-default'
link_to "#{hide_whitespace? ? 'Show' : 'Hide'} whitespace changes", url, class: options[:class]
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