Change code does not work in VS Studio code editor

When I take some code in the hbs folder on localhost and put it in another hbs folder, it doesn’t work. Some text is inserted there and it is on that page, but it has absolutely no functionality, after refreshing the page everything is reset because it is just like a string…

Can you help me?

If, for example, I wanted to insert everything from interface.hbs into account.hbs so that it would have functionality, what should I do?

I think answering this question would help a lot of people.

Thank you for your response

Things are a quite a bit more complicated than that. This is not related to your editor, VS Code is an excellent choice.

Discourse is a MVC single page app that uses EmberJS on the front end and uses Routes, Models, Controllers and Templates.

Changing only the Templates is usually not sufficient.

It would be really good for you to do some reading into EmberJS.

But for example, part of the reason there is no functionality, is because the Controllers are different.

Here are all the Controllers for this part of the javascript end of the app:

The slight complication here is sometimes Components respond to actions, as well as Controllers.

On top of that you might have to worry about what model is presented to each of these different Routes.

The preferences Routes are here with prefix preferences:

It gets more complex than that too, as the data that Ember sees is almost always originally delivered by the back end and so affected by the Rails Routes, Controllers (and often Models) and Serializers at the back end. See https://guides.rubyonrails.org/

4 Likes

Are you trying to make changes to core (you almost certainly do not want to do that), or are you developing a plugin? If you haven’t already, have a look at Beginner’s Guide to Creating Discourse Plugins Part 1: Creating a basic plugin.

3 Likes

Yes, because I need to get some functions somewhere else

You can “get some functions somewhere else” in a plugin. If you fork Discourse, you’ll be sorry if you want to use it for more than a month. I developed a dashboard that allows you to install and manage discourse as a plugin.

5 Likes

I uploaded a plugin to discourse, and replaced in plugins/notebook-main/assets/javascripts/discourse/controllers/notebook.js.es6 , I replaced this file with the necessary interface file + I did the same with the hbs template.

Everything works in theory, except that we don’t want to save the changes.

Uncaught Error: Property set failed: object in path "model.user_option" could not be found.
    Ember 3
    save notebook:194
    _join backburner.js:995
    join backburner.js:760
    Ember 4
    _triggerAction d-button.js:137
    click d-button.js:106
    Ember 2
    _run backburner.js:1013
    _join backburner.js:989
    join backburner.js:760
    Ember 6
    jQuery 8
    initialize click-interceptor.js:15
    initialize app.js:47
    runInstanceInitializers Ember
    each dag-map.js:231
    walk dag-map.js:145
    each dag-map.js:75
    topsort dag-map.js:83
    Ember 4
    invoke backburner.js:338
    flush backburner.js:229
    flush backburner.js:426
    _end backburner.js:960
    end backburner.js:710
    _run backburner.js:1015
    _join backburner.js:989
    join backburner.js:760
    Ember 2
    jQuery 12