put the frontend into its own folder; only use one routes file
This commit is contained in:
parent
1ecfa92c9e
commit
f62b26fc73
17 changed files with 23 additions and 49 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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});
|
||||
}
|
||||
17
public/javascripts/app/router.js
Normal file
17
public/javascripts/app/router.js
Normal 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();
|
||||
}
|
||||
});
|
||||
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
App.Routers.Comments = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"comment_stream": "stream"
|
||||
}
|
||||
});
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
App.Routers.Mentions = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"mentions": "stream"
|
||||
}
|
||||
});
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
App.Routers.People = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"people/:id": "stream"
|
||||
}
|
||||
});
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
App.Routers.TagFollowings = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"tag_followings": "stream"
|
||||
}
|
||||
});
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
App.Routers.Tags = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"tags/:id": "stream"
|
||||
}
|
||||
});
|
||||
Loading…
Reference in a new issue