Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
subugoe
emo
TIDO
Commits
55d865b6
Commit
55d865b6
authored
Jun 07, 2021
by
dindigala
Browse files
refactor: addressing review comments
parent
3596ab87
Pipeline
#201700
passed with stages
in 5 minutes and 29 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/components/annotations/annotations.vue
View file @
55d865b6
...
...
@@ -16,14 +16,15 @@
@
click=
"activeTab(annotationTab.key)"
/>
</q-tabs>
<div
v-if=
"currentAnnotation.length"
v-if=
"currentAnnotation
s
.length"
class=
"q-ma-sm"
>
<AnnotationToggles
/>
<AnnotationList
:hot-annotations=
"currentAnnotation"
:hot-annotations=
"currentAnnotation
s
"
:get-icon=
"getIcon"
:status-check=
"statusCheck"
:toggle=
"toggle"
...
...
@@ -92,22 +93,22 @@ export default {
configuredTypes
()
{
return
this
.
config
.
annotations
.
types
.
map
((
type
)
=>
type
.
contenttype
);
},
currentAnnotation
()
{
const
tabFields
=
this
.
annotationTabs
.
find
((
collection
)
=>
collection
.
key
===
this
.
currentTab
);
currentAnnotation
s
()
{
const
contentType
=
this
.
annotationTabs
.
find
((
collection
)
=>
collection
.
key
===
this
.
currentTab
);
return
this
.
hotAnnotations
.
filter
((
annotationCollection
)
=>
tabFields
.
field
.
includes
(
annotationCollection
.
body
[
'
x-content-type
'
]));
return
this
.
hotAnnotations
.
filter
((
annotationCollection
)
=>
contentType
.
type
.
includes
(
annotationCollection
.
body
[
'
x-content-type
'
]));
},
annotationTabs
()
{
return
[
{
collectionTitle
:
'
Editorial
'
,
key
:
'
editorial
'
,
field
:
[
'
Place
'
,
'
Person
'
,
'
Editorial Comment
'
],
type
:
[
'
Place
'
,
'
Person
'
,
'
Editorial Comment
'
],
},
{
collectionTitle
:
'
Motifs
'
,
key
:
'
motifs
'
,
field
:
[
'
Motif
'
],
type
:
[
'
Motif
'
],
},
];
},
...
...
@@ -122,6 +123,7 @@ export default {
const
interval
=
setInterval
(()
=>
{
if
(
this
.
annotationLoading
)
{
this
.
hotAnnotations
=
this
.
filterAnnotationTypes
();
this
.
highlightActiveTabContent
(
'
editorial
'
);
clearInterval
(
interval
);
}
},
500
);
...
...
@@ -130,8 +132,26 @@ export default {
});
},
methods
:
{
highlightActiveTabContent
(
key
)
{
const
contentTypes
=
this
.
annotationTabs
.
find
((
content
)
=>
content
.
key
===
key
).
type
;
this
.
annotations
.
forEach
((
annotation
)
=>
{
const
id
=
this
.
stripAnnotationId
(
annotation
.
target
.
id
);
const
textElement
=
document
.
getElementById
(
id
);
if
(
contentTypes
.
includes
(
annotation
.
body
[
'
x-content-type
'
]))
{
textElement
.
classList
.
add
(
'
annotation
'
);
textElement
.
classList
.
add
(
'
annotation-disabled
'
);
}
else
{
textElement
.
classList
.
remove
(
'
annotation
'
);
textElement
.
classList
.
add
(
'
annotation-disabled
'
);
}
});
},
activeTab
(
key
)
{
this
.
currentTab
=
key
;
this
.
highlightActiveTabContent
(
key
);
},
createSVG
(
name
)
{
const
[
path
,
viewBox
]
=
Icons
[
name
].
split
(
'
|
'
);
...
...
@@ -188,6 +208,8 @@ export default {
try
{
svg
=
this
.
createSVG
(
this
.
getIconName
(
contentType
));
svg
.
setAttribute
(
'
id
'
,
`annotation-icon-
${
id
}
`
);
}
catch
(
err
)
{
svg
=
null
;
}
...
...
@@ -195,9 +217,6 @@ export default {
if
(
svg
)
{
textElement
.
prepend
(
svg
);
}
textElement
.
classList
.
toggle
(
'
annotation
'
);
textElement
.
classList
.
toggle
(
'
annotation-disabled
'
);
},
statusCheck
()
{
...
...
@@ -240,6 +259,13 @@ export default {
this
.
selectedAll
=
bool
;
this
.
selectedNone
=
!
bool
;
},
toggleAnnotationList
(
id
)
{
try
{
document
.
getElementById
(
`list
${
id
}
`
).
classList
.
toggle
(
'
bg-grey-2
'
);
}
catch
(
err
)
{
// Error display
}
},
},
};
</
script
>
...
...
src/index.template.html
View file @
55d865b6
...
...
@@ -52,6 +52,7 @@
},
{
"
contenttype
"
:
"
Motif
"
,
"
icon
"
:
"
fasHighlighter
"
,
"
label
"
:
"
Motifs
"
}
]
...
...
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