From da08a6cd384911239aa2819e65ac1ac6f1bedc9f Mon Sep 17 00:00:00 2001 From: Buddha Man Nepali Date: Tue, 20 Jun 2017 09:07:48 +0545 Subject: [PATCH 01/24] PCHR-2319: Pass modalMode to Document Modal resolve option --- civihr_employee_portal/js/ta-documents-app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/civihr_employee_portal/js/ta-documents-app.js b/civihr_employee_portal/js/ta-documents-app.js index d20ec287..478505f4 100644 --- a/civihr_employee_portal/js/ta-documents-app.js +++ b/civihr_employee_portal/js/ta-documents-app.js @@ -57,6 +57,9 @@ templateUrl: config.path.TPL + 'modal/document.html?v=3', controller: 'ModalDocumentCtrl', resolve: { + modalMode: function () { + return ''; + }, role: function () { return role; }, From c4c47b839cbd050ea81cd39188e16a904982ff51 Mon Sep 17 00:00:00 2001 From: Buddha Man Nepali Date: Tue, 13 Jun 2017 22:04:45 +0545 Subject: [PATCH 02/24] PCHR-2317: Attatch document modal to the root of angular app --- civihr_employee_portal/js/ta-documents-app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/civihr_employee_portal/js/ta-documents-app.js b/civihr_employee_portal/js/ta-documents-app.js index 478505f4..4c878d95 100644 --- a/civihr_employee_portal/js/ta-documents-app.js +++ b/civihr_employee_portal/js/ta-documents-app.js @@ -53,7 +53,7 @@ */ function openModalDocument(data, role) { var modalInstance = $modal.open({ - appendTo: $rootElement.find('div').eq(0), + appendTo: $rootElement, templateUrl: config.path.TPL + 'modal/document.html?v=3', controller: 'ModalDocumentCtrl', resolve: { From f19405f18123cc2a70605a677402d4bec1f264f7 Mon Sep 17 00:00:00 2001 From: Buddha Man Nepali Date: Fri, 16 Jun 2017 18:19:42 +0545 Subject: [PATCH 03/24] PCHR-2317: Load contacts and cache them before opening modal + display spinner --- civihr_employee_portal/js/ta-documents-app.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/civihr_employee_portal/js/ta-documents-app.js b/civihr_employee_portal/js/ta-documents-app.js index 4c878d95..a183239d 100644 --- a/civihr_employee_portal/js/ta-documents-app.js +++ b/civihr_employee_portal/js/ta-documents-app.js @@ -1,11 +1,14 @@ /* globals angular */ (function(angular) { - angular.module('taDocuments', ['civitasks.appDocuments']) + angular.module('taDocuments', ['civitasks.appDocuments', 'civitasks.directives']) .controller('ModalController', ['$scope', '$rootScope', '$window', '$rootElement', '$log', '$uibModal', 'DocumentService', 'FileService', 'config', 'settings', function($scope, $rootScope, $window, $rootElement, $log, $modal, DocumentService, FileService, config, settings) { var vm = {}; + var isContactsCached = {}; + + vm.showOpenBtn = true; /** * Gets Document for the given document id and @@ -21,6 +24,9 @@ throw new Error('Requested Document is not available'); } + $rootScope.$broadcast('ct-spinner-show'); + vm.showOpenBtn = false; + openModalDocument(data[0], role); }) .catch(function(reason) { @@ -33,15 +39,13 @@ $rootScope.$on('document-saved', function () { $window.location.reload(); }); - // Get list of documents DocumentService.get({ 'status_id': { 'NOT IN': config.status.resolve.DOCUMENT } }).then(function (documents) { - // Getting and caching only the contacts - DocumentService.cacheContactsAndAssignments(documents, 'contacts'); + isContactsCached = DocumentService.cacheContactsAndAssignments(documents, 'contacts'); }); })(); @@ -66,6 +70,7 @@ data: function () { return data; }, + isCachedContacts: isContactsCached, files: function () { if (!data.id || !+data.file_count) { return []; @@ -75,6 +80,11 @@ } } }); + + modalInstance.opened.then(function () { + $rootScope.$broadcast('ct-spinner-hide'); + vm.showOpenBtn = true; + }); }; return vm; From acd069a244fd41d9eee7b1ec67c1b341d86ba36a Mon Sep 17 00:00:00 2001 From: Buddha Man Nepali Date: Fri, 16 Jun 2017 18:20:39 +0545 Subject: [PATCH 04/24] PCHR-2317: Add ct-spinner + hide button as appropriate --- .../templates/views-view-table--Documents--block-1.tpl.php | 3 ++- .../templates/views-view-table--Documents--block.tpl.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/civihr_employee_portal/views/templates/views-view-table--Documents--block-1.tpl.php b/civihr_employee_portal/views/templates/views-view-table--Documents--block-1.tpl.php index 4552ab12..8d0fca24 100644 --- a/civihr_employee_portal/views/templates/views-view-table--Documents--block-1.tpl.php +++ b/civihr_employee_portal/views/templates/views-view-table--Documents--block-1.tpl.php @@ -94,8 +94,9 @@ - + diff --git a/civihr_employee_portal/views/templates/views-view-table--Documents--block.tpl.php b/civihr_employee_portal/views/templates/views-view-table--Documents--block.tpl.php index 9b056d75..3be9b72a 100644 --- a/civihr_employee_portal/views/templates/views-view-table--Documents--block.tpl.php +++ b/civihr_employee_portal/views/templates/views-view-table--Documents--block.tpl.php @@ -100,7 +100,7 @@ - +