(function () { 'use strict'; // Service to store data about this users showcases var serviceId = 'itemsModals'; angular.module('items').factory(serviceId, ['$modal', itemsModals]); var templatePath = modulesSharedResourcesUrl + 'Modules/Items/Views/Modals/'; function itemsModals($modal) { var service = {}; // Create a new item service.createNewItem = function (selectedFolder, availableFolders) { $modal.open({ templateUrl: templatePath + 'create-item.html?version=270122', controller: 'createItemModalController', size: 'lg', backdrop: 'static', resolve: { selectedFolder: function () { return selectedFolder; }, availableFolders: function () { return availableFolders; } } }); } // Edit and save an existing or new item service.editItem = function (itemSummary, animate) { if (typeof animate == "undefined") { animate = true; } if (itemSummary.itemType === 'Folder') { $modal.open({ templateUrl: modulesSharedResourcesUrl + 'Modules/Folders/Views/Modals/' + 'create-folder.html?version=270122', controller: 'folderCreateModalController', size: 'lg', backdrop: 'static', resolve: { itemSummary: function () { return itemSummary; } } }); } else { $modal.open({ templateUrl: templatePath + 'edit-item.html?version=270122', controller: 'editItemModalController', size: 'lg', backdrop: 'static', resolve: { itemSummary: function () { return itemSummary; }, selectedFolder: function () { return itemSummary.selectedFolder; }, availableFolders: function () { return itemSummary.availableFolders; } } }); } } // Edit an item that is in a showcase - by opening a modal service.editShowcaseItem = function (currentShowcase, showcaseItem, size) { size = size || 'lg'; $modal.open({ templateUrl: templatePath + 'manage-showcase-item.html?version=270122', controller: 'manageShowcaseItemModalController', size: size, backdrop: 'static', resolve: { currentShowcase: function () { return currentShowcase; }, item: function () { return showcaseItem; } } }); } // Preview the item using a modal service.preview = function (itemSummary) { $modal.open({ templateUrl: templatePath + 'preview-item.html?version=270122', controller: 'itemPreviewModalController', size: 'lg', backdrop: 'static', resolve: { itemSummary: function () { return itemSummary; } } }); } // Recycle bin the item using a modal service.recycle = function (itemSummary) { $modal.open({ templateUrl: templatePath + 'recycle-item.html?version=270122', controller: 'itemRecycleModalController', size: 'sm', backdrop: 'static', resolve: { itemSummary: function () { return itemSummary; } } }) } // Remove item from folder using a modal service.removeItemFromFolder = function (itemSummary) { $modal.open({ templateUrl: templatePath + 'remove-item-from-folder.html?version=270122', controller: 'removeItemFromFolderModalController', size: 'sm', backdrop: 'static', resolve: { itemSummary: function () { return itemSummary; } } }) } service.deleteFolder = function (itemSummary) { $modal.open({ templateUrl: templatePath + 'delete-folder.html?version=270122', controller: 'deleteFolderModalController', size: 'sm', backdrop: 'static', resolve: { itemSummary: function () { return itemSummary; } } }) } return service; } })();