Commit b417a3c7 authored by Hannah Stepanek's avatar Hannah Stepanek

Change selectedCounts to areAllAnnotationsVisible

parent bdd195d6
......@@ -15,7 +15,8 @@ module.exports = {
onClearSelection: '&',
searchQuery: '<',
selectedTab: '<',
selectionCount: '<',
// Boolean indicating all annotations are visible (none are hidden).
areAllAnnotationsVisible: '<',
totalAnnotations: '<',
totalNotes: '<',
},
......
......@@ -299,15 +299,15 @@ function SidebarContentController(
this.focus = focusAnnotation;
this.scrollTo = scrollToAnnotation;
this.selectedAnnotationCount = function() {
this.areAllAnnotationsVisible = function() {
if (this.directLinkedGroupFetchFailed) {
return 1;
return true;
}
const selection = store.getState().selectedAnnotationMap;
if (!selection) {
return 0;
return false;
}
return Object.keys(selection).length;
return Object.keys(selection).length > 0;
};
this.selectedGroupUnavailable = function() {
......
......@@ -30,7 +30,7 @@ describe('searchStatusBar', function() {
const msg = 'Show all annotations';
const msgCount = '(2)';
const elem = util.createDirective(document, 'searchStatusBar', {
selectionCount: 1,
areAllAnnotationsVisible: true,
totalAnnotations: 2,
selectedTab: 'annotation',
});
......@@ -43,7 +43,7 @@ describe('searchStatusBar', function() {
const msg = 'Show all notes';
const msgCount = '(3)';
const elem = util.createDirective(document, 'searchStatusBar', {
selectionCount: 1,
areAllAnnotationsVisible: true,
totalNotes: 3,
selectedTab: 'note',
});
......
......@@ -265,8 +265,8 @@ describe('sidebar.components.sidebar-content', function() {
$scope.$digest();
});
it('selectedAnnotationCount is > 0', function() {
assert.equal(ctrl.selectedAnnotationCount(), 1);
it('areAllAnnotationsVisible is true', function() {
assert.isTrue(ctrl.areAllAnnotationsVisible());
});
it("switches to the selected annotation's group", function() {
......@@ -295,8 +295,8 @@ describe('sidebar.components.sidebar-content', function() {
$scope.$digest();
});
it('selectedAnnotationCount is 0', function() {
assert.equal(ctrl.selectedAnnotationCount(), 0);
it('areAllAnnotationsVisible is false', function() {
assert.isFalse(ctrl.areAllAnnotationsVisible());
});
it('fetches annotations for the current group', function() {
......
......@@ -11,7 +11,7 @@
'one': '1 search result',
'other': '{} search results'}"></span>
</div>
<div class="search-status-bar" ng-if="!vm.filterActive && vm.selectionCount > 0">
<div class="search-status-bar" ng-if="!vm.filterActive && vm.areAllAnnotationsVisible">
<button class="primary-action-btn primary-action-btn--short"
ng-click="vm.onClearSelection()"
title="Clear the selection and show all annotations">
......
<selection-tabs
ng-if="!vm.search.query() && vm.selectedAnnotationCount() === 0"
ng-if="!vm.search.query() && vm.annotationsAreSelected()"
is-waiting-to-anchor-annotations="vm.waitingToAnchorAnnotations"
is-loading="vm.isLoading"
selected-tab="vm.selectedTab"
......@@ -14,7 +14,7 @@
filter-match-count="vm.visibleCount()"
on-clear-selection="vm.clearSelection()"
search-query="vm.search.query()"
selection-count="vm.selectedAnnotationCount()"
are-all-annotations-visible="vm.areAllAnnotationsVisible()"
total-count="vm.topLevelThreadCount()"
selected-tab="vm.selectedTab"
total-annotations="vm.totalAnnotations"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment