small refactoring around router.js
This commit is contained in:
parent
2c0cfa53dc
commit
5154500239
3 changed files with 11 additions and 11 deletions
|
|
@ -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/*/*/*)
|
||||
|
|
|
|||
|
|
@ -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 () {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
var page = new app.pages.PostViewer({ id: id }).render();
|
||||
$("#container").html(page.el);
|
||||
}})
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue