diff options
Diffstat (limited to 'app/helpers/snippets_helper.rb')
-rw-r--r-- | app/helpers/snippets_helper.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb index 78b204fefe9..8558c664977 100644 --- a/app/helpers/snippets_helper.rb +++ b/app/helpers/snippets_helper.rb @@ -62,6 +62,18 @@ module SnippetsHelper rel: 'noopener noreferrer') end + def embedded_copy_snippet_button(blob) + return unless blob.rendered_as_text?(ignore_errors: false) + + content_tag(:button, + class: 'gl-button btn btn-default copy-to-clipboard-btn', + title: 'Copy snippet contents', + onclick: "copyToClipboard('.blob-content[data-blob-id=\"#{blob.id}\"] > pre')" + ) do + external_snippet_icon('copy-to-clipboard') + end + end + def snippet_file_count(snippet) file_count = snippet.statistics&.file_count |