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

Dynamically generated templates/views/components #98

Open
michaljerabek opened this issue Oct 7, 2015 · 2 comments
Open

Dynamically generated templates/views/components #98

michaljerabek opened this issue Oct 7, 2015 · 2 comments

Comments

@michaljerabek
Copy link

Hi,

I would like to make an app, that will contain a page builder (HTML builder). The user selects some module (products, gallery, slider, ...) and inserts it into the page and somehow modifies it. The problem is, that I haven't found any way to create a working template or a View at runtime. (And I don't know what modules the user will be using, so I can not predefine them.) The next thing is, that these modules should be sortable, so I will need to be able to remove a module from the page and insert it somewhere else (and obsarvables must still work). (I have not tried this yet.) Is there any way to do this with jsblocks, or could be in the near future?

Thanks.

@astoilkov
Copy link
Owner

Hi @michaljerabek,

Can you clarify a little more why you can't achieve your scenario using a static template? Can you provide two examples of two dynamic templates you want to generate?

@michaljerabek
Copy link
Author

Ok, I figured it out. I did not realize that I have to use blocks.query with a new manually inserted HTML. (Manually inserted because I did not find a way how to use template query after something happens [event is triggered].) But I'm not yet entirely sure if it's the ideal solution (especially when using MVC). Or is there a better way how to create a template (after clicking for example) that will be able to use already existing View/data?

The app is still only in my head, and to be honest, I don't know how exactly I want to do this. But I just need to be able to insert a new HTML and assign to it a new object with settings (that user can change). (And the new HTML [in admin section of the app] will contain some controls for setting preferences that will be using jsblocks' observables a queries.)

Thanks for your time.

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

No branches or pull requests

2 participants