Skip to content

Commit

Permalink
new example
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Apr 9, 2014
1 parent 62673cb commit 3aec22b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
11 changes: 11 additions & 0 deletions views-place/controllers/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.install = function(framework) {
framework.route('/', viewHomepage);
};

function viewHomepage() {
var self = this;

self.place('scripts', '<script>alert("FROM CONTROLLER");</script>');
self.view('homepage');

}
5 changes: 5 additions & 0 deletions views-place/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var framework = require('total.js');
var http = require('http');
var debug = true;

framework.run(http, debug);
23 changes: 23 additions & 0 deletions views-place/views/_layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<meta name="format-detection" content="telephone=no"/>
<meta name="viewport" content="width=1024, user-scalable=yes" />
<meta name="robots" content="all,follow" />

@{head}

</head>
<body>

@{place('header')}

<div>@{body}</div>

<!-- RENDER CONTENT -->
@{place('scripts')}

</body>
</html>
11 changes: 11 additions & 0 deletions views-place/views/homepage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

@{place('scripts', '<script>alert("FROM VIEW");</script>')}

<!-- FRAMEWORK ADDS SCRIPT TAG AUTOMATICALLY (according to the file extension) -->
@{place('scripts', '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', '//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js')}

<div>
Welcome!
</div>

@{place('header', '<h1>PLACE HOLDER</h1>')}

0 comments on commit 3aec22b

Please sign in to comment.