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
25627e9a
Commit
25627e9a
authored
6 years ago
by
Sven Kästle
Browse files
Options
Downloads
Patches
Plain Diff
refactor: Switch from passing element to id of annotation
parent
e90511d6
No related branches found
No related tags found
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
+13
-9
13 additions, 9 deletions
...samforschen/src/main/webapp/assets/js/annotationScript.js
with
13 additions
and
9 deletions
gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js
+
13
−
9
View file @
25627e9a
...
@@ -283,6 +283,7 @@ function displayAnnotation(annotation) {
...
@@ -283,6 +283,7 @@ function displayAnnotation(annotation) {
.
append
(
.
append
(
// annotation card
// annotation card
$
(
'
<div>
'
).
attr
(
'
class
'
,
'
annotation-card
'
)
$
(
'
<div>
'
).
attr
(
'
class
'
,
'
annotation-card
'
)
.
attr
(
'
id
'
,
annotation
.
id
)
.
mouseenter
(
function
()
{
.
mouseenter
(
function
()
{
$
(
this
).
children
(
'
.annotation-header
'
).
css
(
'
background-color
'
,
getDarkUserColor
(
annotation
.
userToken
));
$
(
this
).
children
(
'
.annotation-header
'
).
css
(
'
background-color
'
,
getDarkUserColor
(
annotation
.
userToken
));
})
})
...
@@ -321,7 +322,7 @@ function displayAnnotation(annotation) {
...
@@ -321,7 +322,7 @@ function displayAnnotation(annotation) {
// unfold button
// unfold button
$
(
'
<div>
'
).
attr
(
'
class
'
,
'
annotation-header-toggle
'
)
$
(
'
<div>
'
).
attr
(
'
class
'
,
'
annotation-header-toggle
'
)
.
click
(
function
()
{
.
click
(
function
()
{
toggleButtonHandler
(
$
(
this
)
);
toggleButtonHandler
(
annotation
.
id
);
})
})
.
append
(
.
append
(
$
(
'
<i>
'
).
attr
(
'
class
'
,
'
fas fa-chevron-down
'
)
$
(
'
<i>
'
).
attr
(
'
class
'
,
'
fas fa-chevron-down
'
)
...
@@ -347,8 +348,7 @@ function displayAnnotation(annotation) {
...
@@ -347,8 +348,7 @@ function displayAnnotation(annotation) {
$
(
'
<i>
'
).
attr
(
'
class
'
,
editIcon
)
$
(
'
<i>
'
).
attr
(
'
class
'
,
editIcon
)
)
)
.
click
(
function
()
{
.
click
(
function
()
{
// deleteAnnotationHandler($(this).closest('li'), annotation.id)
editAnnotationHandler
(
annotation
.
id
)
editAnnotationHandler
(
$
(
this
).
closest
(
'
.annotation-card
'
))
})
})
}
}
}
}
...
@@ -541,13 +541,15 @@ function isTimestampToday(timestamp) {
...
@@ -541,13 +541,15 @@ function isTimestampToday(timestamp) {
/**
/**
* Toggle between the toggle button status
* Toggle between the toggle button status
*
*
* @param
element The given toggle butt
on
* @param
id The id of the clicked annotati
on
*/
*/
function
toggleButtonHandler
(
element
)
{
function
toggleButtonHandler
(
id
)
{
// the clicked annotation card
var
card
=
$
(
'
#
'
+
id
);
// open and close annotation text
// open and close annotation text
element
.
parent
().
siblings
(
"
.annotation-body
"
).
children
(
"
p
"
).
toggleClass
(
"
overflow-hidden
"
);
card
.
find
(
"
.annotation-body
"
).
children
(
"
p
"
).
toggleClass
(
"
overflow-hidden
"
);
// toggle between up and down button
// toggle between up and down button
element
.
children
(
"
i
"
).
toggleClass
(
"
fa-chevron-down fa-chevron-up
"
)
card
.
find
(
'
.annotation-header-toggle
'
)
.
children
(
"
i
"
).
toggleClass
(
"
fa-chevron-down fa-chevron-up
"
)
}
}
/**
/**
...
@@ -583,9 +585,11 @@ function saveNewAnnotation(title, comment, startCharacter, endCharacter) {
...
@@ -583,9 +585,11 @@ function saveNewAnnotation(title, comment, startCharacter, endCharacter) {
/**
/**
* Open edit modal with title and comment from given card
* Open edit modal with title and comment from given card
*
*
* @param
card T
he clicked annotation
card
* @param
id The id of t
he clicked annotation
*/
*/
function
editAnnotationHandler
(
card
)
{
function
editAnnotationHandler
(
id
)
{
// the clicked annotation card
var
card
=
$
(
'
#
'
+
id
);
// get title and comment
// get title and comment
var
title
=
card
.
find
(
'
.annotation-header-data-title
'
).
text
();
var
title
=
card
.
find
(
'
.annotation-header-data-title
'
).
text
();
var
comment
=
card
.
find
(
'
.annotation-body-text
'
).
text
();
var
comment
=
card
.
find
(
'
.annotation-body-text
'
).
text
();
...
...
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