(function () {
'use strict';
// Content List
angular
.module('mohistory')
.component('contentList', {
templateUrl: 'app/components/content-list/content-list.component.html',
controller: contentListCtrl,
controllerAs: 'contentList',
bindings: {
data: '<',
}
});
contentListCtrl.$inject = [];
/**
* This component can an render any of the following mhs:displayClasses associated
* with the mhs:dataClass `content-list`: press-fact-sheets (aka documentDownloads
* or document-downloads in datastore), press-faq (aka questionAndAnswer or
* question-and-answer in datastore), resource-text-block, and resource-downloads-block.
* In addition, the component can render the `directive` mhs:displayClass and mhs:dataClass.
* @memberof mohistory
* @name contentList
* @ngdoc component
*/
function contentListCtrl() {
var vm = this;
/* ----- Variables ----- */
vm.blocks = {
'documentDownloads': {
isInteractive: false,
usesParallax: true,
parallaxSpeed: 2,
},
'questionAndAnswer': {
isInteractive: false,
usesParallax: true,
parallaxSpeed: 2,
},
'resource-text-block': {
isInteractive: false,
usesParallax: true,
parallaxSpeed: 2,
},
'resource-downloads-block': {
isInteractive: false,
usesParallax: true,
parallaxSpeed: 2,
},
'directory': {
isInteractive: false,
usesParallax: true,
parallaxSpeed: 2,
},
};
vm.curBlockConfig = {};
/* ----- Function Bindings ----- */
vm.$onInit = onInit;
vm.convertTelNum = convertTelNum;
/* ----- Function Definitions ----- */
/**
* Initialization code run every time the component is
* created, used to setup variables.
* @function onInit
* @memberof contentList
*/
function onInit() {
vm.curBlockConfig = vm.blocks[vm.data['mhs:displayClass']];
}
/**
* Format the telephone numbers before displaying them.
* @function convertTelNum
* @memberof contentList
* @param {string} num Telephone number
*/
function convertTelNum(num) {
return num.slice(1).replace(/\)\s/g, '-');
}
};
})();