Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add annotation count feature #658

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions resources/assets/js/annotations/annotatorContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ export default {
annotationsHiddenByFilter() {
return this.annotations.length !== this.filteredAnnotations.length;
},
annotationCount() {
return this.annotations.length;
}
},
methods: {
getImageAndAnnotationsPromises(id) {
Expand Down
11 changes: 11 additions & 0 deletions resources/assets/js/annotations/components/annotationsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default {
type: Boolean,
default: false,
},
totalAnnotationCount: {
type: Number,
default: 0
}
},
computed: {
labelItems() {
Expand Down Expand Up @@ -79,6 +83,13 @@ export default {
};
});
},
annotationBadgeCount() {
if (this.hasActiveFilter) {
return this.annotations.length + "/" + this.totalAnnotationCount
} else {
return this.totalAnnotationCount;
}
},
},
methods: {
handleSelect(annotation, shift) {
Expand Down
3 changes: 3 additions & 0 deletions resources/assets/js/videos/videoContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ export default {
annotationsHiddenByFilter() {
return this.annotations.length !== this.filteredAnnotations.length;
},
annotationCount() {
return this.annotations.length;
}
},
methods: {
prepareAnnotation(annotation) {
Expand Down
7 changes: 7 additions & 0 deletions resources/views/annotations/show/tabs/annotations.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<sidebar-tab name="annotations" icon="map-marker-alt" title="Annotations" class="sidebar__tab--nopad" :highlight="hasAnnotationFilter">
<annotations-tab
:annotations="filteredAnnotations"
:total-annotation-count="annotationCount"
:selected-annotations="selectedAnnotations"
:annotation-filters="annotationFilters"
:can-detach-others="@can('forceEditIn', $volume) true @else false @endcan"
Expand All @@ -26,6 +27,12 @@
<div v-if="annotationsHiddenByFilter" class="text-info">
Some annotations are hidden by a filter.
</div>
<div class="text-muted">Total
<span
class="pull-right badge"
v-text="annotationBadgeCount"
></span>
</div>
</div>
<ul class="annotations-tab__list list-unstyled" ref="scrollList">
<label-item
Expand Down
7 changes: 7 additions & 0 deletions resources/views/videos/show/sidebar-annotations.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class="sidebar__tab--nopad"
>
<annotations-tab
:annotations="filteredAnnotations"
:total-annotation-count="annotationCount"
:selected-annotations="selectedAnnotations"
:annotation-filters="annotationFilters"
:can-detach-others="@can('forceEditIn', $volume) true @else false @endcan"
Expand All @@ -31,6 +32,12 @@ class="sidebar__tab--nopad"
<div v-if="annotationsHiddenByFilter" class="text-info">
Some annotations are hidden by a filter.
</div>
<div class="text-muted">Total
<span
class="pull-right badge"
v-text="annotationBadgeCount"
></span>
</div>
</div>
<ul class="annotations-tab__list list-unstyled" ref="scrollList">
<label-item
Expand Down