Merge branch '3478-copy-commit-hash-to-clipboard' into 'master'

Copy commit hash to clipboard

Closes #3478 

See merge request !8020
This commit is contained in:
Sean McGivern 2016-12-13 12:06:36 +00:00
commit 0139896b37
5 changed files with 9 additions and 17 deletions

View File

@ -6,7 +6,7 @@
var genericError, genericSuccess, showTooltip;
genericSuccess = function(e) {
showTooltip(e.trigger, 'Copied!');
showTooltip(e.trigger, 'Copied');
// Clear the selection and blur the trigger so it loses its border
e.clearSelection();
return $(e.trigger).blur();
@ -31,7 +31,7 @@
var originalTitle = $target.data('original-title');
$target
.attr('title', 'Copied!')
.attr('title', 'Copied')
.tooltip('fixTitle')
.tooltip('show')
.attr('title', originalTitle)

View File

@ -16,7 +16,7 @@ module ButtonHelper
# See http://clipboardjs.com/#usage
def clipboard_button(data = {})
css_class = data[:class] || 'btn-clipboard btn-transparent'
title = data[:title] || 'Copy to Clipboard'
title = data[:title] || 'Copy to clipboard'
data = { toggle: 'tooltip', placement: 'bottom', container: 'body' }.merge(data)
content_tag :button,
icon('clipboard'),

View File

@ -1,13 +1,8 @@
.page-content-header
.header-main-content
%strong Commit
%strong.monospace.js-details-short= @commit.short_id
= link_to("#", class: "js-details-expand hidden-xs hidden-sm") do
%span.text-expander
\...
%span.js-details-content.hide
%strong.monospace.commit-hash-full= @commit.id
%strong
= clipboard_button(clipboard_text: @commit.id)
= @commit.short_id
%span.hidden-xs authored
#{time_ago_with_tooltip(@commit.authored_date)}
%span by

View File

@ -5,14 +5,11 @@
%tr
%th Name
%th.hidden-xs
.pull-left Last Commit
.pull-left Last commit
.last-commit.hidden-sm.pull-left
 
%i.fa.fa-angle-right
 
%small.light
%small.light
= clipboard_button(clipboard_text: @commit.id)
= link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit), class: "monospace"
–
= time_ago_with_tooltip(@commit.committed_date)
= @commit.full_title
%small.commit-history-link-spacer |

View File

@ -13,7 +13,7 @@ describe 'projects/commit/_commit_box.html.haml' do
it 'shows the commit SHA' do
render
expect(rendered).to have_text("Commit #{Commit.truncate_sha(project.commit.sha)}")
expect(rendered).to have_text("#{Commit.truncate_sha(project.commit.sha)}")
end
it 'shows the last pipeline that ran for the commit' do