This repository has been archived by the owner on Apr 9, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved sub application modularization and template rendering layout…
… system, updated examples due to changes
- Loading branch information
1 parent
69680ed
commit 2db3c3e
Showing
31 changed files
with
165 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
html -> | ||
head | ||
body -> | ||
include @body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
html -> | ||
head | ||
body -> | ||
h1 "A cup of coffee demonstration" | ||
div -> | ||
include "nested1" | ||
div -> | ||
include "nested2" | ||
div -> | ||
include "nested3" | ||
h1 "A cup of coffee demonstration" | ||
div -> | ||
include "nested1" | ||
div -> | ||
include "nested2" | ||
div -> | ||
include "nested3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<%- @include @body %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<%- @include @body %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
mate = require '../../lib/coffeemate' | ||
|
||
# build your own layout structure | ||
mate.context.custom_render = (template_name) -> | ||
@content = template_name | ||
@render 'layout.eco' | ||
|
||
mate.get '/', -> | ||
@foo = 'bar' | ||
@custom_render 'main.eco' | ||
@render 'main' | ||
|
||
mate.listen 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
mate = require('../../../lib/coffeemate').newInstance() | ||
mate = require '../../../lib/coffeemate' | ||
|
||
mate.get '/', -> @view 'home' | ||
|
||
module.exports = mate | ||
mate.get '/', -> @render 'base/index' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
mate = require('../../../lib/coffeemate').newInstance() | ||
mate = require '../../../lib/coffeemate' | ||
|
||
mate.get '/', -> @view 'list' | ||
|
||
module.exports = mate | ||
mate.get '/', -> @render 'comments/index', 'comment_layout' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
mate = require '../../lib/coffeemate' | ||
|
||
# use some of connect middlewares | ||
mate.logger() | ||
mate.static("#{__dirname}/public") | ||
|
||
# import extensions | ||
require './extensions' | ||
# import configuration | ||
require './settings' | ||
|
||
# import sub applications | ||
mate.use '/base', require './base' | ||
mate.use '/posts', require './posts' | ||
mate.use '/comments', require './comments' | ||
mate.sub '/base', -> require './base' | ||
mate.sub '/posts', -> require './posts' | ||
mate.sub '/comments', -> require './comments' | ||
|
||
# redirect root | ||
mate.get '/', -> @redirect '/base' | ||
|
||
# start the engines | ||
mate.listen 3000 | ||
mate.listen 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
mate = require('../../../lib/coffeemate').newInstance() | ||
mate = require '../../../lib/coffeemate' | ||
|
||
mate.get '/', -> @view 'list' | ||
|
||
module.exports = mate | ||
mate.get '/', -> @render 'posts/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('coffee-script'); | ||
module.exports = require('./index.coffee'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
mate = require '../../lib/coffeemate' | ||
|
||
mate.options.renderDir = 'templates' | ||
mate.options.renderExt = '.html' | ||
|
||
# use some of connect middlewares | ||
mate.logger() | ||
mate.static("#{__dirname}/public") |
2 changes: 1 addition & 1 deletion
2
examples/sandbox/base/views/home.eco → examples/sandbox/templates/base/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<h1>Coffeemate Sandbox</h1> | ||
<a href="/posts">posts</a> | ||
<a href="/posts">posts</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<html> | ||
<head> | ||
<style type="text/css"> | ||
body { | ||
background-color: #ff0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="header"><img src="coffeescript.png" alt="coffeescript" /></div> | ||
<hr /> | ||
<div id="content"> | ||
<%- @include @body %> | ||
</div> | ||
<hr /> | ||
<div id="footer"><a href="/" title="home">home</a></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>Comment List</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<div id="header"><img src="coffeescript.png" alt="coffeescript" /></div> | ||
<hr /> | ||
<div id="content"> | ||
<%- @include @body %> | ||
</div> | ||
<hr /> | ||
<div id="footer"><a href="/" title="home">home</a></div> | ||
</body> | ||
</html> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<%- @include @body %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<%- @include @body %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<h1>this is main template for path: <%= @req.url %></h1> | ||
<div>This is foo: <%= @foo %></div> | ||
<div><%- @include 'nested.eco' %></div> | ||
<div><%- @include 'nested' %></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<h2>this is nested template</h2> | ||
<div>This is foo: <%= @foo %></div> | ||
<div><%- @include 'leaf.eco' %></div> | ||
<div><%- @include 'leaf' %></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.