Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Help structuring JMVC folders

$
0
0
Hi,
I am batteling here to find the best way of creating a widget for my application. I have read some posts and also looked at tutorial, but i feel like it is not the best approach for what i want to do.

Widget will have 3 parts:
           - A free search box
           - 2 Selectable list items (second one depends on first one)
           - A list with results that will change based on free search and/or selectable items

This looks a bit like contacts application and also srchr application (both in tutorials).

Contacts application uses a single can.control and srchr application uses a "search" folder to separate the search part.

For this Widget this 3 parts maybe can be reused.
I was thinking of structuring like below
/app
      /models
      /views
      app.js (widgets gets included)

/widgets
      /widgetX
            /models
            /views
            widgetX.js (elements in /ui gets included)

/ui  (reusable)
    /searchbox
    /selectable_items
    /list_items
 
This makes me wonder for example about models that should be available for the entire application. But if i put all my models in "/app/models" this will make "/widgets" and "/ui" to be dependent of "app/models". Moving models to "root" i don´t know if this is the best approach...

Can you suggest about the best way for this case?

Thanks a lot in advance.

Cheers,
Linton


Viewing all articles
Browse latest Browse all 3491

Trending Articles