E
E
EazyE2014-09-29 16:35:02
Software design
EazyE, 2014-09-29 16:35:02

The architecture (structure) of an application based on BackboneJS + RequireJS, the content of which changes depending on the user's role?

I am new to BackboneJS.
For learning, I'm trying to start translating my old project to Backbone. But I face difficulties from the very beginning.
There is, for example, the requests/create page, which contains a form for filling out a request. Depending on the user's role, this page may look different. What should be the structure of the application?
I have this option: make subdirectories (admin, user, etc.) in the routers, templates, views directories. That is, models and collections will be "general", and routers, views, templates for each role will be their own. As a result, after login, initialize the necessary routers, after which it will already be init. desired views and display the desired templates. It's probably a good option.
Has anyone had this and how did you resolve it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2014-09-29
@k12th

Faced a couple of times with a similar task, there were only 2 roles. It turned out two applications lying side by side, in which 99% of the common code. But if there are more than two roles, then, probably, it will already turn out to be cumbersome.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question