From 5ba79f49a45041f5a805de00a1f737ade5ac5832 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Tue, 12 Apr 2016 12:49:34 -0500 Subject: Syntax and code improvements --- app/helpers/diff_helper.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'app') diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 06e5b95297e..5c7317bdd40 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -129,6 +129,18 @@ module DiffHelper end end + def commit_diff_whitespace_link(project, commit) + url = namespace_project_commit_path(project.namespace, project, commit.id, params_with_whitespace) + toggle_whitespace_link(url) + end + + def diff_merge_request_whitespace_link(project, merge_request) + url = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, params_with_whitespace) + toggle_whitespace_link(url) + end + + private + def hide_whitespace? params[:w] == '1' end @@ -138,16 +150,6 @@ module DiffHelper end def toggle_whitespace_link(url) - link_to "#{hide_whitespace? ? 'Show' : 'Hide'} whitespace changes", url, class: "btn btn-default" - end - - def commit_diff_whitespace_link(project, commit) - url = namespace_project_commit_path(project.namespace, project, commit.id, params_with_whitespace) - toggle_whitespace_link(url) - end - - def diff_merge_request_whitespace_link(project, merge_request) - url = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, params_with_whitespace) - toggle_whitespace_link(url) + link_to "#{hide_whitespace? ? 'Show' : 'Hide'} whitespace changes", url, class: 'btn btn-default' end end -- cgit v1.2.1