Commit dc6e88f1 authored by Robert Knight's avatar Robert Knight

Move `clearSelection` function to SidebarContentController

This function is no longer inherited from the parent scope since
`<sidebar-content>` is now a component.

Since this helper function is only used by the sidebar, move it
to the SidebarContentController controller.
parent a5923eb2
...@@ -5,7 +5,6 @@ var scrollIntoView = require('scroll-into-view'); ...@@ -5,7 +5,6 @@ var scrollIntoView = require('scroll-into-view');
var events = require('./events'); var events = require('./events');
var parseAccountID = require('./filter/persona').parseAccountID; var parseAccountID = require('./filter/persona').parseAccountID;
var scopeTimeout = require('./util/scope-timeout'); var scopeTimeout = require('./util/scope-timeout');
var uiConstants = require('./ui-constants');
var serviceConfig = require('./service-config'); var serviceConfig = require('./service-config');
var bridgeEvents = require('../shared/bridge-events'); var bridgeEvents = require('../shared/bridge-events');
...@@ -142,16 +141,6 @@ module.exports = function AppController( ...@@ -142,16 +141,6 @@ module.exports = function AppController(
session.logout(); session.logout();
}; };
$scope.clearSelection = function () {
var selectedTab = annotationUI.getState().selectedTab;
if (!annotationUI.getState().selectedTab || annotationUI.getState().selectedTab === uiConstants.TAB_ORPHANS) {
selectedTab = uiConstants.TAB_ANNOTATIONS;
}
annotationUI.clearSelectedAnnotations();
annotationUI.selectTab(selectedTab);
};
$scope.search = { $scope.search = {
query: function () { query: function () {
return annotationUI.getState().filterQuery; return annotationUI.getState().filterQuery;
......
...@@ -4,6 +4,7 @@ var SearchClient = require('../search-client'); ...@@ -4,6 +4,7 @@ var SearchClient = require('../search-client');
var events = require('../events'); var events = require('../events');
var memoize = require('../util/memoize'); var memoize = require('../util/memoize');
var tabs = require('../tabs'); var tabs = require('../tabs');
var uiConstants = require('../ui-constants');
function firstKey(object) { function firstKey(object) {
for (var k in object) { for (var k in object) {
...@@ -324,6 +325,16 @@ function SidebarContentController( ...@@ -324,6 +325,16 @@ function SidebarContentController(
this.topLevelThreadCount = function () { this.topLevelThreadCount = function () {
return thread().totalChildren; return thread().totalChildren;
}; };
this.clearSelection = function () {
var selectedTab = annotationUI.getState().selectedTab;
if (!annotationUI.getState().selectedTab || annotationUI.getState().selectedTab === uiConstants.TAB_ORPHANS) {
selectedTab = uiConstants.TAB_ANNOTATIONS;
}
annotationUI.clearSelectedAnnotations();
annotationUI.selectTab(selectedTab);
};
} }
module.exports = { module.exports = {
......
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