Commit d60394338f9737374c08c964a1d3c9a7e02ed517
- Diff rendering mode:
- inline
- side by side
js/mouchak.js
(11 / 2)
  | |||
300 | 300 | _.each(children, function(child) { | |
301 | 301 | child = M.sanitize(child); | |
302 | 302 | var model = M.pages.get(child); | |
303 | if(!_.isObject(model)) { | ||
304 | console.log('Error: Cannot find page '+ child +' which is defined as children of ' + page); | ||
305 | return false; | ||
306 | } | ||
303 | 307 | var children = model.get('children'); | |
304 | 308 | if(_.isEmpty(children)) { | |
305 | 309 | li = '<li><a href="#/' + child + '">' + M.humanReadable(child) + '</a></li>'; | |
… | … | ||
354 | 354 | var new_page = new Page(page); | |
355 | 355 | var contents = []; | |
356 | 356 | _.each(page.content, function(content) { | |
357 | if(_.isEmpty(content)) { | ||
358 | console.log('Empty content for ' + page.name); | ||
359 | return; | ||
360 | } | ||
357 | 361 | var Item = type_map.model[content.type]; | |
358 | 362 | if(!Item) { | |
359 | console.log('Error initing item: ', content); | ||
363 | console.log('Error: Invalid type '+ content.type +' for ', content); | ||
360 | 364 | return; | |
361 | 365 | } | |
362 | 366 | var item = new Item(content); | |
… | … | ||
379 | 379 | Backbone.history.start(); | |
380 | 380 | // start with index page | |
381 | 381 | var location = window.location; | |
382 | location.href = location.origin + location.pathname + '#/index'; | ||
382 | location.href = location.protocol + '//' + location.hostname + | ||
383 | location.pathname + '#/index'; | ||
383 | 384 | M.simHeir(); | |
384 | 385 | }; | |
385 | 386 |