Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h3>Routers</h3> <p>Sure they can be used for heavy lifting - I am sure you've heard it before, but Backbone just provides the bare-bones to built on-top of as you choose.</p> <p>I would set the <code>SummaryResultsView</code> to a variable on the <code>Workspace</code> router. Otherwise whenever you call <code>Workspace.summary()</code> you will have ghost views hanging around.</p> <p>I am not sure what you are doing with <code>track.Router.navigate</code> as it looks like it shares the same route <code>#search</code> as that defined in your <code>Workspace</code> router, which would cause both routes to be called.</p> <p>You could always create multiple routers to help you divide your code up between different sections of your application. Starting with a main router and having child routers is usually what I try and aim for.</p> <h3>Main Page Views</h3> <p>Again, some people like doing it this way and others like to kick things off from a router. If you find you have a massive main view, try splitting it into smaller views so that you Don't Repeat Yourself.</p> <p>Caching views can be useful - so on a main view that is only created once (on your application start) you could do:</p> <pre><code>var MyView = Backbone.View.extend({ childView: null, toggleChildView: function() { if (this.childView) { this.childView.toggle(); //Toggle show/hide } else { this.childView = new ChildView({model: someModel}); } } }); </code></pre> <h3>Underscore Templates</h3> <p>I actually found that using require.js helped me learn. It certainly helps when the application starts to grow in size - there is a require.js implementation of the TodoMVC app - if you didn't already know.</p> <p>You won't be able to use external templates without the require.js (text plugin) as it uses an AJAX call to grab the template files. Unless of course you design your own AJAX call to pull in the template files but it seems like a rather long-winded way to go about it.</p> <p>Template files are static - I don't fully understand how you mean pulling from a separate CMS?</p> <p>Just for a side note - if you use the <a href="http://requirejs.org/docs/optimization.html" rel="noreferrer">require.js optimization</a> it actually in-lines your templates so they are included in one fat JS file.</p> <h3>Porting code</h3> <p>If you figure out a very generic Backbone model that works with the jQuery plugins (I have one for a jQuery UI date picker) you can pretty easily port it between applications without too much fuss. This is sped up if using require.js as its already in a separate file (copy and paste FTW).</p> <p>Hope this helps! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload