Fix codestyle in router.js

This commit is contained in:
Steffen van Bergerem 2016-08-11 00:03:51 +02:00
parent fca4a79f80
commit 9c46e69b7a
No known key found for this signature in database
GPG key ID: 2F08F75F9525C7E0

View file

@ -14,10 +14,8 @@ app.Router = Backbone.Router.extend({
"profile/edit": "settings",
"admins/dashboard": "adminDashboard",
"admin/pods": "adminPods",
"posts/:id": "singlePost",
"p/:id": "singlePost",
"activity": "stream",
"stream": "stream",
"aspects": "aspects",
@ -31,7 +29,6 @@ app.Router = Backbone.Router.extend({
"people/:id/contacts": "profile",
"people": "pageWithAspectMembershipDropdowns",
"notifications": "notifications",
"people/:id": "profile",
"u/:name": "profile"
},
@ -67,7 +64,7 @@ app.Router = Backbone.Router.extend({
var stream = new app.views.ContactStream({
collection: app.contacts,
el: $(".stream.contacts #contact_stream"),
el: $(".stream.contacts #contact_stream")
});
app.page = new app.pages.Contacts({stream: stream});
@ -98,7 +95,7 @@ app.Router = Backbone.Router.extend({
},
singlePost: function(id) {
this.renderPage(function(){ return new app.pages.SinglePostViewer({ id: id })});
this.renderPage(function() { return new app.pages.SinglePostViewer({id: id}); });
},
spotlight: function() {
@ -108,8 +105,10 @@ app.Router = Backbone.Router.extend({
},
renderPage: function(pageConstructor) {
app.page && app.page.unbind && app.page.unbind(); //old page might mutate global events $(document).keypress, so unbind before creating
app.page = pageConstructor(); //create new page after the world is clean (like that will ever happen)
// old page might mutate global events $(document).keypress, so unbind before creating
app.page && app.page.unbind && app.page.unbind();
// create new page after the world is clean (like that will ever happen)
app.page = pageConstructor();
app.page.render();
if (!$.contains(document, app.page.el)) {
@ -128,7 +127,9 @@ app.Router = Backbone.Router.extend({
this._loadContacts();
this.renderPage(function() {
return new app.pages.Profile({
/* eslint-disable camelcase */
person_id: guid,
/* eslint-enable camelcase */
el: $("body > #profile_container"),
streamCollection: app.collections.Photos,
streamView: app.views.Photos
@ -136,7 +137,9 @@ app.Router = Backbone.Router.extend({
});
},
/* eslint-disable camelcase */
followed_tags: function(name) {
/* eslint-enable camelcase */
this.stream();
app.tagFollowings = new app.collections.TagFollowings();
@ -161,12 +164,18 @@ app.Router = Backbone.Router.extend({
new app.collections.AspectSelections(app.currentUser.get("aspects"));
this.aspectsList = this.aspectsList || new app.views.AspectsList({collection: app.aspectSelections});
this.aspectsList.render();
/* eslint-disable camelcase */
this.aspects_stream();
/* eslint-enable camelcase */
},
/* eslint-disable camelcase */
aspects_stream: function() {
/* eslint-enable camelcase */
var ids = app.aspectSelections.selectedGetAttribute("id");
/* eslint-disable camelcase */
app.stream = new app.models.StreamAspects([], {aspects_ids: ids});
/* eslint-enable camelcase */
app.stream.fetch();
this._initializeStreamView();
app.publisher.setSelectedAspects(ids);