Move help page initialization into backbone router

This commit is contained in:
Jonne Haß 2014-02-09 13:02:28 +01:00
parent e402a4093d
commit f64f55b567
3 changed files with 10 additions and 7 deletions

View file

@ -1,5 +1,7 @@
app.Router = Backbone.Router.extend({ app.Router = Backbone.Router.extend({
routes: { routes: {
"help": "help",
//new hotness //new hotness
"posts/:id": "singlePost", "posts/:id": "singlePost",
"p/:id": "singlePost", "p/:id": "singlePost",
@ -22,6 +24,12 @@ app.Router = Backbone.Router.extend({
"u/:name": "stream" "u/:name": "stream"
}, },
help: function() {
app.help = new app.views.Help();
$("#help").prepend(app.help.el);
app.help.render();
},
singlePost : function(id) { singlePost : function(id) {
this.renderPage(function(){ return new app.pages.SinglePostViewer({ id: id })}); this.renderPage(function(){ return new app.pages.SinglePostViewer({ id: id })});
}, },

View file

@ -1,5 +0,0 @@
$(document).ready(function() {
app.help = new app.views.Help();
$("#help").prepend(app.help.el);
app.help.render();
});

View file

@ -2,8 +2,8 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
- content_for :head do
= load_javascript_locales("help") = load_javascript_locales("help")
= javascript_include_tag 'help'
- content_for :page_title do - content_for :page_title do
= t('_help') = t('_help')