switch example to ejs (for multi content type)
This commit is contained in:
parent
d31beb5f74
commit
3662aac188
|
@ -100,8 +100,10 @@ function renderTemplate() {
|
||||||
function renderPage(server) {
|
function renderPage(server) {
|
||||||
return function (req, res) {
|
return function (req, res) {
|
||||||
res.render('index', {
|
res.render('index', {
|
||||||
includeCssFiles: server.get('ff_assets_css'),
|
pageTitle: 'node-ff-assets example',
|
||||||
includeJsFiles: server.get('ff_assets_js'),
|
pageKeywords: 'node,ff,assets,example,ui',
|
||||||
|
pageCssFiles: server.get('ff_assets_css'),
|
||||||
|
pageJsFiles: server.get('ff_assets_js'),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -120,7 +122,7 @@ buildAssets(server,function(err) {
|
||||||
}
|
}
|
||||||
console.info('Server assets done.');
|
console.info('Server assets done.');
|
||||||
|
|
||||||
server.set('view engine', 'jade');
|
server.set('view engine', 'ejs');
|
||||||
server.set('views', path.join(__dirname, 'www_views'));
|
server.set('views', path.join(__dirname, 'www_views'));
|
||||||
server.use('/static',express.static(path.join(__dirname,'www_static')));
|
server.use('/static',express.static(path.join(__dirname,'www_static')));
|
||||||
server.use('/static/module/bootstrap',express.static(path.join(__dirname,'node_modules/bootstrap/dist')));
|
server.use('/static/module/bootstrap',express.static(path.join(__dirname,'node_modules/bootstrap/dist')));
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"bootstrap": "^3.3.2",
|
"bootstrap": "^3.3.2",
|
||||||
"express": "~4.11.0",
|
"express": "~4.11.0",
|
||||||
"flot": "^0.8.0-alpha",
|
"flot": "^0.8.0-alpha",
|
||||||
"jade": "^1.9.2"
|
"ejs": "^2.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ angular.module('exampleUI', ['ngRoute']).
|
||||||
pageRouteInit[i]($routeProvider, $locationProvider);
|
pageRouteInit[i]($routeProvider, $locationProvider);
|
||||||
}
|
}
|
||||||
$routeProvider.otherwise({ redirectTo: '/example-ui' });
|
$routeProvider.otherwise({ redirectTo: '/example-ui' });
|
||||||
$locationProvider.html5Mode(true);
|
// base kills svg url property + more (but kills ie9 support)
|
||||||
|
$locationProvider.html5Mode({enabled: true, requireBase: false});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
23
example/www_views/index.ejs
Normal file
23
example/www_views/index.ejs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" ng-app="exampleUI">
|
||||||
|
<head>
|
||||||
|
<title><%= pageTitle %></title>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="keywords" content="<%= pageKeywords %>">
|
||||||
|
<% if (pageCssFiles.length) { %><% pageCssFiles.forEach(function (cssFile) { %><link rel="stylesheet" href="<%= cssFile %>"><% }) %><% } %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="wrapper">
|
||||||
|
<div ng-include="'/example-ui/thtml/layout/header'"></div>
|
||||||
|
<div id="page-wrapper">
|
||||||
|
<div id="container-fluid">
|
||||||
|
<div ng-view></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div ng-include="'/example-ui/thtml/layout/footer'"></div>
|
||||||
|
<% if (pageJsFiles.length) { %><% pageJsFiles.forEach(function (jsFile) { %><script src="<%= jsFile %>"></script><% }) %><% } %>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,21 +0,0 @@
|
||||||
doctype html
|
|
||||||
html(lang='en',ng-app='exampleUI')
|
|
||||||
head
|
|
||||||
base(href='/example-ui')
|
|
||||||
title='Example UI'
|
|
||||||
meta(charset='UTF-8')
|
|
||||||
meta(http-equiv='X-UA-Compatible' content='IE=edge')
|
|
||||||
meta(name='viewport' content='width=device-width, initial-scale=1')
|
|
||||||
meta(name='keywords' content='Example UI')
|
|
||||||
each cssFile in includeCssFiles
|
|
||||||
link(rel='stylesheet' href='#{cssFile}')
|
|
||||||
body
|
|
||||||
div(id='wrapper')
|
|
||||||
div(ng-include='\'/example-ui/thtml/layout/header\'')
|
|
||||||
div(id='page-wrapper')
|
|
||||||
div(id='container-fluid')
|
|
||||||
div(ng-view)
|
|
||||||
div(ng-include='\'/example-ui/thtml/layout/footer\'')
|
|
||||||
each jsFile in includeJsFiles
|
|
||||||
script(src='#{jsFile}')
|
|
||||||
|
|
4
example/www_views/thtml/bar.ejs
Normal file
4
example/www_views/thtml/bar.ejs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<div>
|
||||||
|
<h2>Bar</h2>
|
||||||
|
<p>Welcome to the bar.</p>
|
||||||
|
</div>
|
|
@ -1,5 +0,0 @@
|
||||||
div
|
|
||||||
h2 Bar
|
|
||||||
|
|
||||||
p Welcome to bar.
|
|
||||||
|
|
4
example/www_views/thtml/foo.ejs
Normal file
4
example/www_views/thtml/foo.ejs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<div>
|
||||||
|
<h2>Foo</h2>
|
||||||
|
<p>Welcome to the foo.</p>
|
||||||
|
</div>
|
|
@ -1,4 +0,0 @@
|
||||||
div
|
|
||||||
h2 Foo
|
|
||||||
|
|
||||||
p Welcome to foo.
|
|
4
example/www_views/thtml/index.ejs
Normal file
4
example/www_views/thtml/index.ejs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<div>
|
||||||
|
<h2>Example UI Index</h2>
|
||||||
|
<p>Welcome make yourself at home.</p>
|
||||||
|
</div>
|
|
@ -1,5 +0,0 @@
|
||||||
div
|
|
||||||
h2 Example UI Index
|
|
||||||
|
|
||||||
p Welcome
|
|
||||||
p Make your self at home.
|
|
5
example/www_views/thtml/layout/footer.ejs
Normal file
5
example/www_views/thtml/layout/footer.ejs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<nav class="navbar">
|
||||||
|
<div class="navbar-footer">
|
||||||
|
Example footer
|
||||||
|
</div>
|
||||||
|
</nav>
|
|
@ -1,3 +0,0 @@
|
||||||
nav(class='navbar')
|
|
||||||
div(class='navbar-footer')
|
|
||||||
Example footer
|
|
13
example/www_views/thtml/layout/header.ejs
Normal file
13
example/www_views/thtml/layout/header.ejs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="/example-ui/">Home</a>
|
||||||
|
<a class="navbar-brand" href="/example-ui/foo">Foo</a>
|
||||||
|
<a class="navbar-brand" href="/example-ui/bar">Bar</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
|
@ -1,10 +0,0 @@
|
||||||
nav(class='navbar navbar-inverse navbar-fixed-top',role='navigation')
|
|
||||||
div(class='navbar-header')
|
|
||||||
button(type='button',class='navbar-toggle',data-toggle='collapse',data-target='.navbar-ex1-collapse')
|
|
||||||
span(class='sr-only') Toggle navigation
|
|
||||||
span(class='icon-bar')
|
|
||||||
span(class='icon-bar')
|
|
||||||
span(class='icon-bar')
|
|
||||||
a(class='navbar-brand',href='/example-ui') Home
|
|
||||||
a(class='navbar-brand',href='/example-ui/foo') Foo
|
|
||||||
a(class='navbar-brand',href='/example-ui/bar') Bar
|
|
Loading…
Reference in a new issue