put the frontend into its own folder; only use one routes file

This commit is contained in:
danielgrippi 2011-12-10 16:52:03 -08:00 committed by Dennis Collinson
parent 1ecfa92c9e
commit f62b26fc73
17 changed files with 23 additions and 49 deletions

View file

@ -15,13 +15,11 @@ javascripts:
- public/javascripts/vendor/underscore.js
- public/javascripts/vendor/backbone.js
- public/javascripts/app.js
- public/javascripts/models/*
- public/javascripts/collections/*
- public/javascripts/views/*
- public/javascripts/routers/*
- public/javascripts/routers/stream/*
- public/javascripts/app/app.js
- public/javascripts/app/router.js
- public/javascripts/app/models/*
- public/javascripts/app/collections/*
- public/javascripts/app/views/*
- public/javascripts/rails.validations.js
- public/javascripts/rails.js

View file

@ -1,8 +1,6 @@
var App = {
Collections: {},
Models: {},
routers: {},
Routers: {},
Views: {},
user: function(user) {
@ -12,9 +10,7 @@ var App = {
},
initialize: function() {
_.each(App.Routers, function(Router, name) {
App.routers[name] = new Router;
});
App.router = new App.Router;
Backbone.history.start({pushState: true});
}

View file

@ -0,0 +1,17 @@
App.Router = Backbone.Router.extend({
routes: {
"stream": "stream",
"comment_stream": "stream",
"mentions": "stream",
"people/:id": "stream",
"tag_followings": "stream",
"tags/:name": "stream"
},
stream: function() {
App.stream = new App.Views.Stream;
$("#main_stream").html(App.stream.el);
App.stream.loadMore();
}
});

View file

@ -1,12 +0,0 @@
App.Routers.Stream = Backbone.Router.extend({
routes: {
"stream": "stream"
},
stream: function() {
App.stream = new App.Views.Stream;
$("#main_stream").html(App.stream.el);
App.stream.loadMore();
}
});

View file

@ -1,5 +0,0 @@
App.Routers.Comments = App.Routers.Stream.extend({
routes: {
"comment_stream": "stream"
}
});

View file

@ -1,5 +0,0 @@
App.Routers.Mentions = App.Routers.Stream.extend({
routes: {
"mentions": "stream"
}
});

View file

@ -1,5 +0,0 @@
App.Routers.People = App.Routers.Stream.extend({
routes: {
"people/:id": "stream"
}
});

View file

@ -1,5 +0,0 @@
App.Routers.TagFollowings = App.Routers.Stream.extend({
routes: {
"tag_followings": "stream"
}
});

View file

@ -1,5 +0,0 @@
App.Routers.Tags = App.Routers.Stream.extend({
routes: {
"tags/:id": "stream"
}
});