Skip to content

Commit 58b5ef7

Browse files
committed
new markup + renamed
1 parent c33b250 commit 58b5ef7

18 files changed

Lines changed: 70 additions & 27 deletions

File tree

generators/controllers/default.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
var fs = require('fs');
2+
3+
exports.install = function(framework) {
4+
framework.route('/', view_homepage);
5+
};
6+
7+
// EXAMPLE:
8+
// A function with a callback
9+
function custom(a, b, callback) {
10+
// callback(error, result);
11+
callback(null, a + b);
12+
};
13+
14+
function view_homepage() {
15+
16+
var self = this;
17+
18+
// Harmony usage
19+
// async(fn)([callback])
20+
// utils.async(fn)([callback]);
21+
22+
// Prepare function to async
23+
// sync(fn)
24+
// utils.sync(fn);
25+
26+
async(function *() {
27+
28+
var a = yield sync(fs.readFile)(self.path.root('index.js'));
29+
var b = yield sync(fs.readFile)(self.path.root('controllers/default.js'));
30+
31+
// custom function
32+
var c = yield sync(custom)(1, 2);
33+
34+
self.plain('==== index.js\n\n' + a.toString('utf8') + '\n\n==== controllers/default.js\n\n' + b.toString('utf8') + '\n\n==== custom function\n\n' + c);
35+
36+
})();
37+
38+
}
File renamed without changes.

templates/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var framework = require('total.js');
2+
var http = require('http');
3+
var debug = true;
4+
5+
framework.run(http, debug);
File renamed without changes.

templates/templates/array.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>@{index}</div>
2+
<div>Raw: @{!model}</div>
3+
<br />

templates/templates/menu.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul class="menu">
2+
<!--
3+
<li@{if model.alternate} class="alternate"@{endif}><a href="@{model.url}">@{model. name}</a>
4+
-->
5+
</ul>

templates/templates/paging.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div class="mb5">Paging:</div>
2+
<div class="paging">
3+
<!--
4+
<a href="@{model.url}">@{model.name}</a>
5+
-->
6+
<div>@{repository.items} items</div>
7+
</div>

0 commit comments

Comments
 (0)