Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
6ec0656e
Commit
6ec0656e
authored
Oct 15, 2016
by
Robert Hitt
Browse files
Made the Copy button tooltip prettier.
parent
05785aff
Pipeline
#392
passed with stage
in 3 minutes and 59 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
go/go/templates/link_box.html
View file @
6ec0656e
...
...
@@ -9,8 +9,8 @@
<div
id=
"link-container"
class=
"input-group"
>
<a
id=
"link"
class=
"form-control"
href=
"{{url.short}}"
>
{{domain}}{{url.short}}
</a>
<div
id=
"button-container"
class=
"input-group-addon"
>
<button
id=
"
bt
n"
type=
"button"
class=
"button btn btn-default btn-xs fa"
role=
"button"
data-clipboard-target=
"#link"
>
<button
id=
"
copy-butto
n"
type=
"button"
class=
"button btn btn-default btn-xs fa"
role=
"button"
data-clipboard-target=
"#link"
title=
"Copy to Clipboard"
>
<i
id=
"clipboard-icon"
class=
"fa fa-clipboard fa-1g"
aria-hidden=
"true"
></i></button>
</div>
</div>
...
...
go/static/css/style-link-box.css
View file @
6ec0656e
...
...
@@ -21,13 +21,13 @@ pre {
padding-top
:
4px
;
}
#
bt
n
{
#
copy-butto
n
{
border
:
none
;
background-color
:
#eeeeee
;
padding-bottom
:
3px
;
}
#
bt
n
:focus
{
#
copy-butto
n
:focus
{
outline
:
none
;
}
...
...
@@ -38,3 +38,8 @@ pre {
#link-container
{
width
:
400px
;
}
.tooltip-inner
{
white-space
:
nowrap
;
max-width
:
none
;
}
go/static/js/copy.js
View file @
6ec0656e
...
...
@@ -2,26 +2,20 @@
* Script for copying text and displaying a tooltip.
*/
$
(
'
#btn
'
).
tooltip
({
trigger
:
'
click
'
,
var
clipboard
=
new
Clipboard
(
'
#copy-button
'
);
$
(
'
#copy-button
'
).
tooltip
({
trigger
:
'
hover
'
,
placement
:
'
bottom
'
});
function
setTooltip
(
button
,
message
)
{
$
(
button
).
tooltip
(
'
hide
'
).
attr
(
'
data-original-title
'
,
message
)
.
tooltip
(
'
show
'
);
}
function
hideTooltip
(
button
)
{
window
.
setTimeout
(
function
()
{
$
(
button
).
tooltip
(
'
hide
'
);
},
700
);
}
var
clipboard
=
new
Clipboard
(
'
#btn
'
);
$
(
'
#copy-button
'
).
on
(
'
hidden.bs.tooltip
'
,
function
()
{
$
(
'
#copy-button
'
).
attr
(
'
data-original-title
'
,
'
Copy to Clipboard
'
);
});
clipboard
.
on
(
'
success
'
,
function
(
e
)
{
e
.
clearSelection
();
setTooltip
(
e
.
trigger
,
'
Copied!
'
);
hideTooltip
(
e
.
trigger
);
$
(
'
#copy-button
'
).
attr
(
'
data-original-title
'
,
'
Copied!
'
).
tooltip
(
'
show
'
);
});
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