(function(){ "use strict"; angular.module('shared') .component('resourceCardDetail', { templateUrl: '/shared/js/angular/book-grid/resource-card-detail.html', controller: 'resourceCardDetail', bindings: { orientation : '<', resourceTitle : '<', level : '<', lexile : '<', imageUrl : '<', isMultiLevel : '<', genre1 : '<', genre2 : '<', id : '<' } }) .controller('resourceCardDetail', ['ResourceList','constantValues', function (ResourceList,constantValues) { var ctrl = this; ctrl.getLinkClass = function() { return 'resourceCard-' + ctrl.orientation; }; ctrl.getClassBasedOnOrientation = function(className) { return className + ctrl.orientation; }; ctrl.getClassBasedOnLevel = function() { return 'razReadingLevel-' + ctrl.level; }; ctrl.isGridView = function() { return ResourceList.getView() === constantValues.GRID_VIEW; }; ctrl.getLanguageId = function() { return ResourceList.getLanguageId(); }; ctrl.getHref = function() { if (ResourceList.getType() === constantValues.TYPE_LEVELED_BOOKS) { return '/books/leveled-books/book/?id=' + ctrl.id; } else { return '/books/classics/classic/?id=' + ctrl.id; } }; ctrl.isLastItem = function() { return ctrl.id == ResourceList.getLastItemId(); }; //ctrl.showBookPopout = function() { // return ResourceList.getResources()[Object.keys(ResourceList.getResources())[0]][0]['id'] == ctrl.id; // return ResourceList.getType() === constantValues.TYPE_LEVELED_BOOKS || // ResourceList.getType() === constantValues.TYPE_CLASSIC_BOOKS || // ResourceList.getType() === constantValues.TYPE_GRAPHIC_COMIC_HUMOR_BOOKS || // ResourceList.getType() === constantValues.TYPE_FICTION_SERIES; // }; }]); })();