Commit 0e098495 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'mr-file-path-copy-btn' into 'master'

Added copy file path button to diffs

## What does this MR do?

Adds a copy file path button in the header of diff files.

## Screenshots (if relevant)

![Screen_Shot_2016-10-10_at_09.59.48](/uploads/1aedd5033bb3c1893023bb8c8d99a708/Screen_Shot_2016-10-10_at_09.59.48.png)

## What are the relevant issue numbers?

Closes #23108

See merge request !6769
parents 5196f602 8592e992
...@@ -27,6 +27,7 @@ v 8.13.0 (unreleased) ...@@ -27,6 +27,7 @@ v 8.13.0 (unreleased)
- Revert "Label list shows all issues (opened or closed) with that label" - Revert "Label list shows all issues (opened or closed) with that label"
- Expose expires_at field when sharing project on API - Expose expires_at field when sharing project on API
- Fix VueJS template tags being rendered in code comments - Fix VueJS template tags being rendered in code comments
- Added copy file path button to merge request diff files
- Fix issue with page scrolling to top when closing or pinning sidebar (lukehowell) - Fix issue with page scrolling to top when closing or pinning sidebar (lukehowell)
- Add Issue Board API support (andrebsguedes) - Add Issue Board API support (andrebsguedes)
- Allow the Koding integration to be configured through the API - Allow the Koding integration to be configured through the API
......
...@@ -15,10 +15,11 @@ module ButtonHelper ...@@ -15,10 +15,11 @@ module ButtonHelper
# #
# See http://clipboardjs.com/#usage # See http://clipboardjs.com/#usage
def clipboard_button(data = {}) def clipboard_button(data = {})
css_class = data[:class] || 'btn-clipboard'
data = { toggle: 'tooltip', placement: 'bottom', container: 'body' }.merge(data) data = { toggle: 'tooltip', placement: 'bottom', container: 'body' }.merge(data)
content_tag :button, content_tag :button,
icon('clipboard'), icon('clipboard'),
class: "btn btn-clipboard", class: "btn #{css_class}",
data: data, data: data,
type: :button, type: :button,
title: "Copy to Clipboard" title: "Copy to Clipboard"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= link_to '#', class: 'js-toggle-diff-comments btn active has-tooltip btn-file-option', title: "Toggle comments for this file", disabled: @diff_notes_disabled do = link_to '#', class: 'js-toggle-diff-comments btn active has-tooltip btn-file-option', title: "Toggle comments for this file", disabled: @diff_notes_disabled do
= icon('comment') = icon('comment')
\ \
= clipboard_button(clipboard_text: diff_file.new_path, class: 'btn-file-option')
- if editable_diff?(diff_file) - if editable_diff?(diff_file)
- link_opts = @merge_request.id ? { from_merge_request_id: @merge_request.id } : {} - link_opts = @merge_request.id ? { from_merge_request_id: @merge_request.id } : {}
= edit_blob_link(@merge_request.source_project, @merge_request.source_branch, diff_file.new_path, = edit_blob_link(@merge_request.source_project, @merge_request.source_branch, diff_file.new_path,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment