Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/commits_helper.rb')
-rw-r--r--app/helpers/commits_helper.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index 43e727ac483..c78e906e052 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -182,6 +182,19 @@ module CommitsHelper
project_commit_path(project, DEFAULT_SHA).sub("/#{DEFAULT_SHA}", '/$COMMIT_SHA')
end
+ def diff_mode_swap_button(mode, file_hash)
+ icon = mode == 'raw' ? 'doc-code' : 'doc-text'
+ entity = mode == 'raw' ? 'toHideBtn' : 'toShowBtn'
+ title = "Display #{mode} diff"
+
+ link_to("##{mode}-diff-#{file_hash}",
+ class: "btn gl-button btn-default btn-file-option has-tooltip btn-show-#{mode}-diff",
+ title: title,
+ data: { file_hash: file_hash, diff_toggle_entity: entity }) do
+ sprite_icon(icon)
+ end
+ end
+
protected
# Private: Returns a link to a person. If the person has a matching user and