Skip to content

Commit

Permalink
added partials : header, footer, htmlHead;
Browse files Browse the repository at this point in the history
added main.hbs (not final);
edited routes in controllers/index.js;
began results.js
Relates #11, #12, #13, #14, #15, 30
  • Loading branch information
morkeltry committed Aug 16, 2017
1 parent 15ec9a3 commit 9885fa2
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const review = require('./add-review');
const error = require('./error');

router.get('/', home);
router.get('/results', results.get);
// router.get('/results/all', results.get); //can piggyback on /results/:distance (?)
router.get('/results/:distance', results.get);
router.get('/planets/:planet', planet.get);
router.post('/add-review', review.post);
router.use(error.client);
Expand Down
16 changes: 15 additions & 1 deletion src/controllers/results.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
searchResults.get = (req, res) => {
const searchResults = {}

listOfPlanets = ({querydetails}) => {
if (querydetails.searchAll)
const dbQuerySelectCriterion = {query: "", params: null};
else {
const dbQuerySelectCriterion = {query: "WHERE distance <= {$1}", params: [querydetails.distance]};
} ///creates the SECOND HALF of a SELECT query, prepared in pg's parameterising format
/// do a db query on details, or on

}


searchResults.get = (req, res) => { ///can this take a thrid argument which would be :distance ?
/// do a db query on details, or on /all , using listOfPlanets({distance:x})

};

Expand Down
7 changes: 7 additions & 0 deletions src/views/partials/footer.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

<footer class="footer">
<div class="footer__container">
<p>© 2017 Not Murdoch</p>
<p><a href="#">@dontbuythesun</a></p>
</div>
</footer>
17 changes: 17 additions & 0 deletions src/views/partials/header.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

<header class="navbar">
<div class="navbar__container">
<nav class="navbar__nav" role="navigation">
<ul class="navbar__list">
<li class="navbar__item">
<a class="navbar__link
{{#if currentPage.home}} navbar__link--active {{/if}} " href="/">Search</a>
</li>
<li class="navbar__item">
<a class="navbar__link
{{#if currentPage.showAll}} navbar__link--active {{/if}} " href="/results/all"> Show All</a>
</li>
</ul>
</nav>
</div>
</header>
10 changes: 10 additions & 0 deletions src/views/partials/htmlHead.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/css/styles.css">
<title>My Space. It's Mine.</title>
</head>

0 comments on commit 9885fa2

Please sign in to comment.