diff options
author | Robert Speicher <robert@gitlab.com> | 2017-03-16 23:03:37 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-03-16 23:03:37 +0000 |
commit | 0c8a2edfab91d098cf586a4c0d4a7fdc87aff670 (patch) | |
tree | 90fd24fd574496104d077695dfa3559d6b186cb5 /app/helpers | |
parent | bd2b76cecac2aeda67b998a36e6a739d632bb824 (diff) | |
parent | 82cc38d7d871f70ba5ee5a8848c471490da3b40d (diff) | |
download | gitlab-ce-0c8a2edfab91d098cf586a4c0d4a7fdc87aff670.tar.gz |
Merge branch 'add-blob-copy-button' into 'master'
Add copy button to blob header and use icon for Raw button
See merge request !9878
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/blob_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 7f32c1b5300..0b0c6a07efd 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -203,4 +203,18 @@ module BlobHelper 'blob-language' => @blob && @blob.language.try(:ace_mode) } end + + def copy_file_path_button(file_path) + clipboard_button(clipboard_text: file_path, class: 'btn-clipboard btn-transparent prepend-left-5', title: 'Copy file path to clipboard') + end + + def copy_blob_content_button(blob) + return if markup?(blob.name) + + clipboard_button(clipboard_target: ".blob-content[data-blob-id='#{blob.id}']", class: "btn btn-sm", title: "Copy content to clipboard") + end + + def open_raw_file_button(path) + link_to icon('file-code-o'), path, class: 'btn btn-sm has-tooltip', target: '_blank', title: 'Open raw', data: { container: 'body' } + end end |