BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0139896b
Commit
0139896b
authored
Dec 13, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '3478-copy-commit-hash-to-clipboard' into 'master'
Copy commit hash to clipboard Closes #3478 See merge request !8020
parents
f4dde5d5
602447a3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
16 deletions
+8
-16
copy_to_clipboard.js
app/assets/javascripts/copy_to_clipboard.js
+2
-2
button_helper.rb
app/helpers/button_helper.rb
+1
-1
_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+2
-7
_tree_content.html.haml
app/views/projects/tree/_tree_content.html.haml
+2
-5
_commit_box.html.haml_spec.rb
spec/views/projects/commit/_commit_box.html.haml_spec.rb
+1
-1
No files found.
app/assets/javascripts/copy_to_clipboard.js
View file @
0139896b
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
var
genericError
,
genericSuccess
,
showTooltip
;
var
genericError
,
genericSuccess
,
showTooltip
;
genericSuccess
=
function
(
e
)
{
genericSuccess
=
function
(
e
)
{
showTooltip
(
e
.
trigger
,
'Copied
!
'
);
showTooltip
(
e
.
trigger
,
'Copied'
);
// Clear the selection and blur the trigger so it loses its border
// Clear the selection and blur the trigger so it loses its border
e
.
clearSelection
();
e
.
clearSelection
();
return
$
(
e
.
trigger
).
blur
();
return
$
(
e
.
trigger
).
blur
();
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
var
originalTitle
=
$target
.
data
(
'original-title'
);
var
originalTitle
=
$target
.
data
(
'original-title'
);
$target
$target
.
attr
(
'title'
,
'Copied
!
'
)
.
attr
(
'title'
,
'Copied'
)
.
tooltip
(
'fixTitle'
)
.
tooltip
(
'fixTitle'
)
.
tooltip
(
'show'
)
.
tooltip
(
'show'
)
.
attr
(
'title'
,
originalTitle
)
.
attr
(
'title'
,
originalTitle
)
...
...
app/helpers/button_helper.rb
View file @
0139896b
...
@@ -16,7 +16,7 @@ module ButtonHelper
...
@@ -16,7 +16,7 @@ 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 btn-transparent'
css_class
=
data
[
:class
]
||
'btn-clipboard btn-transparent'
title
=
data
[
:title
]
||
'Copy to
C
lipboard'
title
=
data
[
:title
]
||
'Copy to
c
lipboard'
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'
),
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
0139896b
.page-content-header
.page-content-header
.header-main-content
.header-main-content
%strong
Commit
%strong
%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
=
clipboard_button
(
clipboard_text:
@commit
.
id
)
=
clipboard_button
(
clipboard_text:
@commit
.
id
)
=
@commit
.
short_id
%span
.hidden-xs
authored
%span
.hidden-xs
authored
#{
time_ago_with_tooltip
(
@commit
.
authored_date
)
}
#{
time_ago_with_tooltip
(
@commit
.
authored_date
)
}
%span
by
%span
by
...
...
app/views/projects/tree/_tree_content.html.haml
View file @
0139896b
...
@@ -5,14 +5,11 @@
...
@@ -5,14 +5,11 @@
%tr
%tr
%th
Name
%th
Name
%th
.hidden-xs
%th
.hidden-xs
.pull-left
Last
C
ommit
.pull-left
Last
c
ommit
.last-commit.hidden-sm.pull-left
.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"
=
link_to
@commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
),
class:
"monospace"
–
=
time_ago_with_tooltip
(
@commit
.
committed_date
)
=
time_ago_with_tooltip
(
@commit
.
committed_date
)
=
@commit
.
full_title
=
@commit
.
full_title
%small
.commit-history-link-spacer
|
%small
.commit-history-link-spacer
|
...
...
spec/views/projects/commit/_commit_box.html.haml_spec.rb
View file @
0139896b
...
@@ -13,7 +13,7 @@ describe 'projects/commit/_commit_box.html.haml' do
...
@@ -13,7 +13,7 @@ describe 'projects/commit/_commit_box.html.haml' do
it
'shows the commit SHA'
do
it
'shows the commit SHA'
do
render
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
end
it
'shows the last pipeline that ran for the commit'
do
it
'shows the last pipeline that ran for the commit'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment