Guest User

Untitled

a guest
Jul 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
  2. <lightning:overlayLibrary aura:id="overlayLib"/>
  3. <lightning:button variant="brand" label="Start Bug Reproduction" onclick="{! c.handleBugPanel }" />
  4. {!v.body}
  5.  
  6. </aura:component>
  7.  
  8. ({
  9. handleBugPanel : function(component, event, helper) {
  10. var modalBody;
  11. $A.createComponent("c:buggyButtonDynamic", {},
  12. function(content, status) {
  13. if (status === "SUCCESS") {
  14. modalBody = content;
  15. component.find('overlayLib').showCustomModal({
  16. header: "Select Buttons to log bugs, Make sure you have your Browser Developer Console to Observe the behavior",
  17. body: modalBody,
  18. showCloseButton: true,
  19. cssClass: "mymodal",
  20. closeCallback: function() {
  21. console.log('You closed the modal');
  22. }
  23. })
  24.  
  25. }
  26.  
  27. });
  28. },
  29.  
  30. })
  31.  
  32. <aura:component >
  33. <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  34. <lightning:overlayLibrary aura:id="overlayLib"/>
  35.  
  36. {!v.body}
  37.  
  38. </aura:component>
  39.  
  40. ({
  41. doInit : function(cmp, event, helper) {
  42. var someTypes = ['Click Here to Reproduce 1', 'Click Here to Reproduce 2', 'Click Here to Reproduce 3'];
  43. someTypes.forEach(function(element) {
  44. $A.createComponent(
  45. "lightning:input",
  46. {
  47.  
  48. "class" : "slds-text-align_center slds-p-around_small",
  49. "type": "radio",
  50. "label": element,
  51. "name": "Just a name",
  52. "onclick": cmp.getReference("c.bugGenerator")
  53. },
  54. function(newButton, status, errorMessage){
  55. //Add the new button to the body array
  56. if (status === "SUCCESS") {
  57. var body = cmp.get("v.body");
  58. body.push(newButton);
  59. cmp.set("v.body", body);
  60. }
  61. else if (status === "INCOMPLETE") {
  62. console.log("No response from server or client is offline.")
  63. // Show offline error
  64. }
  65. else if (status === "ERROR") {
  66. console.log("Error: " + errorMessage);
  67. // Show error message
  68. }
  69. }
  70. );
  71.  
  72. });
  73. },
  74. bugGenerator : function(cmp, event, helper) {
  75. console.log('This should only log once');
  76. },
  77. })
Add Comment
Please, Sign In to add comment