Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameters from template to dialog box #30

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

falkodev
Copy link
Contributor

@falkodev falkodev commented Apr 9, 2021

@boutell boutell self-requested a review April 22, 2021 13:15
<a
href="#"
data-apos-dialog-box-trigger="DIALOG_BOX_ID"
data-apos-dialog-box-parameters="{{ parameters | dump }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use jsonAttribute. dump is not designed to be guaranteed safe in an attribute, I don't think.

@@ -243,20 +254,29 @@
event.preventDefault();

var dialogId = button.dataset.aposDialogBoxTrigger;
var parameters = JSON.parse(button.dataset.aposDialogBoxParameters || null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, JSON.parse(null) does not crash for me either, but it seems risky; how about || 'null'?

</div>
```

This way, a widget inside the dialog box can read the added parameters and use them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide an example of how the widget would access the parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants