Skip to content
Myr

refactor ejs example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent a52b1f1 · Browse files · 11 files+32 added−69 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

11 files+32 added−69 removed

  • tests:+3 added−3 removed
  • other:+29 added−66 removed

11 files+32 added−69 removed

modified:examples/auth/views/head.ejs-4 removed
11 unmodified lines
12 }13 .success {14 color: green;15 }16 footer {17 margin-top: 50px;18 color: gray;19 }16 </style>17 </head>18 <body>
deleted:examples/ejs/views/footer/all.html-7 removed
deleted:examples/ejs/views/header/all.html-20 removed
deleted:examples/ejs/views/header/emails.html-3 removed
deleted:examples/ejs/views/header/users.html-3 removed
deleted:examples/ejs/views/emails.html-12 removed
added:examples/ejs/views/footer.html+2 added
added:examples/ejs/views/header.html+20 added
modified:examples/ejs/views/users.html+3 added-5 removed
1<% include header/users.html %>1<% include header.html %>23<h1>Users</h1>4<ul id="users">5 <% users.forEach(function(user){ %>6 <li><%= user.name %> <%= user.email %></li>6 <li><%= user.name %> &lt;<%= user.email %>&gt;</li>7 <% }) %>8</ul>910<p><a href="/next">next</a></p> 1112<% include footer/all.html %>10<% include footer.html %>
modified:examples/ejs/index.js+4 added-12 removed
29 unmodified lines
30app.set('view engine', 'html');3132// Dummy users33var users = [34 { name: 'tobi', email: 'tobi@learnboost.com' }35 , { name: 'loki', email: 'loki@learnboost.com' }36 , { name: 'jane', email: 'jane@learnboost.com' }34 { name: 'tobi', email: 'tobi@learnboost.com' },35 { name: 'loki', email: 'loki@learnboost.com' },36 { name: 'jane', email: 'jane@learnboost.com' }37];3839app.get('/', function(req, res){40 res.render('users', {41 users: users,42 title: "EJS example",43 header: "Some users"44 });45});4647app.get('/next', function(req, res){48 res.render('emails', {41 users: users,42 title: "EJS example",51 header: "Some email address"43 header: "Some users"44 });45});4647if (!module.parent) {
3 unmodified lines
modified:test/acceptance/ejs.js+3 added-3 removed
8 unmodified lines
9 .get('/')10 .end(function(err, res){11 res.should.have.status(200);12 res.should.have.header('Content-Type', 'text/html; charset=utf-8');13 res.text.should.include('<li>tobi tobi@learnboost.com</li>');14 res.text.should.include('<li>loki loki@learnboost.com</li>');15 res.text.should.include('<li>jane jane@learnboost.com</li>');13 res.text.should.include('<li>tobi &lt;tobi@learnboost.com&gt;</li>');14 res.text.should.include('<li>loki &lt;loki@learnboost.com&gt;</li>');15 res.text.should.include('<li>jane &lt;jane@learnboost.com&gt;</li>');16 done();17 });18 })19 })
1 unmodified line