Commit b417a3c7 authored by Hannah Stepanek's avatar Hannah Stepanek

Change selectedCounts to areAllAnnotationsVisible

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