Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Load 'blog' card (layer 0).
- */
- loadBlogPage: function(path) {
- //resets the nav to home so no subsections are highlighted
- this.updateNavigation();
- if(this.DEBUG) {console.log('Router: Load blog: ', path);}
- PubSub.trigger('loadBlog:router', path);
- // Destroy old blog cards.
- /*
- if(this.blog) {
- this.blog.destroy(true);
- this.blog = null;
- }
- */
- // If cards are in the DOM, fade them out and remove.
- if(this.cards || this.blog) {
- // Display loader.
- this.alert.showLoader(this.LOADING_MESSAGE);
- // Fetch blog page.
- this.fetchData(path,
- // Successful ajax call.
- $.proxy(function(transport) {
- // Hide the loader.
- this.alert.hideLoader();
- // Create new blog view with html fragment.
- /*
- this.blog = new BlogView({
- htmlFrag: transport
- });
- */
- if (this.cards) {
- this.cards.hide(true, $.proxy(function() {
- // Create new blog view with html fragment.
- this.blog = new BlogView({
- htmlFrag: transport
- });
- this.blog.show(true, $.proxy(function() {
- // Destroy the cards and the instance.
- this.cards.destroy(true);
- this.cards = null;
- }, this));
- }, this));
- } else if (this.blog) {
- console.log('BLOG TO BLOG')
- this.blog.hide(true, $.proxy(function() {
- this.blog.destroy(true);
- this.blog = null;
- this.blog = new BlogView({
- htmlFrag: transport
- });
- this.blog.show(true);
- }, this));
- }
- }, this)
- );
- } else {
- this.blog = new BlogView();
- }
- PubSub.trigger('close:overlay', null, true);
- }
Add Comment
Please, Sign In to add comment