diff --git a/config/application.rb b/config/application.rb index 72a1d72f8..589e15ca2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,7 +26,8 @@ module Diaspora # Add additional load paths for your own custom dirs #config.autoload_paths += %W(#{config.root}/lib) - config.autoload_paths += %W(#{config.root}/lib) + config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/presenters) + #OMG HAX PLZ FIX MAKE ALL LIB AUTOLOAD KTHNX config.autoload_paths += %W(#{config.root}/lib/*) config.autoload_paths += %W(#{config.root}/lib/*/*) config.autoload_paths += %W(#{config.root}/lib/*/*/*) diff --git a/public/javascripts/app/pages/post-viewer.js b/public/javascripts/app/pages/post-viewer.js index acc3b0403..8f5e8eab9 100644 --- a/public/javascripts/app/pages/post-viewer.js +++ b/public/javascripts/app/pages/post-viewer.js @@ -9,8 +9,10 @@ app.pages.PostViewer = app.views.Base.extend({ "#header-container" : "authorView" }, - initialize : function() { - this.initViews(); + initialize : function(options) { + this.model = new app.models.Post({ id : options.id }); + this.model.fetch().success(_.bind(this.initViews, this)); + this.prepIdleHooks(); $(document).bind("keypress", _.bind(this.commentAnywhere, this)) @@ -28,6 +30,8 @@ app.pages.PostViewer = app.views.Base.extend({ templateName : "post-viewer/content/" + this.model.get("templateName"), attributes : {"data-template" : this.model.get("templateName")} }); + + this.render(); }, prepIdleHooks : function () { diff --git a/public/javascripts/app/router.js b/public/javascripts/app/router.js index 235325f7d..157c0fc81 100644 --- a/public/javascripts/app/router.js +++ b/public/javascripts/app/router.js @@ -39,14 +39,9 @@ app.Router = Backbone.Router.extend({ }, singlePost : function(id) { - new app.models.Post({id : id}).fetch({success : function(resp){ - var page = new app.pages.PostViewer({ - model : new app.models.Post(resp) - }).render(); - - $("#container").html(page.el); - }}) - } + var page = new app.pages.PostViewer({ id: id }).render(); + $("#container").html(page.el); + } });