Add "Copy to clipboard" buttons

Adds buttons to the commit list SHAs and the cross-project reference
data on issuables.
This commit is contained in:
Robert Speicher 2015-10-23 15:31:43 +02:00
parent 831deeeac3
commit 187625831f
3 changed files with 14 additions and 3 deletions

View file

@ -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

View file

@ -21,7 +21,8 @@
= link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}" do = link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}" do
= ci_status_icon(ci_commit) = ci_status_icon(ci_commit)
   
= 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 .notes_count
- if note_count > 0 - if note_count > 0

View file

@ -17,8 +17,10 @@
- @participants.each do |participant| - @participants.each do |participant|
= link_to_member(@project, participant, name: false, size: 24) = link_to_member(@project, participant, name: false, size: 24)
.col-md-3 .col-md-3
%span.slead.has_tooltip{title: 'Cross-project reference'} .input-group.cross-project-reference
= cross_project_reference(@project, @issue) %span.slead.has_tooltip{title: 'Cross-project reference'}
= cross_project_reference(@project, @issue)
= clipboard_button
.row .row
%section.col-md-9 %section.col-md-9