Skip to content

Commit

Permalink
change tab to be a general news tab instead of submit news
Browse files Browse the repository at this point in the history
  • Loading branch information
treygriffith committed Feb 21, 2014
1 parent 50d57e9 commit 92b48fb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ app.get('/logout', userController.logout);
* Static Page Routes
*/

app.get('/', homeController.index);
app.get('/about', homeController.about);
app.get('/bookmarklet', homeController.bookmarklet);
app.get('/signup', homeController.signup);
Expand All @@ -142,8 +143,6 @@ app.post('/contact', contactController.postContact);
/**
* User Account Routes
*/

app.get('/', newsController.index);
app.get('/account', passportConf.isAuthenticated, userController.getAccount);
app.post('/account/profile', passportConf.isAuthenticated, userController.postUpdateProfile);
app.post('/account/password', passportConf.isAuthenticated, userController.postUpdatePassword);
Expand Down
4 changes: 1 addition & 3 deletions controllers/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
*/

exports.index = function(req, res) {
res.render('home', {
title: 'Home'
});
res.redirect('/news');
};

exports.signup = function(req, res) {
Expand Down
6 changes: 6 additions & 0 deletions controllers/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ exports.index = function(req, res, next) {

res.render('news/index', {
title: 'Top News',
tab: 'news',
items: newsItems,
page: page,
archive: page > maxPages,
Expand Down Expand Up @@ -94,6 +95,7 @@ exports.comments = function (req, res, next) {

res.render('news/show', {
title: newsItem.title,
tab: 'news',
item: newsItem,
comments: results.comments
});
Expand Down Expand Up @@ -296,6 +298,7 @@ exports.userNews = function(req, res, next) {

res.render('news/index', {
title: 'Posts by ' + user.username,
tab: 'news',
items: results.newsItems,
comments: results.comments,
filteredUser: user.username,
Expand All @@ -320,6 +323,7 @@ exports.sourceNews = function(req, res, next) {

res.render('news/index', {
title: 'Recent news from ' + req.params.source,
tab: 'news',
items: newsItems,
page: page,
newsItemsPerPage: newsItemsPerPage,
Expand Down Expand Up @@ -550,6 +554,7 @@ exports.submitNews = function(req, res) {
};

res.render('news/submit', {
tab: 'news',
newsItem: newsItem,
title: 'Submit News'
});
Expand Down Expand Up @@ -607,6 +612,7 @@ exports.postNews = function(req, res, next) {
return res.render('news/submit', {
newsItem: newsItem,
title: 'Submit News',
tab: 'news',
posttype: posttype
});
}
Expand Down
5 changes: 2 additions & 3 deletions views/partials/navigation.jade
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
a.navbar-brand(href='/') pullup
.collapse.navbar-collapse
ul.nav.navbar-nav
if user
li.hidden-xs(class=title=='Submit News'?'active':undefined)
a(href='/news/submit') Submit News
li.hidden-xs(class=tab=='news'?'active':undefined)
a(href='/news') News
li.hidden-xs(class=title=='Open Issues'?'active':undefined)
a(href='/issues') Issues
li(class=title=='About'?'active':undefined)
Expand Down

0 comments on commit 92b48fb

Please sign in to comment.