Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
aa096c09
Commit
aa096c09
authored
2 years ago
by
David Siegfried
Browse files
Options
Downloads
Patches
Plain Diff
refine copy-link-message, closes #486
Closes #486 Merge request
studip/studip!924
parent
00028bc4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
resources/assets/javascripts/bootstrap/copyable_links.js
+4
-7
4 additions, 7 deletions
resources/assets/javascripts/bootstrap/copyable_links.js
resources/assets/stylesheets/scss/copyable-links.scss
+20
-65
20 additions, 65 deletions
resources/assets/stylesheets/scss/copyable-links.scss
with
24 additions
and
72 deletions
resources/assets/javascripts/bootstrap/copyable_links.js
+
4
−
7
View file @
aa096c09
...
@@ -6,7 +6,7 @@ $(document).on('click', 'a.copyable-link', function (event) {
...
@@ -6,7 +6,7 @@ $(document).on('click', 'a.copyable-link', function (event) {
// Create dummy element and position it off screen
// Create dummy element and position it off screen
// This element must be "visible" (as in "not hidden") or otherwise
// This element must be "visible" (as in "not hidden") or otherwise
// the copy command will fail
// the copy command will fail
var
dummy
=
$
(
'
<textarea>
'
).
val
(
this
.
href
).
css
({
let
dummy
=
$
(
'
<textarea>
'
).
val
(
this
.
href
).
css
({
position
:
'
absolute
'
,
position
:
'
absolute
'
,
left
:
'
-9999px
'
left
:
'
-9999px
'
}).
appendTo
(
'
body
'
);
}).
appendTo
(
'
body
'
);
...
@@ -19,15 +19,13 @@ $(document).on('click', 'a.copyable-link', function (event) {
...
@@ -19,15 +19,13 @@ $(document).on('click', 'a.copyable-link', function (event) {
// Show visual hint using a deferred (this way we don't need to
// Show visual hint using a deferred (this way we don't need to
// duplicate the functionality in the done() handler)
// duplicate the functionality in the done() handler)
(
new
Promise
((
resolve
,
reject
)
=>
{
(
new
Promise
((
resolve
,
reject
)
=>
{
var
confirmation
=
$
(
'
<div class="copyable-link-confirmation">
'
);
let
confirmation
=
$
(
'
<div class="copyable-link-confirmation
copyable-link-success
">
'
);
confirmation
.
text
(
$gettext
(
'
Link wurde kopiert
'
));
confirmation
.
text
(
$gettext
(
'
Link wurde kopiert
'
));
confirmation
.
insertBefore
(
this
);
confirmation
.
insertBefore
(
'
#layout_container
'
);
$
(
this
).
parent
().
addClass
(
'
copyable-link-animation
'
);
// Resolve deferred when animation has ended or after 2 seconds as a
// Resolve deferred when animation has ended or after 2 seconds as a
// fail safe
// fail safe
var
timeout
=
setTimeout
(()
=>
{
let
timeout
=
setTimeout
(()
=>
{
$
(
this
).
parent
().
off
(
'
animationend
'
);
$
(
this
).
parent
().
off
(
'
animationend
'
);
resolve
(
confirmation
);
resolve
(
confirmation
);
},
1500
);
},
1500
);
...
@@ -37,6 +35,5 @@ $(document).on('click', 'a.copyable-link', function (event) {
...
@@ -37,6 +35,5 @@ $(document).on('click', 'a.copyable-link', function (event) {
});
});
})).
then
((
confirmation
,
parent
)
=>
{
})).
then
((
confirmation
,
parent
)
=>
{
confirmation
.
remove
();
confirmation
.
remove
();
$
(
this
).
parent
().
removeClass
(
'
copyable-link-animation
'
);
});
});
});
});
This diff is collapsed.
Click to expand it.
resources/assets/stylesheets/scss/copyable-links.scss
+
20
−
65
View file @
aa096c09
.copyable-link-animation
{
.copyable-link-confirmation
{
$animation-name
:
copyable-links-confirmation
;
position
:
fixed
;
$animation-duration
:
2s
;
bottom
:
60px
;
right
:
12px
;
height
:
60px
;
line-height
:
60px
;
max-width
:
calc
(
100%
-
140px
);
z-index
:
42000
;
border
:
solid
thin
$content-color-40
;
background-color
:
$white
;
background-repeat
:
no-repeat
;
background-position
:
1em
center
;
background-size
:
100px
;
box-shadow
:
5px
5px
#ececed
;
padding
:
5px
100px
;
transition
:
transform
.5s
ease
;
// Position confirmation message above the link
&
.copyable-link-success
{
position
:
relative
;
@include
background-icon
(
check-circle
,
status-green
,
24
);
div
{
position
:
absolute
;
top
:
0
;
right
:
0
;
bottom
:
0
;
left
:
0
;
text-align
:
center
;
@include
icon
(
before
,
check-circle
,
status-green
,
16px
,
5px
);
}
// Flip the link and confirmation message along the x axis
a
,
div
{
backface-visibility
:
hidden
;
pointer-events
:
none
;
}
a
{
@keyframes
copyable-links-confirmation-front
{
0
%
{
opacity
:
1
;
transform
:
rotateX
(
0
);
}
33
%
{
opacity
:
0
;
transform
:
rotateX
(
180deg
);
}
66
%
{
opacity
:
0
;
transform
:
rotateX
(
180deg
);
}
100
%
{
opacity
:
1
;
transform
:
rotateX
(
0
);
}
}
animation
:
copyable-links-confirmation-front
$animation-duration
linear
;
}
}
&
.copyable-link-error
{
div
{
@include
background-icon
(
decline-circle
,
status-red
,
24
);
@keyframes
copyable-links-confirmation-back
{
0
%
{
opacity
:
0
;
transform
:
rotateX
(
180deg
);
}
33
%
{
opacity
:
1
;
transform
:
rotateX
(
0
);
}
66
%
{
opacity
:
1
;
transform
:
rotateX
(
0
);
}
100
%
{
opacity
:
0
;
transform
:
rotateX
(
180deg
);
}
}
animation
:
copyable-links-confirmation-back
$animation-duration
linear
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment