Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
- <lightning:overlayLibrary aura:id="overlayLib"/>
- <lightning:button variant="brand" label="Start Bug Reproduction" onclick="{! c.handleBugPanel }" />
- {!v.body}
- </aura:component>
- ({
- handleBugPanel : function(component, event, helper) {
- var modalBody;
- $A.createComponent("c:buggyButtonDynamic", {},
- function(content, status) {
- if (status === "SUCCESS") {
- modalBody = content;
- component.find('overlayLib').showCustomModal({
- header: "Select Buttons to log bugs, Make sure you have your Browser Developer Console to Observe the behavior",
- body: modalBody,
- showCloseButton: true,
- cssClass: "mymodal",
- closeCallback: function() {
- console.log('You closed the modal');
- }
- })
- }
- });
- },
- })
- <aura:component >
- <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- <lightning:overlayLibrary aura:id="overlayLib"/>
- {!v.body}
- </aura:component>
- ({
- doInit : function(cmp, event, helper) {
- var someTypes = ['Click Here to Reproduce 1', 'Click Here to Reproduce 2', 'Click Here to Reproduce 3'];
- someTypes.forEach(function(element) {
- $A.createComponent(
- "lightning:input",
- {
- "class" : "slds-text-align_center slds-p-around_small",
- "type": "radio",
- "label": element,
- "name": "Just a name",
- "onclick": cmp.getReference("c.bugGenerator")
- },
- function(newButton, status, errorMessage){
- //Add the new button to the body array
- if (status === "SUCCESS") {
- var body = cmp.get("v.body");
- body.push(newButton);
- cmp.set("v.body", body);
- }
- else if (status === "INCOMPLETE") {
- console.log("No response from server or client is offline.")
- // Show offline error
- }
- else if (status === "ERROR") {
- console.log("Error: " + errorMessage);
- // Show error message
- }
- }
- );
- });
- },
- bugGenerator : function(cmp, event, helper) {
- console.log('This should only log once');
- },
- })
Add Comment
Please, Sign In to add comment