Skip to content

Commit 7affbc5

Browse files
committed
Merge pull request totaljs#35 from totaljs/master
Master
2 parents ca9f2e2 + 69bf1a7 commit 7affbc5

File tree

53 files changed

+405
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+405
-107
lines changed

authorization-roles/definitions/authorization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AUTHORIZATION
33
// ================================================
44

5-
F.onAuthorization = function(req, res, flags, next) {
5+
F.onAuthorize = function(req, res, flags, next) {
66

77
var cookie = req.cookie('__user');
88

authorization/definitions/authorization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AUTHORIZATION
33
// ================================================
44

5-
F.onAuthorization = function(req, res, flags, callback) {
5+
F.onAuthorize = function(req, res, flags, callback) {
66

77
var cookie = req.cookie(F.config.cookie);
88
if (cookie === null || cookie.length < 10) {

blocks/controllers/default.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports.install = function() {
2+
F.route('/');
3+
F.route('/admin/', 'index');
4+
};

blocks/definitions/blocks.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// JavaScript
2+
F.map('/js/admin.js', '/js/script.js#admin'); // --> #admin is defined block
3+
4+
// CSS
5+
F.map('/css/admin.css', '/css/style.css#admin'); // --> #admin is defined block
6+
7+
// Others examples with merging:
8+
// F.merge('/css/website.css', 'ui.css#blockB,blockC', 'website.css');
9+
// F.merge('/css/admin.css', 'ui.css#blockA,blockB,blockC', 'admin.css');

blocks/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('total.js').http('debug');

blocks/public/css/style.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
body { background-color: white; font-size: 12px; font-family: Arial; }
2+
3+
/*
4+
* @{BLOCK admin}
5+
*/
6+
div { background-color: red; color: white; padding: 10px 0; }
7+
b { font-size: 14px; }
8+
body:before { content: 'ADMIN AREA'; }
9+
/*
10+
* @{end}
11+
*/
12+
13+
/*
14+
* @{BLOCK blockA, blockB, blockC}
15+
*/
16+
div { content: 'ANOTHER EXAMPLE'; }
17+
/*
18+
* @{end}
19+
*/

blocks/public/js/script.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function common_code() {
2+
3+
}
4+
5+
// =======================================
6+
// @{BLOCK admin}
7+
// =======================================
8+
setTimeout(function() {
9+
alert('ADMIN BLOCK --> code only for admin area');
10+
}, 1000);
11+
// =======================================
12+
// @{end}
13+
// =======================================

blocks/views/index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@{layout('')}
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<title>Blocks</title>
6+
<meta name="description" content="PAGE DESCRIPTION" />
7+
<meta name="keywords" content="PAGE KEYWORDS" />
8+
<meta charset="utf-8" />
9+
<meta http-equiv="X-UA-Compatible" content="IE=11" />
10+
<meta name="format-detection" content="telephone=no" />
11+
<meta name="viewport" content="width=device-width, initial-scale=1" />
12+
<meta name="robots" content="all,follow" />
13+
@{if url === '/admin/'}
14+
@{import('admin.css', 'admin.js')}
15+
@{else}
16+
@{import('style.css', 'script.js')}
17+
@{fi}
18+
</head>
19+
<body>
20+
21+
<div>
22+
<a href="@{if url === '/admin/'}/@{else}/admin/@{fi}">SWITCH</a>
23+
</div>
24+
25+
</body>
26+
</html>

framework-modules/modules/feedback.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var greeting = '';
22

3-
exports.name = 'feedback';
43
exports.version = '1.01';
54

65
exports.install = function(options) {

framework-modules/modules/utils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
exports.name = 'utils';
21
exports.version = '1.01';
32

43
exports.now = function now() {

0 commit comments

Comments
 (0)