Skip to content
Browse files

clean-up, use proper layout

  • Loading branch information...
1 parent 41ba14c commit 01ced26d196c9a00780765bed4885588f41e4161 @brianshaler brianshaler committed May 27, 2012
Showing with 6 additions and 46 deletions.
  1. +1 −1 controllers/DashboardController.js
  2. +1 −18 controllers/ItemController.js
  3. +4 −27 controllers/TopicController.js
View
2 controllers/DashboardController.js
@@ -71,7 +71,7 @@ exports.controller = function(req, res, next) {
activity_items = items;
}
- res.render("objects/stream", {activity_items: activity_items, stream: settings});
+ res.render("objects/stream", {layout: "dashboard/dashboard-layout", activity_items: activity_items, stream: settings});
});
}
// end /dashboard/top
View
19 controllers/ItemController.js
@@ -13,23 +13,6 @@ exports.controller = function(req, res, next) {
Controller.call(this, req, res, next);
var self = this;
- self.index = function() {
- var activity_items = [];
-
- ActivityItem.find()
- .sort("created_at", -1)
- .limit(20)
- .populate("user")
- .run(function (err, items) {
- if (!err && items && items.length > 0) {
- activity_items = items;
- }
-
- res.render(ViewTemplatePath + "/index", {activity_items: activity_items});
- });
- }
- // end /item/index
-
self.view = function () {
var id = req.params.id;
@@ -39,7 +22,7 @@ exports.controller = function(req, res, next) {
.populate("characteristics")
.run(function (err, item) {
if (!err && item) {
- res.render(ViewTemplatePath + "/activity_item", {item: item});
+ res.render("objects/activity_item", {layout: "dashboard/dashboard-layout", item: item});
} else {
res.redirect("/dashboard");
}
View
31 controllers/TopicController.js
@@ -11,29 +11,6 @@ var mongoose = require('mongoose'),
exports.controller = function(req, res, next) {
Controller.call(this, req, res, next);
var self = this;
-
- self.index = function() {
- var activity_items = [];
-
- var recent_topics = [];
- var popular_topics = [];
-
- var from = req.params.from ? parseInt(req.params.from) - 1 : 0;
- var to = req.params.to ? parseInt(req.params.to) : 10;
-
- Topic.find()
- .sort("text", -1)
- .skip(from).limit(to)
- .limit(20)
- .run(function (err, topics) {
- if (!err && topics && topics.length > 0) {
- recent_topics = topics;
- }
-
- res.render(ViewTemplatePath + "/index", {recent_topics: recent_topics});
- });
- }
- // end /topic/index
self.analyze_trending = function () {
var trending_topics = [];
@@ -153,7 +130,7 @@ exports.controller = function(req, res, next) {
res.send(trending_topics);
break;
default:
- res.render(ViewTemplatePath + "/list", {topics: trending_topics});
+ res.render(ViewTemplatePath + "/list", {layout: "dashboard/dashboard-layout", topics: trending_topics});
}
//res.send(trending_topics);
}
@@ -180,7 +157,7 @@ exports.controller = function(req, res, next) {
topics = [];
}
- res.render(ViewTemplatePath + "/list", {topics: topics});
+ res.render(ViewTemplatePath + "/list", {layout: "dashboard/dashboard-layout", topics: topics});
});
}
// end /topic/popular
@@ -201,7 +178,7 @@ exports.controller = function(req, res, next) {
if (err || !items) {
items = [];
}
- res.render(ViewTemplatePath + "/view", {topic: topic, items: items});
+ res.render(ViewTemplatePath + "/view", {layout: "dashboard/dashboard-layout", topic: topic, items: items});
});
} else {
res.redirect("/dashboard");
@@ -218,7 +195,7 @@ exports.controller = function(req, res, next) {
return next(err);
}
if (!topic) {
- return res.render("404");
+ return res.render("404", {layout: "dashboard/dashboard-layout"});
}
res.redirect("/topic/view/"+topic.id);
});

0 comments on commit 01ced26

Please sign in to comment.
Something went wrong with that request. Please try again.