var modal = sdk.Widgets.showModalView({
'el':'<div>This action will archive all '+nEmailsFrom+' conversations from '+email+'. Are you sure you want to continue?</div>',
'title': 'Confirm archiving messages',
'buttons':[
{
'text':'OK',
'onClick': bulkArchive(email,nEmailsFrom),
'type':'PRIMARY_ACTION'
},
{
'text':'Cancel',
'onClick': modalClose
}
]
})--
You received this message because you are subscribed to the Google Groups "InboxSDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inboxsdk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/inboxsdk/5eaf7f48-43ad-405e-b1dc-cb492b074fad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
sdk.ButterBar.showMessage({ 'text':'', 'time':30000, 'html':"The conversation has been archived. <span style='text-decoration:underline' class='bulkArchive' email='"+sender[0].emailAddress+"' nEmailsFrom='"+msg.nEmailsFrom+"'>Archive all "+msg.nEmailsFrom+" emails from "+ sender[0].emailAddress + "</span>" })function bulkArchive(email,nEmailsFrom){ var port = chrome.runtime.connect({name: "bulkArchive"}); port.postMessage({'email': email, 'nEmailsFrom': nEmailsFrom }); // close modal ? }
function modalClose(m){ // m.close() close modal ? (this doesn't work) } document.querySelector('body').addEventListener('click', function(event) { if (event.target.className == 'bulkArchive') { var email = event.target.getAttribute('email') var nEmailsFrom = event.target.getAttribute('nEmailsFrom') var modal = sdk.Widgets.showModalView({ 'el':'<div>This action will archive all '+nEmailsFrom+' conversations from '+email+'. Are you sure you want to continue?</div>', 'title': 'Confirm archiving messages', 'buttons':[ { 'text':'OK', 'onClick': bulkArchive(email,nEmailsFrom, modal), 'type':'PRIMARY_ACTION' }, { 'text':'Cancel', 'onClick': modalClose } ] }) } });hi Sacha, does "bulkArchive" return a function, or is that the function to actually do the bulk archive?ᐧ
On Sat, Nov 12, 2016 at 4:13 PM, Sacha <sacha....@gmail.com> wrote:
There's a method to close a ModalView: close().However, I'm struggling to call it from the onClick handler of a button of a ModalView:var modal = sdk.Widgets.showModalView({
'el':'<div>This action will archive all '+nEmailsFrom+' conversations from '+email+'. Are you sure you want to continue?</div>',
'title': 'Confirm archiving messages',
'buttons':[
{
'text':'OK',
'onClick': bulkArchive(email,nEmailsFrom),
'type':'PRIMARY_ACTION'
},
{
'text':'Cancel',
'onClick': modalClose
}
]
})After the OK button has been clicked, how can I call the close() method to close the modal from the handler? I don't seem to be able to include any parameter in my function handler about the current modal.Same question for the Cancel button...Thanks!
--
You received this message because you are subscribed to the Google Groups "InboxSDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inboxsdk+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to inboxsdk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/inboxsdk/c977f796-d600-4d8c-8534-f01fba524a49%40googlegroups.com.