summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-10-23 15:31:43 +0200
committerRobert Speicher <rspeicher@gmail.com>2015-10-23 15:31:43 +0200
commit187625831f7b501ff6689707d1859b9c7ec4f5e0 (patch)
tree22470a0919bce92a211a3e6fda1d5c594c102f31
parent831deeeac3b0de16f65ae67f5c0a249a95ba3079 (diff)
downloadgitlab-ce-187625831f7b501ff6689707d1859b9c7ec4f5e0.tar.gz
Add "Copy to clipboard" buttons
Adds buttons to the commit list SHAs and the cross-project reference data on issuables.
-rw-r--r--app/helpers/clipboard_helper.rb8
-rw-r--r--app/views/projects/commits/_commit.html.haml3
-rw-r--r--app/views/projects/issues/_discussion.html.haml6
3 files changed, 14 insertions, 3 deletions
diff --git a/app/helpers/clipboard_helper.rb b/app/helpers/clipboard_helper.rb
new file mode 100644
index 00000000000..9659507bf07
--- /dev/null
+++ b/app/helpers/clipboard_helper.rb
@@ -0,0 +1,8 @@
+module ClipboardHelper
+ def clipboard_button(target = nil)
+ content_tag :button,
+ icon('clipboard'),
+ class: 'btn btn-xs btn-clipboard js-clipboard-trigger',
+ type: :button
+ end
+end
diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml
index cddd5aa3a83..e80cc194d29 100644
--- a/app/views/projects/commits/_commit.html.haml
+++ b/app/views/projects/commits/_commit.html.haml
@@ -21,7 +21,8 @@
= link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}" do
= ci_status_icon(ci_commit)
&nbsp;
- = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id"
+ = clipboard_button
+ = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id", data: {clipboard_text: commit.id}
.notes_count
- if note_count > 0
diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml
index d4a98eca473..c5fd863ae99 100644
--- a/app/views/projects/issues/_discussion.html.haml
+++ b/app/views/projects/issues/_discussion.html.haml
@@ -17,8 +17,10 @@
- @participants.each do |participant|
= link_to_member(@project, participant, name: false, size: 24)
.col-md-3
- %span.slead.has_tooltip{title: 'Cross-project reference'}
- = cross_project_reference(@project, @issue)
+ .input-group.cross-project-reference
+ %span.slead.has_tooltip{title: 'Cross-project reference'}
+ = cross_project_reference(@project, @issue)
+ = clipboard_button
.row
%section.col-md-9