ramaze 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -12
- data/bin/ramaze +95 -171
- data/doc/CHANGELOG +387 -4
- data/doc/README +81 -13
- data/doc/meta/announcement.txt +51 -8
- data/doc/meta/configuration.txt +17 -34
- data/doc/meta/internals.txt +34 -4
- data/doc/migrate/1110_to_1111.txt +131 -0
- data/doc/readme_chunks/features.txt +81 -12
- data/doc/readme_chunks/installing.txt +0 -1
- data/doc/tutorial/todolist.html +293 -65
- data/doc/tutorial/{todolist.txt → todolist.mkd} +251 -51
- data/examples/blog/main.rb +1 -1
- data/examples/blog/src/model.rb +0 -1
- data/examples/hello.rb +2 -5
- data/examples/templates/template/external.haml +5 -5
- data/examples/templates/template/external.liquid +1 -1
- data/examples/templates/template/external.mab +8 -8
- data/examples/templates/template/external.rem +30 -0
- data/examples/templates/template/external.rhtml +6 -7
- data/examples/templates/template/external.zmr +13 -9
- data/examples/templates/template_amrita2.rb +8 -8
- data/examples/templates/template_erubis.rb +11 -11
- data/examples/templates/template_ezamar.rb +9 -11
- data/examples/templates/template_haml.rb +13 -13
- data/examples/templates/template_liquid.rb +10 -10
- data/examples/templates/template_markaby.rb +13 -10
- data/examples/templates/template_remarkably.rb +59 -0
- data/examples/todolist/main.rb +1 -7
- data/examples/todolist/src/controller/main.rb +26 -13
- data/examples/todolist/src/element/page.rb +5 -0
- data/examples/whywiki/main.rb +1 -1
- data/lib/proto/main.rb +0 -8
- data/lib/proto/public/css/ramaze_error.css +12 -4
- data/lib/proto/public/error.zmr +6 -25
- data/lib/ramaze.rb +35 -245
- data/lib/ramaze/action.rb +21 -0
- data/lib/ramaze/adapter.rb +94 -29
- data/lib/ramaze/adapter/base.rb +57 -0
- data/lib/ramaze/adapter/mongrel.rb +12 -19
- data/lib/ramaze/adapter/webrick.rb +21 -20
- data/lib/ramaze/cache.rb +47 -3
- data/lib/ramaze/cache/memcached.rb +22 -0
- data/lib/ramaze/cache/yaml_store.rb +19 -0
- data/lib/ramaze/controller.rb +47 -271
- data/lib/ramaze/controller/error.rb +43 -0
- data/lib/ramaze/controller/render.rb +90 -0
- data/lib/ramaze/controller/resolve.rb +147 -0
- data/lib/ramaze/dispatcher.rb +41 -9
- data/lib/ramaze/dispatcher/file.rb +1 -1
- data/lib/ramaze/global.rb +73 -158
- data/lib/ramaze/global/dsl.rb +29 -0
- data/lib/ramaze/global/globalstruct.rb +90 -0
- data/lib/ramaze/helper.rb +1 -1
- data/lib/ramaze/helper/aspect.rb +39 -179
- data/lib/ramaze/helper/cache.rb +8 -9
- data/lib/ramaze/helper/cgi.rb +23 -0
- data/lib/ramaze/helper/file.rb +3 -0
- data/lib/ramaze/helper/inform.rb +3 -0
- data/lib/ramaze/helper/link.rb +56 -63
- data/lib/ramaze/helper/nitroform.rb +4 -0
- data/lib/ramaze/helper/redirect.rb +1 -1
- data/lib/ramaze/inform.rb +6 -2
- data/lib/ramaze/inform/analogger.rb +5 -1
- data/lib/ramaze/inform/hub.rb +1 -1
- data/lib/ramaze/inform/informing.rb +7 -0
- data/lib/ramaze/snippets/kernel/aquire.rb +2 -0
- data/lib/ramaze/snippets/kernel/constant.rb +2 -0
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +2 -0
- data/lib/ramaze/snippets/object/traits.rb +4 -0
- data/lib/ramaze/snippets/openstruct/temp.rb +3 -0
- data/lib/ramaze/snippets/string/DIVIDE.rb +2 -0
- data/lib/ramaze/snippets/string/camel_case.rb +2 -0
- data/lib/ramaze/snippets/string/color.rb +2 -0
- data/lib/ramaze/snippets/string/each.rb +2 -0
- data/lib/ramaze/snippets/string/snake_case.rb +3 -0
- data/lib/ramaze/snippets/struct/fill.rb +8 -2
- data/lib/ramaze/snippets/struct/values_at.rb +16 -0
- data/lib/ramaze/snippets/symbol/to_proc.rb +3 -0
- data/lib/ramaze/sourcereload.rb +89 -0
- data/lib/ramaze/template.rb +21 -12
- data/lib/ramaze/template/amrita2.rb +6 -6
- data/lib/ramaze/template/erubis.rb +4 -9
- data/lib/ramaze/template/ezamar.rb +13 -57
- data/lib/ramaze/template/ezamar/element.rb +10 -12
- data/lib/ramaze/template/ezamar/engine.rb +40 -101
- data/lib/ramaze/template/ezamar/morpher.rb +3 -3
- data/lib/ramaze/template/haml.rb +3 -6
- data/lib/ramaze/template/liquid.rb +4 -9
- data/lib/ramaze/template/markaby.rb +16 -22
- data/lib/ramaze/template/remarkably.rb +28 -0
- data/lib/ramaze/tool/mime.rb +2 -0
- data/lib/ramaze/tool/record.rb +6 -0
- data/lib/ramaze/trinity/request.rb +44 -54
- data/lib/ramaze/trinity/response.rb +1 -1
- data/lib/ramaze/trinity/session.rb +15 -37
- data/lib/ramaze/version.rb +1 -1
- data/rake_tasks/gem.rake +2 -2
- data/rake_tasks/maintaince.rake +42 -1
- data/rake_tasks/spec.rake +45 -0
- data/spec/examples/caching.rb +1 -1
- data/spec/examples/simple.rb +1 -1
- data/spec/examples/templates/template_amrita2.rb +1 -0
- data/spec/examples/templates/template_erubis.rb +2 -1
- data/spec/examples/templates/template_ezamar.rb +1 -1
- data/spec/examples/templates/template_haml.rb +2 -1
- data/spec/examples/templates/template_liquid.rb +2 -1
- data/spec/examples/templates/template_markaby.rb +2 -1
- data/spec/examples/templates/template_remarkably.rb +22 -0
- data/spec/examples/todolist.rb +125 -0
- data/spec/helper.rb +2 -23
- data/spec/helper/minimal.rb +20 -0
- data/spec/helper/mock_http.rb +24 -30
- data/spec/helper/simple_http.rb +2 -2
- data/spec/helper/wrap.rb +6 -9
- data/spec/ramaze/adapter.rb +1 -1
- data/spec/ramaze/adapter/record.rb +31 -0
- data/spec/ramaze/cache.rb +41 -54
- data/spec/ramaze/controller.rb +121 -137
- data/spec/ramaze/controller/template/list.xhtml +1 -0
- data/spec/ramaze/controller/template/other/greet/other.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +27 -3
- data/spec/ramaze/element.rb +11 -7
- data/spec/ramaze/error.rb +1 -1
- data/spec/ramaze/gestalt.rb +2 -0
- data/spec/ramaze/helper/aspect.rb +30 -21
- data/spec/ramaze/helper/auth.rb +1 -1
- data/spec/ramaze/helper/cache.rb +2 -1
- data/spec/ramaze/helper/form.rb +14 -11
- data/spec/ramaze/helper/link.rb +18 -41
- data/spec/ramaze/localize.rb +29 -2
- data/spec/ramaze/morpher.rb +23 -12
- data/spec/ramaze/params.rb +46 -24
- data/spec/ramaze/request.rb +6 -2
- data/spec/ramaze/store/yaml.rb +5 -0
- data/spec/ramaze/template.rb +22 -27
- data/spec/ramaze/template/amrita2.rb +1 -2
- data/spec/ramaze/template/erubis.rb +1 -1
- data/spec/ramaze/template/ezamar.rb +1 -2
- data/spec/ramaze/template/haml.rb +2 -2
- data/spec/ramaze/template/haml/with_vars.haml +1 -1
- data/spec/ramaze/template/liquid.rb +1 -1
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/remarkably.rb +56 -0
- data/spec/ramaze/template/remarkably/external.rem +8 -0
- data/spec/ramaze/template/remarkably/sum.rem +1 -0
- metadata +38 -63
- data/doc/README.html +0 -637
- data/doc/allison/LICENSE +0 -184
- data/doc/allison/README +0 -37
- data/doc/allison/allison.css +0 -299
- data/doc/allison/allison.gif +0 -0
- data/doc/allison/allison.js +0 -307
- data/doc/allison/allison.rb +0 -287
- data/doc/allison/cache/BODY +0 -588
- data/doc/allison/cache/CLASS_INDEX +0 -4
- data/doc/allison/cache/CLASS_PAGE +0 -1
- data/doc/allison/cache/FILE_INDEX +0 -4
- data/doc/allison/cache/FILE_PAGE +0 -1
- data/doc/allison/cache/FONTS +0 -1
- data/doc/allison/cache/FR_INDEX_BODY +0 -1
- data/doc/allison/cache/IMGPATH +0 -1
- data/doc/allison/cache/INDEX +0 -1
- data/doc/allison/cache/JAVASCRIPT +0 -307
- data/doc/allison/cache/METHOD_INDEX +0 -4
- data/doc/allison/cache/METHOD_LIST +0 -1
- data/doc/allison/cache/SRC_PAGE +0 -1
- data/doc/allison/cache/STYLE +0 -321
- data/doc/allison/cache/URL +0 -1
- data/doc/changes.txt +0 -3375
- data/doc/changes.xml +0 -3378
- data/examples/todolist/conf/benchmark.yaml +0 -35
- data/examples/todolist/conf/debug.yaml +0 -34
- data/examples/todolist/conf/live.yaml +0 -33
- data/examples/todolist/conf/silent.yaml +0 -31
- data/examples/todolist/conf/stage.yaml +0 -33
- data/examples/todolist/public/css/coderay.css +0 -105
- data/examples/todolist/public/css/ramaze_error.css +0 -42
- data/lib/proto/conf/benchmark.yaml +0 -21
- data/lib/proto/conf/debug.yaml +0 -21
- data/lib/proto/conf/live.yaml +0 -21
- data/lib/proto/conf/silent.yaml +0 -21
- data/lib/proto/conf/stage.yaml +0 -21
- data/lib/proto/public/css/coderay.css +0 -105
- data/lib/ramaze/http_status.rb +0 -66
- data/lib/ramaze/snippets/hash/keys_to_sym.rb +0 -19
- data/lib/ramaze/snippets/kernel/method.rb +0 -26
- data/lib/ramaze/snippets/method/name.rb +0 -22
- data/lib/ramaze/snippets/ramaze/autoreload.rb +0 -135
- data/lib/ramaze/snippets/rdoc/usage_no_exit.rb +0 -65
- data/spec/all.rb +0 -32
- data/spec/ramaze/conf/locale_de.yaml +0 -6
- data/spec/ramaze/conf/locale_en.yaml +0 -6
- data/spec/ramaze/dependencies.rb +0 -16
- data/spec/ramaze/global.rb +0 -44
data/examples/blog/main.rb
CHANGED
data/examples/blog/src/model.rb
CHANGED
data/examples/hello.rb
CHANGED
@@ -3,18 +3,15 @@
|
|
3
3
|
|
4
4
|
require 'ramaze'
|
5
5
|
|
6
|
-
# This is named MainController to automagically map it to '/'
|
7
|
-
# Global.mapping['/'] = MainController
|
8
|
-
# would do the same thing.
|
9
6
|
# you can access it now with http://localhost:7000/
|
10
7
|
# This should output
|
11
8
|
# Hello, World!
|
12
9
|
# in your browser
|
13
10
|
|
14
11
|
class MainController < Ramaze::Controller
|
15
|
-
map '/'
|
16
|
-
|
17
12
|
def index
|
18
13
|
"Hello, World!"
|
19
14
|
end
|
20
15
|
end
|
16
|
+
|
17
|
+
Ramaze.start
|
@@ -1,17 +1,17 @@
|
|
1
1
|
%html
|
2
2
|
%head
|
3
|
-
%title Template::Haml
|
3
|
+
%title= "Template::Haml #@place"
|
4
4
|
%body
|
5
5
|
%h1= @title
|
6
|
-
=
|
6
|
+
= A('Home', :href => :/)
|
7
7
|
%p
|
8
8
|
Here you can pass some stuff if you like, parameters are just passed like this:
|
9
9
|
%br/
|
10
|
-
=
|
10
|
+
= A("#@place/one")
|
11
11
|
%br/
|
12
|
-
=
|
12
|
+
= A("#@place/one/two/three")
|
13
13
|
%br/
|
14
|
-
=
|
14
|
+
= A("#@place/one?foo=bar")
|
15
15
|
%div
|
16
16
|
The arguments you have passed to this action are:
|
17
17
|
- if @args.empty?
|
@@ -1,24 +1,24 @@
|
|
1
1
|
html do
|
2
2
|
head do
|
3
|
-
title "Template::Markaby
|
3
|
+
title "Template::Markaby #@place"
|
4
4
|
end
|
5
5
|
body do
|
6
|
-
h1 "The
|
7
|
-
a("Home", :href => R(
|
6
|
+
h1 "The #@place Template for Markaby"
|
7
|
+
a("Home", :href => R(@this))
|
8
8
|
p do
|
9
9
|
text "Here you can pass some stuff if you like, parameters are just passed like this:"
|
10
10
|
br
|
11
|
-
a("
|
11
|
+
a("#@place/one", :href => R(@this, @place, :one))
|
12
12
|
br
|
13
|
-
a("
|
13
|
+
a("#@place/one/two/three", :href => R(@this, @place, :one, :two, :three))
|
14
14
|
br
|
15
|
-
a("
|
15
|
+
a("#@place/one?foo=bar", :href => R(@this, @place, :one, :foo => :bar))
|
16
16
|
br
|
17
17
|
end
|
18
18
|
div do
|
19
|
-
text "The arguments you have passed to this action are:"
|
19
|
+
text "The arguments you have passed to this action are:"
|
20
20
|
if @args.empty?
|
21
|
-
"none"
|
21
|
+
text "none"
|
22
22
|
else
|
23
23
|
args.each do |arg|
|
24
24
|
span arg
|
@@ -0,0 +1,30 @@
|
|
1
|
+
html do
|
2
|
+
head do
|
3
|
+
title "Template::Remarkably #@place"
|
4
|
+
end
|
5
|
+
body do
|
6
|
+
h1 "The #@place Template for Remarkably"
|
7
|
+
a("Home", :href => R(@place))
|
8
|
+
P do
|
9
|
+
text "Here you can pass some stuff if you like, parameters are just passed like this:"
|
10
|
+
br
|
11
|
+
a("#@place/one", :href => Rs( @place, :one))
|
12
|
+
br
|
13
|
+
a("#@place/one/two/three", :href => Rs( @place, :one, :two, :three))
|
14
|
+
br
|
15
|
+
a("#@place/one?foo=bar", :href => Rs( @place, :one, :foo => :bar))
|
16
|
+
br
|
17
|
+
end
|
18
|
+
div do
|
19
|
+
text "The arguments you have passed to this action are:"
|
20
|
+
if @args.empty?
|
21
|
+
text "none"
|
22
|
+
else
|
23
|
+
args.each do |arg|
|
24
|
+
span arg
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
div @request.params.inspect
|
29
|
+
end
|
30
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<title>Template::Erubis
|
3
|
+
<title>Template::Erubis internal</title>
|
4
4
|
</head>
|
5
5
|
<body>
|
6
|
-
<h1>The
|
7
|
-
<%=
|
6
|
+
<h1>The internal Template for Erubis</h1>
|
7
|
+
<%= A('Home', :href => :/) %>
|
8
8
|
<p>
|
9
9
|
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
10
|
-
<%=
|
11
|
-
<%=
|
12
|
-
<%=
|
10
|
+
<%= A("/#@place/one") %><br />
|
11
|
+
<%= A("#@place/two/three") %><br />
|
12
|
+
<%= A("#@place/one?foo=bar") %><br />
|
13
13
|
</p>
|
14
14
|
<div>
|
15
15
|
The arguments you have passed to this action are:
|
@@ -26,4 +26,3 @@
|
|
26
26
|
</div>
|
27
27
|
</body>
|
28
28
|
</html>
|
29
|
-
|
@@ -1,20 +1,24 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<title>Template::Ezamar
|
3
|
+
<title>Template::Ezamar internal</title>
|
4
4
|
</head>
|
5
5
|
<body>
|
6
|
-
<h1>The
|
7
|
-
#{
|
6
|
+
<h1>The internal Template for Ezamar</h1>
|
7
|
+
#{A 'Home', :href => :/}
|
8
8
|
<p>
|
9
9
|
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
10
|
-
#{
|
11
|
-
#{
|
12
|
-
#{
|
10
|
+
#{A("internal/one")}<br />
|
11
|
+
#{A("internal/one/two/three")}<br />
|
12
|
+
#{A("internal/one?foo=bar")}<br />
|
13
13
|
</p>
|
14
14
|
<div>
|
15
|
-
|
16
|
-
<?r @args.
|
17
|
-
|
15
|
+
The arguments you have passed to this action are:
|
16
|
+
<?r if @args.empty? ?>
|
17
|
+
none
|
18
|
+
<?r else ?>
|
19
|
+
<?r @args.each do |arg| ?>
|
20
|
+
<span>#{arg}</span>
|
21
|
+
<?r end ?>
|
18
22
|
<?r end ?>
|
19
23
|
</div>
|
20
24
|
<div>
|
@@ -6,34 +6,34 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
# TODO:
|
9
|
-
# implement the amrita2 example, man, this engine is awkward :P
|
9
|
+
# - implement the amrita2 example, man, this engine is awkward :P
|
10
10
|
|
11
11
|
class MainController < Controller
|
12
|
-
|
12
|
+
template_root File.expand_path((File.dirname(__FILE__)/'template'))
|
13
13
|
trait :engine => Template::Amrita2
|
14
14
|
|
15
15
|
def index
|
16
|
-
%{ #{Rs()} | #{Rs(:internal)} | #{Rs(:external)} }
|
16
|
+
%{ #{A(Rs())} | #{Rs(:internal)} | #{Rs(:external)} }
|
17
17
|
end
|
18
18
|
|
19
19
|
def title
|
20
|
-
"The
|
20
|
+
"The external Template for Amrita2"
|
21
21
|
end
|
22
22
|
|
23
23
|
def link_home
|
24
|
-
|
24
|
+
A('Home', :href => '/')
|
25
25
|
end
|
26
26
|
|
27
27
|
def link_one
|
28
|
-
|
28
|
+
A('/external/one', :href => Rs(:external, :one))
|
29
29
|
end
|
30
30
|
|
31
31
|
def link_two
|
32
|
-
|
32
|
+
A("/external/one/two/three", :href => Rs(:external, :one, :two, :three))
|
33
33
|
end
|
34
34
|
|
35
35
|
def link_three
|
36
|
-
|
36
|
+
A("/external?foo=bar", :href => Rs(:external, :one, :foo => :bar))
|
37
37
|
end
|
38
38
|
|
39
39
|
def inspect_parameters
|
@@ -3,31 +3,30 @@
|
|
3
3
|
|
4
4
|
require 'ramaze'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
10
|
-
trait :engine => Template::Erubis
|
6
|
+
class MainController < Ramaze::Controller
|
7
|
+
template_root File.expand_path((File.dirname(__FILE__)/'template'))
|
8
|
+
trait :engine => Ramaze::Template::Erubis
|
11
9
|
|
12
10
|
def index
|
13
|
-
%{ #{
|
11
|
+
%{ #{A('Home', :href => :/)} | #{A(:internal)} | #{A(:external)} }
|
14
12
|
end
|
15
13
|
|
16
14
|
def internal *args
|
17
15
|
@args = args
|
16
|
+
@place = :internal
|
18
17
|
%q{
|
19
18
|
<html>
|
20
19
|
<head>
|
21
20
|
<title>Template::Erubis internal</title>
|
22
21
|
</head>
|
23
22
|
<body>
|
24
|
-
<h1>The
|
25
|
-
<%=
|
23
|
+
<h1>The internal Template for Erubis</h1>
|
24
|
+
<%= A('Home', :href => :/) %>
|
26
25
|
<p>
|
27
26
|
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
28
|
-
<%=
|
29
|
-
<%=
|
30
|
-
<%=
|
27
|
+
<%= A("/#@place/one") %><br />
|
28
|
+
<%= A("#@place/two/three") %><br />
|
29
|
+
<%= A("#@place/one?foo=bar") %><br />
|
31
30
|
</p>
|
32
31
|
<div>
|
33
32
|
The arguments you have passed to this action are:
|
@@ -49,5 +48,6 @@ class MainController < Controller
|
|
49
48
|
|
50
49
|
def external *args
|
51
50
|
@args = args
|
51
|
+
@place = :external
|
52
52
|
end
|
53
53
|
end
|
@@ -3,13 +3,11 @@
|
|
3
3
|
|
4
4
|
require 'ramaze'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
class MainController < Controller
|
9
|
-
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
6
|
+
class MainController < Ramaze::Controller
|
7
|
+
template_root File.expand_path((File.dirname(__FILE__)/'template'))
|
10
8
|
|
11
9
|
def index
|
12
|
-
%{ #{
|
10
|
+
%{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
|
13
11
|
end
|
14
12
|
|
15
13
|
def internal *args
|
@@ -20,13 +18,13 @@ class MainController < Controller
|
|
20
18
|
<title>Template::Ezamar internal</title>
|
21
19
|
</head>
|
22
20
|
<body>
|
23
|
-
<h1>The
|
24
|
-
#{
|
21
|
+
<h1>The internal Template for Ezamar</h1>
|
22
|
+
#{A 'Home', :href => :/}
|
25
23
|
<p>
|
26
24
|
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
27
|
-
#{
|
28
|
-
#{
|
29
|
-
#{
|
25
|
+
#{A("internal/one")}<br />
|
26
|
+
#{A("internal/one/two/three")}<br />
|
27
|
+
#{A("internal/one?foo=bar")}<br />
|
30
28
|
</p>
|
31
29
|
<div>
|
32
30
|
The arguments you have passed to this action are:
|
@@ -51,4 +49,4 @@ class MainController < Controller
|
|
51
49
|
end
|
52
50
|
end
|
53
51
|
|
54
|
-
|
52
|
+
Ramaze.start
|
@@ -3,35 +3,34 @@
|
|
3
3
|
|
4
4
|
require 'ramaze'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
|
10
|
-
trait :engine => Template::Haml
|
6
|
+
class MainController < Ramaze::Controller
|
7
|
+
template_root File.expand_path((File.dirname(__FILE__)/'template'))
|
8
|
+
trait :engine => Ramaze::Template::Haml
|
11
9
|
|
12
10
|
def index
|
13
|
-
%{ #{
|
11
|
+
%{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
|
14
12
|
end
|
15
13
|
|
16
14
|
def internal *args
|
17
15
|
@args = args
|
18
|
-
@
|
16
|
+
@place = :internal
|
17
|
+
@title = "The #@place Template for Haml"
|
19
18
|
|
20
19
|
%q{
|
21
20
|
%html
|
22
21
|
%head
|
23
|
-
%title Template::Haml
|
22
|
+
%title= "Template::Haml #@place"
|
24
23
|
%body
|
25
24
|
%h1= @title
|
26
|
-
=
|
25
|
+
= A('Home', :href => :/)
|
27
26
|
%p
|
28
27
|
Here you can pass some stuff if you like, parameters are just passed like this:
|
29
28
|
%br/
|
30
|
-
=
|
29
|
+
= A("#@place/one")
|
31
30
|
%br/
|
32
|
-
=
|
31
|
+
= A("#@place/one/two/three")
|
33
32
|
%br/
|
34
|
-
=
|
33
|
+
= A("#@place/one?foo=bar")
|
35
34
|
%div
|
36
35
|
The arguments you have passed to this action are:
|
37
36
|
- if @args.empty?
|
@@ -44,8 +43,9 @@ class MainController < Controller
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def external *args
|
47
|
-
@title = "The #{@action} Template for Haml"
|
48
46
|
@args = args
|
47
|
+
@place = :external
|
48
|
+
@title = "The #@place Template for Haml"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -6,20 +6,20 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
class MainController < Controller
|
9
|
-
|
9
|
+
template_root File.expand_path((File.dirname(__FILE__)/'template'))
|
10
10
|
trait :engine => Template::Liquid
|
11
11
|
|
12
12
|
def index
|
13
|
-
%{ #{
|
13
|
+
%{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
|
14
14
|
end
|
15
15
|
|
16
|
-
def liquid_hash(*args)
|
16
|
+
def liquid_hash(place, *args)
|
17
17
|
{
|
18
|
-
'header' => "The #{
|
19
|
-
'link_home' =>
|
20
|
-
'link_one' =>
|
21
|
-
'link_two' =>
|
22
|
-
'link_three' =>
|
18
|
+
'header' => "The #{place} Template for Liquid",
|
19
|
+
'link_home' => A('Home', :href => :/),
|
20
|
+
'link_one' => A("#{place}/one"),
|
21
|
+
'link_two' => A("#{place}/one/two/three"),
|
22
|
+
'link_three' => A("#{place}?foo=Bar"),
|
23
23
|
'args' => args,
|
24
24
|
'args_empty' => args.empty?,
|
25
25
|
'params' => request.params.inspect
|
@@ -28,7 +28,7 @@ class MainController < Controller
|
|
28
28
|
|
29
29
|
|
30
30
|
def internal *args
|
31
|
-
@hash = liquid_hash(*args)
|
31
|
+
@hash = liquid_hash(:internal, *args)
|
32
32
|
%q{
|
33
33
|
<html>
|
34
34
|
<head>
|
@@ -62,6 +62,6 @@ class MainController < Controller
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def external *args
|
65
|
-
@hash = liquid_hash(*args)
|
65
|
+
@hash = liquid_hash(:external, *args)
|
66
66
|
end
|
67
67
|
end
|
@@ -6,38 +6,40 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
class MainController < Controller
|
9
|
-
|
9
|
+
template_root File.expand_path((File.dirname(__FILE__)/'template'))
|
10
10
|
trait :engine => Template::Markaby
|
11
11
|
|
12
12
|
helper :markaby
|
13
13
|
|
14
14
|
def index
|
15
|
-
%{ #{
|
15
|
+
%{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
|
16
16
|
end
|
17
17
|
|
18
18
|
def internal *args
|
19
|
-
|
19
|
+
options = {:place => :internal, :action => 'internal',
|
20
|
+
:args => args, :request => request, :this => self}
|
21
|
+
mab options do
|
20
22
|
html do
|
21
23
|
head do
|
22
|
-
title "Template::Markaby
|
24
|
+
title "Template::Markaby #@place"
|
23
25
|
end
|
24
26
|
body do
|
25
|
-
h1 "The
|
26
|
-
a("Home", :href => R(
|
27
|
+
h1 "The #@place Template for Markaby"
|
28
|
+
a("Home", :href => R(@this))
|
27
29
|
p do
|
28
30
|
text "Here you can pass some stuff if you like, parameters are just passed like this:"
|
29
31
|
br
|
30
|
-
a("
|
32
|
+
a("#@place/one", :href => R(@this, @place, :one))
|
31
33
|
br
|
32
|
-
a("
|
34
|
+
a("#@place/one/two/three", :href => R(@this, @place, :one, :two, :three))
|
33
35
|
br
|
34
|
-
a("
|
36
|
+
a("#@place/one?foo=bar", :href => R(@this, @place, :one, :foo => :bar))
|
35
37
|
br
|
36
38
|
end
|
37
39
|
div do
|
38
40
|
text "The arguments you have passed to this action are:"
|
39
41
|
if @args.empty?
|
40
|
-
"none"
|
42
|
+
text "none"
|
41
43
|
else
|
42
44
|
args.each do |arg|
|
43
45
|
span arg
|
@@ -53,6 +55,7 @@ class MainController < Controller
|
|
53
55
|
def external *args
|
54
56
|
@args = args
|
55
57
|
@request = request
|
58
|
+
@place = :external
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|