Meu script não está funcionando

I changed the template upload-selector.hbs
Before
image
After


The template works well, but my script refuses to work
image
I inserted this code in the “Header” tab
Please tell me what could be the problem?

1 curtida

You must write this stuff within Ember hooks because eg $document.ready is meaningless in an Ember app.

You may need to look at modifying the js of the modal’s controller depending on your needs.

2 curtidas

Thanks for your reply. Why then in the manual Developer’s guide to Discourse Themes say what can be used?

1 curtida

It still works I guess for some use cases (the event will still fire) but if you want to do something intricate in a specific part of the interface I would not use such an event because it does not guarantee availability of some elements of the dom, unlike the ember hooks for components, for example.

2 curtidas

Please tell me, is there any documentation so that I can implement something similar?

1 curtida

Usually with these things you will have to interpret the source code and use the Ember Guides to help you.

Additionally studying prior art in existing plugins or Theme Components can be really helpful.

3 curtidas

Thanks. I will try to solve it

2 curtidas