(function () { 'use strict'; var serviceId = 'showboardsAdminService'; angular.module('showboardsAdmin').factory(serviceId, ['user', '$location', '$modal', showboardsAdminService]); var templatePath = modulesSharedResourcesUrl + 'Modules/MyShowboardsAdmin/Views/Modals/'; function showboardsAdminService(user, $location, $modal) { var service = { getCurrentShowboard: getCurrentShowboard, setCurrentShowboard: setCurrentShowboard, createBlankShowboard: createBlankShowboard, getShowboardUserDetails: getShowboardUserDetails, createBlankShowboardItem: createBlankShowboardItem, goBack: goBack, getReportReason: getReportReason, virusModal: virusModal }; var currentShowboard; return service; function getCurrentShowboard() { return currentShowboard; } function setCurrentShowboard(showboard) { currentShowboard = showboard; } // Create a blank showboard function createBlankShowboard() { return { name: '', description: '', displayAsOrganisation: false, publiclyVisible: null, publiclyAccessible: null, isDiscoverable: true, rules: '', tags: [], status: 0, showBoardStyle: { headerColour: 'primary', headerImageUrl: null }, numTimesViewed: 0, showBoardItems: [], allocatedAccessibleGroupIds: [], allocatedVisibleGroupIds: [], contributionLevel: null } } // Create a blank showboard function createBlankShowboardItem() { return { name: '', description: '', displayAsOrganisation: false, publiclyVisible: null, publiclyAccessible: null, tags: [], showBoardItemStyle: { headerColour: 'primary', headerImageUrl: null }, numTimesViewed: 0, status: 1 } } function getShowboardUserDetails(showboard) { user.getUserProfile(showboard.createdBy).then(function (data) { showboard.user = data; }); } // function to get back to the marking schemes list function goBack(path) { currentShowboard = null; $location.path(path); }; function getReportReason(reason) { if (reason == 0) { return "This isn't useful"; } if (reason == 1) { return 'This is inappropriate'; } if (reason == 2) { return 'This is factually incorrect'; } if (reason == 3) { return 'This offends me'; } if (reason == 4) { return 'This is spam'; } if (reason == 5) { return 'Other'; } } function virusModal() { $modal.open({ templateUrl: templatePath + 'virus-modal.html?version=270122', controller: 'virusModalController', size: 'sm', backdrop: 'static' }) } } angular.module('showboardsAdmin').filter('filterByMultipleOf', function () { return function (items, options) { var count = 0; return items.filter(function (element, index) { if (index >= options.start) { if (count % options.multipleOf == 0) { count = count + 1; return element; } count = count + 1; } }); } }); angular.module('showboardsAdmin').directive('itemHeight', function ($timeout) { return function (scope, el, attrs) { if (!scope.showboardItem.height) { scope.showboardItem.height = el[0].offsetHeight + 300; console.log(scope.showboardItem.height); } } }); })();