From 92b48fbcd74fa25ed8f1206574cb226bd4189180 Mon Sep 17 00:00:00 2001 From: Trey Griffith Date: Fri, 21 Feb 2014 12:15:04 -0500 Subject: [PATCH] change tab to be a general news tab instead of submit news --- app.js | 3 +-- controllers/home.js | 4 +--- controllers/news.js | 6 ++++++ views/partials/navigation.jade | 5 ++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index 8b2f765e..73f99e1d 100755 --- a/app.js +++ b/app.js @@ -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); @@ -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); diff --git a/controllers/home.js b/controllers/home.js index c75cf748..25a1bf5c 100644 --- a/controllers/home.js +++ b/controllers/home.js @@ -4,9 +4,7 @@ */ exports.index = function(req, res) { - res.render('home', { - title: 'Home' - }); + res.redirect('/news'); }; exports.signup = function(req, res) { diff --git a/controllers/news.js b/controllers/news.js index 571bf112..db26b904 100644 --- a/controllers/news.js +++ b/controllers/news.js @@ -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, @@ -94,6 +95,7 @@ exports.comments = function (req, res, next) { res.render('news/show', { title: newsItem.title, + tab: 'news', item: newsItem, comments: results.comments }); @@ -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, @@ -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, @@ -550,6 +554,7 @@ exports.submitNews = function(req, res) { }; res.render('news/submit', { + tab: 'news', newsItem: newsItem, title: 'Submit News' }); @@ -607,6 +612,7 @@ exports.postNews = function(req, res, next) { return res.render('news/submit', { newsItem: newsItem, title: 'Submit News', + tab: 'news', posttype: posttype }); } diff --git a/views/partials/navigation.jade b/views/partials/navigation.jade index 6c32a731..e58d4058 100644 --- a/views/partials/navigation.jade +++ b/views/partials/navigation.jade @@ -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)