Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fltrail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
fides
fltrail
Commits
d8fe1301
Commit
d8fe1301
authored
6 years ago
by
Sven Kästle
Browse files
Options
Downloads
Patches
Plain Diff
feat: Show and hide drop down button if necessary
It is necessary to hide the button if the comment text is to long
parent
b87c930a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js
+39
-0
39 additions, 0 deletions
...samforschen/src/main/webapp/assets/js/annotationScript.js
with
39 additions
and
0 deletions
gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js
+
39
−
0
View file @
d8fe1301
...
...
@@ -198,10 +198,20 @@ $(document).ready(function() {
$
.
each
(
response
,
function
(
i
,
annotation
)
{
displayAnnotation
(
annotation
);
})
// handle drop down button
showAndHideToggleButton
();
});
});
/**
* This will be called on page resize
*/
$
(
window
).
resize
(
function
()
{
// handle drop down button for every annotation
showAndHideToggleButton
();
});
/**
* POST: Save an annotation in the database
*
...
...
@@ -624,3 +634,32 @@ function editAnnotationHandler(id) {
// display annotation edit modal and pass id
$
(
'
#annotation-edit-modal
'
).
data
(
'
id
'
,
id
).
modal
(
"
show
"
);
}
/**
* Show or hide the drop down button for every annotation card.
* Call this on page resize and after annotations GET
*/
function
showAndHideToggleButton
()
{
// iterate over each annotation card
$
(
'
#annotations
'
).
find
(
'
li
'
).
each
(
function
()
{
// find the comment element, clone and hide it
var
comment
=
$
(
this
).
find
(
'
.annotation-body
'
).
children
(
'
p
'
);
var
clone
=
comment
.
clone
()
.
css
({
display
:
'
inline
'
,
width
:
'
auto
'
,
visibility
:
'
hidden
'
})
.
appendTo
(
'
body
'
);
var
cloneWidth
=
clone
.
width
();
// remove the element from the page
clone
.
remove
();
// show drop down button only if text was truncated
if
(
cloneWidth
>
comment
.
width
())
{
$
(
this
).
find
(
'
.annotation-header-toggle
'
).
show
();
}
else
{
$
(
this
).
find
(
'
.annotation-header-toggle
'
).
hide
();
}
})
}
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