removed layout-control example
Before adoption: this commit came in with the history the project adopted, so no landing records it.
no longer applies
authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent cc69d50 · Browse files · 6 files·+0 added−107 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+0 added−107 removed
- other:+0 added−107 removed
Provenance
- Commit
e3f6faa- Tree
4cf9c46- Author
TJ Holowaychuk <tj@vision-media.ca>- Committer
TJ Holowaychuk <tj@vision-media.ca>- Parent
cc69d50
6 files changed+0 added−107 removed
deleted:examples/layout-control/views/layouts/alternate.html-26 removed
1234567891011121314151617181920212223242526<html> <title>Alternate</title> <style> body { padding: 50px; font: 14px "helvetica neue", helvetica, sans-serif; color: #333; } #sidebar { float: left; width: 150px; } #content { float: left; } </style> <body> <h1>Alternate Layout</h1> <div id="sidebar"> <%- sidebar %> </div> <div id="content"> <%- body %> </div> </body></html>No newline at end of filedeleted:examples/layout-control/views/layouts/default.html-16 removed
12345678910111213141516<html> <head> <title>Default</title> <style> body { padding: 50px; font: 14px "helvetica neue", helvetica, sans-serif; color: #333; } </style> </head> <body> <h1>Default Layout</h1> <%- body %> </body></html>No newline at end of filedeleted:examples/layout-control/views/_alternate-sidebar.html-1 removed
1<p>Moar sidebar here</p>No newline at end of filedeleted:examples/layout-control/views/page.html-8 removed
12345678<h1>Page</h1><% if (path == '/alternate') { %> <% contentFor('sidebar', partial('alternate-sidebar')) %> <p>Click <a href="/">here</a> to view the default layout.</p> <p>Click <a href="/alternate2">here</a> to view another alternate page.</p><% } else { %> <p>Click <a href="/alternate">here</a> to view the alternate layout.</p><% } %>deleted:examples/layout-control/views/page2.html-4 removed
1234<% layout('layouts/alternate') %><% contentFor('sidebar', '<p>Another sidebar here</p>') %><h1>Page</h1><p>Click <a href="/">here</a> to view the default layout.</p>deleted:examples/layout-control/app.js-52 removed
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
/** * Module dependencies. */
var express = require('../../lib/express') , url = require('url');
var app = express.createServer();
app.set('views', __dirname + '/views');
// map .html to ejs moduleapp.register('html', require('ejs'));app.set('view engine', 'html');
// set default layout, usually "layout"app.locals.layout = 'layouts/default';
app.use(function(req, res, next){ // expose the current path as a view local res.locals.path = url.parse(req.url).pathname;
// assign content str for section res.locals.contentFor = function(section, str){ res.locals[section] = str; }; next();});
app.get('/', function(req, res){ res.render('page');});
app.get('/alternate', function(req, res){ res.render('page', { layout: 'layouts/alternate' });});
app.get('/alternate2', function(req, res){ res.render('page2');});
app.get('/defined-in-view', function(req, res){ // note that we do not explicitly // state the layout here, the view does, // although we could do it here as well. res.render('pages');});
app.listen(3000);console.log('Express app started on port 3000');