From 79cf1116648cc4c80dd7670de144ebcdd1258678 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 29 Jun 2015 00:22:59 -0700 Subject: [PATCH] CrmCxnLinkDialogCtrl - Add ctrl to show an external link in a dialog --- ang/crmCxn/LinkDialogCtrl.html | 3 +++ ang/crmCxn/LinkDialogCtrl.js | 11 +++++++++++ ang/crmUi.js | 32 +++++++++++++++++++------------- 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 ang/crmCxn/LinkDialogCtrl.html create mode 100644 ang/crmCxn/LinkDialogCtrl.js diff --git a/ang/crmCxn/LinkDialogCtrl.html b/ang/crmCxn/LinkDialogCtrl.html new file mode 100644 index 0000000000..ad65640950 --- /dev/null +++ b/ang/crmCxn/LinkDialogCtrl.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/ang/crmCxn/LinkDialogCtrl.js b/ang/crmCxn/LinkDialogCtrl.js new file mode 100644 index 0000000000..d1672d83e1 --- /dev/null +++ b/ang/crmCxn/LinkDialogCtrl.js @@ -0,0 +1,11 @@ +(function(angular, $, _) { + + // Controller for the "Open Link" dialog + // Scope members: + // - [input] "model": Object + // - "url": string + angular.module('crmCxn').controller('CrmCxnLinkDialogCtrl', function CrmCxnLinkDialogCtrl($scope, dialogService) { + var ts = $scope.ts = CRM.ts(null); + }); + +})(angular, CRM.$, CRM._); diff --git a/ang/crmUi.js b/ang/crmUi.js index 24c7dceb42..e0d26b1a2f 100644 --- a/ang/crmUi.js +++ b/ang/crmUi.js @@ -314,10 +314,12 @@ // Display an HTML blurb inside an IFRAME. // example: + // example: .directive('crmUiIframe', function ($parse) { return { scope: { - crmUiIframe: '@' // expression which evalutes to HTML content + crmUiIframeSrc: '@', // expression which evaluates to a URL + crmUiIframe: '@' // expression which evaluates to HTML content }, link: function (scope, elm, attrs) { var iframe = $(elm)[0]; @@ -325,20 +327,24 @@ iframe.setAttribute('frameborder', '0'); var refresh = function () { - // var iframeHtml = ''; - var iframeHtml = scope.$parent.$eval(attrs.crmUiIframe); - - var doc = iframe.document; - if (iframe.contentDocument) { - doc = iframe.contentDocument; - } - else if (iframe.contentWindow) { - doc = iframe.contentWindow.document; + if (attrs.crmUiIframeSrc) { + iframe.setAttribute('src', scope.$parent.$eval(attrs.crmUiIframeSrc)); } + else { + var iframeHtml = scope.$parent.$eval(attrs.crmUiIframe); - doc.open(); - doc.writeln(iframeHtml); - doc.close(); + var doc = iframe.document; + if (iframe.contentDocument) { + doc = iframe.contentDocument; + } + else if (iframe.contentWindow) { + doc = iframe.contentWindow.document; + } + + doc.open(); + doc.writeln(iframeHtml); + doc.close(); + } }; // If the iframe is in a dialog, respond to resize events -- 2.25.1