diff options
Diffstat (limited to 'plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js')
-rw-r--r-- | plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js b/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js index 6694b15fae..eb9961548b 100644 --- a/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js +++ b/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js @@ -52,37 +52,38 @@ }; this.callbackAddExportButtonsUnderWidget = function (widgetUniqueId, loadedWidgetElement) { - var widget = widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId); - var widgetParameters = widget['parameters']; + widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId, function(widget) { + var widgetParameters = widget['parameters']; - var exportButtonsElement = $('<span id="exportButtons">'); + var exportButtonsElement = $('<span id="exportButtons">'); - var urlIframe = getEmbedUrl(widgetParameters, "iframe"); - // We first build the HTML code that will load the widget in an IFRAME - var widgetIframeHtml = '<div id="widgetIframe">' + - '<iframe width="100%" height="350" src="' + urlIframe + '" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">' + - '</iframe>' + - '</div>'; + var urlIframe = getEmbedUrl(widgetParameters, "iframe"); + // We first build the HTML code that will load the widget in an IFRAME + var widgetIframeHtml = '<div id="widgetIframe">' + + '<iframe width="100%" height="350" src="' + urlIframe + '" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">' + + '</iframe>' + + '</div>'; - // Add the input field containing the widget in an Iframe - $(exportButtonsElement).append( - '<div id="embedThisWidgetIframe">' + - '<label for="embedThisWidgetIframeInput">› Embed Iframe</label>' + - '<div id="embedThisWidgetIframeInput">' + - self.getInputFormWithHtml('iframeEmbed', widgetIframeHtml) + - '</div>' + - '</div>' + - '<div> <label for="embedThisWidgetDirectLink">› Direct Link</label>' + - '<div id="embedThisWidgetDirectLink"> ' + self.getInputFormWithHtml('directLinkEmbed', urlIframe) + ' - <a href="' + urlIframe + '" rel="noreferrer" target="_blank">' + _pk_translate('Widgetize_OpenInNewWindow') + '</a></div>' - + '</div>' - ); + // Add the input field containing the widget in an Iframe + $(exportButtonsElement).append( + '<div id="embedThisWidgetIframe">' + + '<label for="embedThisWidgetIframeInput">› Embed Iframe</label>' + + '<div id="embedThisWidgetIframeInput">' + + self.getInputFormWithHtml('iframeEmbed', widgetIframeHtml) + + '</div>' + + '</div>' + + '<div> <label for="embedThisWidgetDirectLink">› Direct Link</label>' + + '<div id="embedThisWidgetDirectLink"> ' + self.getInputFormWithHtml('directLinkEmbed', urlIframe) + ' - <a href="' + urlIframe + '" rel="noreferrer" target="_blank">' + _pk_translate('Widgetize_OpenInNewWindow') + '</a></div>' + + '</div>' + ); - // Finally we append the content to the parent widget DIV - $(loadedWidgetElement) - .parent() - .append(exportButtonsElement); + // Finally we append the content to the parent widget DIV + $(loadedWidgetElement) + .parent() + .append(exportButtonsElement); - piwik.helper.compileAngularComponents(exportButtonsElement); + piwik.helper.compileAngularComponents(exportButtonsElement); + }); } }, compile: function (element, attrs) { |