filtered out visited sites via pug page for index
This commit is contained in:
parent
c260f206e0
commit
eb9d8f78f7
@ -27,7 +27,7 @@ module.exports = {
|
|||||||
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;
|
||||||
res.render('index', { title: "Home", sites: sites });
|
res.render('site-listing', { title: "All Sites", sites: sites });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
UniqueSiteVisits: function(req, res){
|
UniqueSiteVisits: function(req, res){
|
||||||
@ -35,7 +35,7 @@ module.exports = {
|
|||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
Site.findAllById(uniqueSites, function(err, uniqueSiteVisits){
|
Site.findAllById(uniqueSites, function(err, uniqueSiteVisits){
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
res.render('index', { title: "UniqueSiteVisits", sites: uniqueSiteVisits });
|
res.render('site-listing', { title: "UniqueSiteVisits", sites: uniqueSiteVisits });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,16 @@ extends layout
|
|||||||
block content
|
block content
|
||||||
h1= title
|
h1= title
|
||||||
|
|
||||||
h2= "Sites Visited: " + visits.length + "/" + totalSites
|
h2= "Sites Visited: "
|
||||||
|
a(href="/visits") #{visits.length}
|
||||||
|
| /
|
||||||
|
a(href="/sites") #{totalSites}
|
||||||
|
|
||||||
|
- var sitesVisited = [];
|
||||||
|
|
||||||
h2= "Visits"
|
h2= "Visits"
|
||||||
each visit in visits
|
each visit in visits
|
||||||
|
- sitesVisited.push(visit.id);
|
||||||
h3= visit.site
|
h3= visit.site
|
||||||
//- Commmand list of all the states
|
//- Commmand list of all the states
|
||||||
h5
|
h5
|
||||||
@ -18,6 +24,7 @@ block content
|
|||||||
|
|
||||||
h2= "Remaining"
|
h2= "Remaining"
|
||||||
each site in sites
|
each site in sites
|
||||||
|
if !(sitesVisited.includes(site.id))
|
||||||
h3= site.site
|
h3= site.site
|
||||||
//- Commmand list of all the states
|
//- Commmand list of all the states
|
||||||
h5
|
h5
|
||||||
@ -26,5 +33,8 @@ block content
|
|||||||
| #{states[i]}
|
| #{states[i]}
|
||||||
if (i + 1 < states.length)
|
if (i + 1 < states.length)
|
||||||
| ,
|
| ,
|
||||||
|
else
|
||||||
|
h3= "Removed!"
|
||||||
|
|
||||||
include footer.pug
|
include footer.pug
|
||||||
|
|
||||||
|
18
views/site-listing.pug
Normal file
18
views/site-listing.pug
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
extends layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
h1= title
|
||||||
|
|
||||||
|
h2= "Sites: " + sites.length
|
||||||
|
|
||||||
|
each site in sites
|
||||||
|
h3= site.site
|
||||||
|
//- Commmand list of all the states
|
||||||
|
h5
|
||||||
|
- var states = site.states.split(',')
|
||||||
|
- for (var i = 0; i < states.length; i++)
|
||||||
|
| #{states[i]}
|
||||||
|
if (i + 1 < states.length)
|
||||||
|
| ,
|
||||||
|
|
||||||
|
include footer.pug
|
Reference in New Issue
Block a user