Hi guys,
I am trying to figure out a solution for the following scenario:
User opens dynamicContentMacro → a popup should appear that allows the user to configure the macro.
After searching for a little while, I found the Dialog2 component (Dialog2 - AUI Documentation).
Now, I am struggling to show such a dialog as a popup immediately after the macro is launched. I send the following .hbs file via res.render
to the client:
{{!< layout}}
<script type="text/javascript">
alert("test");
AJS.dialog2("#demo-dialog").show();
</script>
<section id="demo-dialog" class="aui-dialog2 aui-dialog2-small aui-layer" role="dialog" aria-hidden="true">
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">Captain...</h2>
<a class="aui-dialog2-header-close">
<span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>
</a>
</header>
<div class="aui-dialog2-content">
<p>We've detected debris of some sort in a loose orbit.</p>
<p>I suggest we beam a section aboard for analysis...</p>
</div>
<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button id="dialog-submit-button" class="aui-button aui-button-primary">Make it so</button>
</div>
</footer>
</section>
The alert is executed, but the dialog is not showing. In the console of the client, I get the following error:
aui.js:5847 Uncaught TypeError: Cannot read property 'hasAttribute' of undefined
at String.<anonymous> (aui.js:5847)
at Function.each (jquery.min.js:2)
at applyDefaults (aui.js:5845)
at new Dialog2 (aui.js:5860)
at Function.dialog2 (aui.js:4596)
at nextcloud-select-path:24
(anonymous) @ aui.js:5847
each @ jquery.min.js:2
applyDefaults @ aui.js:5845
Dialog2 @ aui.js:5860
(anonymous) @ aui.js:4596
I would be very grateful if someone could help me with that one. I am not really sure if I have just missed a small thing or my whole approach is just inappropriate.
Best regards