component:mohistory.searchAndFilter source

Manages the search box and facet tabs that are part of each search interface.

Dependencies:
NameTypeDescription
$transitions

UI-Router service for registering hooks to listen for route changes

$location

AngularJS wrapper for document.

$anchorScroll

AngularJS service for scrolling the interface

$timeout

wrapper for window.setTimeout()

Methods

addFacetPlusCloseTab (facetType, currentFacet)

Add facet to the state and by consequence the URL query string. This will cause the state to reload, so to reduce confusion close the currently open tab.

Parameters:
NameTypeDescription
facetType

Major category of facet, e.g. 'department' or 'collection'

currentFacet

Specific facet to filter by, e.g. 'Archival Collections'

isNumber (item)

The search APIs return result counts either as numbers or strings. This function returns true if item is a number.

Parameters:
NameTypeDescription
item
Returns:

true if the input is a number, false otherwise

isTabVisible (tabToCheck)

Returns true if a tab should be visible to the user, false otherwise.

Parameters:
NameTypeDescription
tabToCheck

Index of the tab to check.

Returns:

True if tab should be shown, false otherwise

onDestroy

Clean up code run when the component is destroyed

onInit

Initial setup for the searchAndFilter component

setTab (activeTab)

Update the current tab. If vm.tab matches the passed parameter, then the tab is closed.

Parameters:
NameTypeDescription
activeTab

Index of tab to make visible.