From 3662aac188a9090b9c060627396f716491fc269d Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 9 Mar 2015 20:31:31 +0100 Subject: [PATCH] switch example to ejs (for multi content type) --- example/example.js | 8 +++++--- example/package.json | 2 +- example/www_static/js/example-app.js | 3 ++- example/www_views/index.ejs | 23 ++++++++++++++++++++++ example/www_views/index.jade | 21 -------------------- example/www_views/thtml/bar.ejs | 4 ++++ example/www_views/thtml/bar.jade | 5 ----- example/www_views/thtml/foo.ejs | 4 ++++ example/www_views/thtml/foo.jade | 4 ---- example/www_views/thtml/index.ejs | 4 ++++ example/www_views/thtml/index.jade | 5 ----- example/www_views/thtml/layout/footer.ejs | 5 +++++ example/www_views/thtml/layout/footer.jade | 3 --- example/www_views/thtml/layout/header.ejs | 13 ++++++++++++ example/www_views/thtml/layout/header.jade | 10 ---------- 15 files changed, 61 insertions(+), 53 deletions(-) create mode 100644 example/www_views/index.ejs delete mode 100644 example/www_views/index.jade create mode 100644 example/www_views/thtml/bar.ejs delete mode 100644 example/www_views/thtml/bar.jade create mode 100644 example/www_views/thtml/foo.ejs delete mode 100644 example/www_views/thtml/foo.jade create mode 100644 example/www_views/thtml/index.ejs delete mode 100644 example/www_views/thtml/index.jade create mode 100644 example/www_views/thtml/layout/footer.ejs delete mode 100644 example/www_views/thtml/layout/footer.jade create mode 100644 example/www_views/thtml/layout/header.ejs delete mode 100644 example/www_views/thtml/layout/header.jade diff --git a/example/example.js b/example/example.js index 9d94329..f0b4053 100644 --- a/example/example.js +++ b/example/example.js @@ -100,8 +100,10 @@ function renderTemplate() { function renderPage(server) { return function (req, res) { res.render('index', { - includeCssFiles: server.get('ff_assets_css'), - includeJsFiles: server.get('ff_assets_js'), + pageTitle: 'node-ff-assets example', + 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.'); - server.set('view engine', 'jade'); + server.set('view engine', 'ejs'); server.set('views', path.join(__dirname, 'www_views')); server.use('/static',express.static(path.join(__dirname,'www_static'))); server.use('/static/module/bootstrap',express.static(path.join(__dirname,'node_modules/bootstrap/dist'))); diff --git a/example/package.json b/example/package.json index 9b2ac7f..2574567 100644 --- a/example/package.json +++ b/example/package.json @@ -11,6 +11,6 @@ "bootstrap": "^3.3.2", "express": "~4.11.0", "flot": "^0.8.0-alpha", - "jade": "^1.9.2" + "ejs": "^2.3.1" } } diff --git a/example/www_static/js/example-app.js b/example/www_static/js/example-app.js index 3657458..9756260 100644 --- a/example/www_static/js/example-app.js +++ b/example/www_static/js/example-app.js @@ -8,6 +8,7 @@ angular.module('exampleUI', ['ngRoute']). pageRouteInit[i]($routeProvider, $locationProvider); } $routeProvider.otherwise({ redirectTo: '/example-ui' }); - $locationProvider.html5Mode(true); + // base kills svg url property + more (but kills ie9 support) + $locationProvider.html5Mode({enabled: true, requireBase: false}); }]); diff --git a/example/www_views/index.ejs b/example/www_views/index.ejs new file mode 100644 index 0000000..0ad8c3c --- /dev/null +++ b/example/www_views/index.ejs @@ -0,0 +1,23 @@ + + + + <%= pageTitle %> + + + + + <% if (pageCssFiles.length) { %><% pageCssFiles.forEach(function (cssFile) { %><% }) %><% } %> + + +
+
+
+
+
+
+
+
+
+ <% if (pageJsFiles.length) { %><% pageJsFiles.forEach(function (jsFile) { %><% }) %><% } %> + + diff --git a/example/www_views/index.jade b/example/www_views/index.jade deleted file mode 100644 index 982f137..0000000 --- a/example/www_views/index.jade +++ /dev/null @@ -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}') - diff --git a/example/www_views/thtml/bar.ejs b/example/www_views/thtml/bar.ejs new file mode 100644 index 0000000..edc34ff --- /dev/null +++ b/example/www_views/thtml/bar.ejs @@ -0,0 +1,4 @@ +
+

Bar

+

Welcome to the bar.

+
diff --git a/example/www_views/thtml/bar.jade b/example/www_views/thtml/bar.jade deleted file mode 100644 index 867ed58..0000000 --- a/example/www_views/thtml/bar.jade +++ /dev/null @@ -1,5 +0,0 @@ -div - h2 Bar - - p Welcome to bar. - diff --git a/example/www_views/thtml/foo.ejs b/example/www_views/thtml/foo.ejs new file mode 100644 index 0000000..52c464f --- /dev/null +++ b/example/www_views/thtml/foo.ejs @@ -0,0 +1,4 @@ +
+

Foo

+

Welcome to the foo.

+
diff --git a/example/www_views/thtml/foo.jade b/example/www_views/thtml/foo.jade deleted file mode 100644 index d5fe452..0000000 --- a/example/www_views/thtml/foo.jade +++ /dev/null @@ -1,4 +0,0 @@ -div - h2 Foo - - p Welcome to foo. diff --git a/example/www_views/thtml/index.ejs b/example/www_views/thtml/index.ejs new file mode 100644 index 0000000..c6c6dcc --- /dev/null +++ b/example/www_views/thtml/index.ejs @@ -0,0 +1,4 @@ +
+

Example UI Index

+

Welcome make yourself at home.

+
diff --git a/example/www_views/thtml/index.jade b/example/www_views/thtml/index.jade deleted file mode 100644 index 0848c16..0000000 --- a/example/www_views/thtml/index.jade +++ /dev/null @@ -1,5 +0,0 @@ -div - h2 Example UI Index - - p Welcome - p Make your self at home. diff --git a/example/www_views/thtml/layout/footer.ejs b/example/www_views/thtml/layout/footer.ejs new file mode 100644 index 0000000..3ff644a --- /dev/null +++ b/example/www_views/thtml/layout/footer.ejs @@ -0,0 +1,5 @@ + diff --git a/example/www_views/thtml/layout/footer.jade b/example/www_views/thtml/layout/footer.jade deleted file mode 100644 index e47cd5d..0000000 --- a/example/www_views/thtml/layout/footer.jade +++ /dev/null @@ -1,3 +0,0 @@ -nav(class='navbar') - div(class='navbar-footer') - Example footer \ No newline at end of file diff --git a/example/www_views/thtml/layout/header.ejs b/example/www_views/thtml/layout/header.ejs new file mode 100644 index 0000000..109a1c9 --- /dev/null +++ b/example/www_views/thtml/layout/header.ejs @@ -0,0 +1,13 @@ + diff --git a/example/www_views/thtml/layout/header.jade b/example/www_views/thtml/layout/header.jade deleted file mode 100644 index 72fae6e..0000000 --- a/example/www_views/thtml/layout/header.jade +++ /dev/null @@ -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 \ No newline at end of file