index data added.
This commit is contained in:
parent
ba018c685c
commit
c260f206e0
@ -13,6 +13,17 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getHome: function(req, res){
|
||||||
|
Site.getAll(function(err, sites){
|
||||||
|
Visit.findUniqueSites(function(err, uniqueSites){
|
||||||
|
if(err) throw err;
|
||||||
|
Site.findAllById(uniqueSites, function(err, uniqueSiteVisits){
|
||||||
|
if(err) throw err;
|
||||||
|
res.render('index', { title: "UNESCO Tracker", visits: uniqueSiteVisits, sites: sites, totalSites: sites.length });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
getAll: function(req, res){
|
getAll: function(req, res){
|
||||||
Site.getAll(function(err, sites){
|
Site.getAll(function(err, sites){
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -3,7 +3,8 @@ var router = express.Router();
|
|||||||
|
|
||||||
var sitesController = require('../controllers/sites')
|
var sitesController = require('../controllers/sites')
|
||||||
|
|
||||||
router.get('/', sitesController.getAll);
|
router.get('/', sitesController.getHome);
|
||||||
|
router.get('/sites', sitesController.getAll);
|
||||||
router.get('/visits', sitesController.UniqueSiteVisits);
|
router.get('/visits', sitesController.UniqueSiteVisits);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -2,10 +2,21 @@ extends layout
|
|||||||
|
|
||||||
block content
|
block content
|
||||||
h1= title
|
h1= title
|
||||||
p Welcome to #{title}
|
|
||||||
|
|
||||||
h2= sites.length
|
h2= "Sites Visited: " + visits.length + "/" + totalSites
|
||||||
|
|
||||||
|
h2= "Visits"
|
||||||
|
each visit in visits
|
||||||
|
h3= visit.site
|
||||||
|
//- Commmand list of all the states
|
||||||
|
h5
|
||||||
|
- var states = visit.states.split(',')
|
||||||
|
- for (var i = 0; i < states.length; i++)
|
||||||
|
| #{states[i]}
|
||||||
|
if (i + 1 < states.length)
|
||||||
|
| ,
|
||||||
|
|
||||||
|
h2= "Remaining"
|
||||||
each site in sites
|
each site in sites
|
||||||
h3= site.site
|
h3= site.site
|
||||||
//- Commmand list of all the states
|
//- Commmand list of all the states
|
||||||
|
Reference in New Issue
Block a user