Guest User

Untitled

a guest
Nov 19th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. /**
  2. * Load 'blog' card (layer 0).
  3. */
  4. loadBlogPage: function(path) {
  5. //resets the nav to home so no subsections are highlighted
  6. this.updateNavigation();
  7.  
  8. if(this.DEBUG) {console.log('Router: Load blog: ', path);}
  9. PubSub.trigger('loadBlog:router', path);
  10.  
  11. // Destroy old blog cards.
  12. /*
  13. if(this.blog) {
  14. this.blog.destroy(true);
  15. this.blog = null;
  16. }
  17. */
  18.  
  19. // If cards are in the DOM, fade them out and remove.
  20. if(this.cards || this.blog) {
  21.  
  22. // Display loader.
  23. this.alert.showLoader(this.LOADING_MESSAGE);
  24.  
  25. // Fetch blog page.
  26. this.fetchData(path,
  27.  
  28. // Successful ajax call.
  29. $.proxy(function(transport) {
  30. // Hide the loader.
  31. this.alert.hideLoader();
  32.  
  33. // Create new blog view with html fragment.
  34. /*
  35. this.blog = new BlogView({
  36. htmlFrag: transport
  37. });
  38. */
  39.  
  40. if (this.cards) {
  41. this.cards.hide(true, $.proxy(function() {
  42. // Create new blog view with html fragment.
  43. this.blog = new BlogView({
  44. htmlFrag: transport
  45. });
  46. this.blog.show(true, $.proxy(function() {
  47. // Destroy the cards and the instance.
  48. this.cards.destroy(true);
  49. this.cards = null;
  50. }, this));
  51.  
  52. }, this));
  53. } else if (this.blog) {
  54. console.log('BLOG TO BLOG')
  55. this.blog.hide(true, $.proxy(function() {
  56. this.blog.destroy(true);
  57. this.blog = null;
  58. this.blog = new BlogView({
  59. htmlFrag: transport
  60. });
  61. this.blog.show(true);
  62. }, this));
  63. }
  64.  
  65. }, this)
  66. );
  67. } else {
  68. this.blog = new BlogView();
  69. }
  70.  
  71. PubSub.trigger('close:overlay', null, true);
  72. }
Add Comment
Please, Sign In to add comment