Skip to content

Commit

Permalink
update templates to pass user challenge and challenge values to the r…
Browse files Browse the repository at this point in the history
…eport controller and template

update report test
Relates #33 #34 #35
  • Loading branch information
haydnba committed May 18, 2018
1 parent e2561ca commit 51b61fe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/test/controllers/report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const router = require('../../app.js');

test.only('Test report GET route', (t) => {
request(router)
.get('/report')
.get('/report?challenge=3')
.expect(200)
.expect('Content-Type', /html/)
.end((err, res) => {
t.error(err);
t.ok(res.text.includes('Report'), 'response contains login message');
t.ok(res.text.includes('Report'), 'response contains report message');
t.end();
});
});
2 changes: 1 addition & 1 deletion src/views/challenge.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<footer>
<p>This challenge was added by
<img src="http://sigil.cupcake.io/{{username}}" height="50px" width="50px">{{username}} on {{added}}.</p>
<a href="/report?challenge={{id}}">Report an issue with this challenge</a>
<a href="/report?challenge={{id}}&referrer=challenge">Report an issue with this challenge</a>
</footer>
</article>
</section>
7 changes: 4 additions & 3 deletions src/views/home.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
{{#if title}}
<div>
<h3>Active Challenge</h3>
<h3>{{usch}}</h3>
<img src="/img/{{lowercase category}}.svg" alt="icon for {{category}}" height="60px" width="60px">
<p>{{title}}</p>
<form action="/update-challenge/complete/{{id}}" method="POST">
<form action="/update-challenge/complete/{{usch}}" method="POST">
<input type="submit" value="&#10003">
</form>
<form action="/update-challenge/abandon/{{id}}" method="POST">
<form action="/update-challenge/abandon/{{usch}}" method="POST">
<input type="submit" value="&times">
</form>
<a href="/report?challenge={{id}}">Report an issue with this challenge</a>
<a href="/report?challenge={{id}}&referrer=home">Report an issue with this challenge</a>
</div>
{{else}}
<p>no active</p>
Expand Down
9 changes: 8 additions & 1 deletion src/views/report.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<section>
<h1>Report an Issue</h1>
<article>
<header>There will be the title and description of the challenge to be reported on here</header>
<main>
<p>Report an issue with the challenge: {{title}}, added on {{added}} by {{username}}</p>
<p>The content of this challenge is:</p>
<p>{{description}}</p>
</main>
</article>
<article>
<a href="/{{referrer}}/{{id}}">GO BACK</a>
<form action="/report" method="POST">
<fieldset>
<legend>Reporting Form</legend>
Expand Down

0 comments on commit 51b61fe

Please sign in to comment.