From da119ef3ad48f2229de933de30018022b6eb0803 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 4 Aug 2015 20:32:43 -0400 Subject: [PATCH] (feat) raw source support in contact module --- .../ContactsUI/UIxContactViewTemplate.wox | 15 +++++++ .../js/Contacts/CardController.js | 39 ++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox index 6572aad45..a058a2cb5 100644 --- a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox +++ b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox @@ -44,6 +44,21 @@ ng-click="editor.confirmDelete(editor.card)"> delete + + + + more_vert + + + + + + + + + +
diff --git a/UI/WebServerResources/js/Contacts/CardController.js b/UI/WebServerResources/js/Contacts/CardController.js index 560d750e6..feb865458 100644 --- a/UI/WebServerResources/js/Contacts/CardController.js +++ b/UI/WebServerResources/js/Contacts/CardController.js @@ -7,8 +7,8 @@ * Controller to view and edit a card * @ngInject */ - CardController.$inject = ['$scope', '$timeout', 'AddressBook', 'Card', 'Dialog', 'sgFocus', '$state', '$stateParams', 'stateCard']; - function CardController($scope, $timeout, AddressBook, Card, Dialog, focus, $state, $stateParams, stateCard) { + CardController.$inject = ['$scope', '$timeout', '$mdDialog', 'AddressBook', 'Card', 'Dialog', 'sgFocus', '$state', '$stateParams', 'stateCard']; + function CardController($scope, $timeout, $mdDialog, AddressBook, Card, Dialog, focus, $state, $stateParams, stateCard) { var vm = this; vm.card = stateCard; @@ -31,6 +31,7 @@ vm.reset = reset; vm.cancel = cancel; vm.confirmDelete = confirmDelete; + vm.viewRawSource = viewRawSource; function addOrgUnit() { var i = vm.card.$addOrgUnit(''); @@ -116,6 +117,40 @@ }); }); } + + function viewRawSource($event) { + Card.$$resource.post(vm.currentFolder.id + '/' + vm.card.id, "raw").then(function(data) { + $mdDialog.show({ + parent: angular.element(document.body), + targetEvent: $event, + clickOutsideToClose: true, + escapeToClose: true, + template: [ + '', + ' ', + '
',
+            data,
+            '    
', + '
', + '
', + ' ' + l('Close') + '', + '
', + '
' + ].join(''), + controller: CardRawSourceDialogController + }); + + /** + * @ngInject + */ + CardRawSourceDialogController.$inject = ['scope', '$mdDialog']; + function CardRawSourceDialogController(scope, $mdDialog) { + scope.close = function() { + $mdDialog.hide(); + }; + } + }); + } } angular