diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/snippets.scss | 6 | ||||
-rw-r--r-- | app/views/projects/snippets/show.html.haml | 4 | ||||
-rw-r--r-- | app/views/shared/_file_highlight.html.haml | 5 | ||||
-rw-r--r-- | app/views/snippets/show.html.haml | 4 |
5 files changed, 14 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG index 01f4c386e1a..a9ee1435e48 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -26,6 +26,7 @@ v 8.3.0 (unreleased) - Block LDAP user when they are no longer found in the LDAP server - Improve wording on project visibility levels (Zeger-Jan van de Weg) - Automatically select default clone protocol based on user preferences (Eirik Lygre) + - Add copy-to-clipboard button for Snippets v 8.2.3 - Fix application settings cache not expiring after changes (Stan Hu) diff --git a/app/assets/stylesheets/pages/snippets.scss b/app/assets/stylesheets/pages/snippets.scss index bb74e50151d..1430d01859d 100644 --- a/app/assets/stylesheets/pages/snippets.scss +++ b/app/assets/stylesheets/pages/snippets.scss @@ -32,6 +32,12 @@ .file-holder { border-top: 0; } + + .file-actions { + .btn-clipboard { + @extend .btn; + } + } } .snippet-box { diff --git a/app/views/projects/snippets/show.html.haml b/app/views/projects/snippets/show.html.haml index 5d706942f2d..7c599563ce4 100644 --- a/app/views/projects/snippets/show.html.haml +++ b/app/views/projects/snippets/show.html.haml @@ -10,8 +10,8 @@ %strong = @snippet.file_name .file-actions.hidden-xs - .btn-group.tree-btn-group - = link_to 'Raw', raw_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", target: "_blank" + = clipboard_button(clipboard_target: ".blob-content[data-blob-id='#{@snippet.id}']") + = link_to 'Raw', raw_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", target: "_blank" = render 'shared/snippets/blob' diff --git a/app/views/shared/_file_highlight.html.haml b/app/views/shared/_file_highlight.html.haml index 57c3aff3e18..2bc98983d67 100644 --- a/app/views/shared/_file_highlight.html.haml +++ b/app/views/shared/_file_highlight.html.haml @@ -8,5 +8,6 @@ %a{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i} %i.fa.fa-link = i - :preserve - #{highlight(blob.name, blob.data)} + .blob-content{data: {blob_id: blob.id}} + :preserve + #{highlight(blob.name, blob.data)} diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 69d8899d4c1..a2b36568770 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -9,6 +9,6 @@ %strong = @snippet.file_name .file-actions.hidden-xs - .btn-group.tree-btn-group - = link_to 'Raw', raw_snippet_path(@snippet), class: "btn btn-sm", target: "_blank" + = clipboard_button(clipboard_target: ".blob-content[data-blob-id='#{@snippet.id}']") + = link_to 'Raw', raw_snippet_path(@snippet), class: "btn btn-sm", target: "_blank" = render 'shared/snippets/blob' |