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

Dashboard trigger on class names works only on the first instance #326

Closed
ameft opened this issue Sep 8, 2017 · 7 comments · Fixed by #328
Closed

Dashboard trigger on class names works only on the first instance #326

ameft opened this issue Sep 8, 2017 · 7 comments · Fixed by #328
Assignees
Labels

Comments

@ameft
Copy link

ameft commented Sep 8, 2017

I would like to be able to open the Uppy Dashboard clicking on more than one button, so I tried to use a class instead of an id for the trigger, but it didn't work: only the first button with the choosen class will open the Dashboard.

.use(Uppy.Dashboard, {
    trigger: '.upload-btn'
})

As a bonus question I'm wondering: can I then get inside uppy which was the button making the call?

@arturi arturi self-assigned this Sep 8, 2017
arturi added a commit that referenced this issue Sep 8, 2017
@goto-bus-stop potential danger point. introduced to support multiple
dashboard open triggers #326

Maybe we should always return an array and just use the first element
where multiple elements don’t make sense
@arturi
Copy link
Contributor

arturi commented Sep 8, 2017

Thanks for the suggestion! Also considering this in #328.

@arturi arturi added the Feature label Sep 8, 2017
@ameft
Copy link
Author

ameft commented Sep 11, 2017

Thanks to you @arturi!
Can you also help me with my other question: can I get inside uppy which was the button that triggered its opening?

@kvz
Copy link
Member

kvz commented Sep 12, 2017

Seems this one was prematurely closed, but also seems the question is a bit outside of the scope of this issue (tracker) maybe? Perhaps a better place for it would be https://community.transloadit.com/c/uppy?

@ameft
Copy link
Author

ameft commented Sep 12, 2017

@kvz you're right. Opened a question on the community forum: https://community.transloadit.com/t/is-it-possible-to-catch-the-trigger-that-opened-the-dashboard/14547

@arturi
Copy link
Contributor

arturi commented Sep 12, 2017

Replied there!

@ameft
Copy link
Author

ameft commented Sep 14, 2017

@arturi do you think that with this update Uppy we'll be able to be triggered also by elements with the right class but added after the initialization of the Dashboard? Or I will need to do something like this with the new element?

var showUppyModal = function() {
  uppy.getPlugin('Dashboard').openModal();
}
element.addEventListener('click', showUppyModal)

@arturi
Copy link
Contributor

arturi commented Sep 14, 2017

Yeah, I believe the element has to be on the page on initialization for Uppy to add a listener to it, so your method is the way to go 👍

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

Successfully merging a pull request may close this issue.

3 participants