Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Enable simple layout to view without tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslorentsen committed Sep 25, 2017
1 parent bc597b2 commit 9abd99e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ composer.phar
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
/config.php
/node_modules
/node_modules
*.secret.md
7 changes: 7 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ app.set('views', path.join(__dirname, 'views'))
app.use('/node_modules', express.static('node_modules'))
app.use('/js', express.static('js'))

app.all('/*', function (req, res, next) {
if ('simple' === req.query.layout) {
req.app.locals.layout = 'simple';
}
next();
});

app.get('/', function(req, res) {
res.render('index', { apiKey: apiKey, cardActive: 'active', cvcActive: '', nameActive: '' })
});
Expand Down
5 changes: 5 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ describe('loading express', function () {
.get('/name')
.expect(200, done);
});
it('responds to / with simple layout', function testSlashSimple(done) {
request(server)
.get('/layout=simple')
.expect(200, done);
});
it('404 everything else', function testPath(done) {
request(server)
.get('/foo/bar')
Expand Down
17 changes: 17 additions & 0 deletions views/layouts/simple.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
{{{ body }}}
</div>
</div>
</div>
</body>
</html>
38 changes: 19 additions & 19 deletions views/layouts/single.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Adyen Payload Generator</h1>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Adyen Payload Generator</h1>

<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link {{cardActive}}" href="/">Encrypt Card</a>
</li>
<li class="nav-item">
<a class="nav-link {{cvcActive}}" href="/cvc">Encrypt CVC</a>
</li>
<li class="nav-item">
<a class="nav-link {{nameActive}}" href="/name">Encrypt Name</a>
</li>
</ul>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link {{cardActive}}" href="/">Encrypt Card</a>
</li>
<li class="nav-item">
<a class="nav-link {{cvcActive}}" href="/cvc">Encrypt CVC</a>
</li>
<li class="nav-item">
<a class="nav-link {{nameActive}}" href="/name">Encrypt Name</a>
</li>
</ul>

<p class="lead">Complete this form and press generate to get encrypted payload.</p>
{{{ body }}}
</div>
<p class="lead">Complete this form and press generate to get encrypted payload.</p>
{{{ body }}}
</div>
</div>
</body>
</div>
</body>
</html>

0 comments on commit 9abd99e

Please sign in to comment.