ramaze 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +52 -19
- data/bin/ramaze +19 -6
- data/doc/CHANGELOG +33 -0
- data/doc/COPYING +1 -1
- data/doc/FAQ +92 -0
- data/doc/GPL +340 -0
- data/doc/INSTALL +34 -0
- data/doc/ProjectInfo +53 -0
- data/doc/README +187 -110
- data/doc/readme_chunks/appendix.txt +13 -0
- data/doc/readme_chunks/examples.txt +38 -0
- data/doc/readme_chunks/features.txt +82 -0
- data/doc/readme_chunks/getting_help.txt +5 -0
- data/doc/readme_chunks/getting_started.txt +18 -0
- data/doc/readme_chunks/installing.txt +41 -0
- data/doc/readme_chunks/introduction.txt +18 -0
- data/doc/readme_chunks/principles.txt +41 -0
- data/doc/readme_chunks/thanks.txt +59 -0
- data/doc/tutorial/todolist.txt +546 -0
- data/examples/blog/main.rb +1 -1
- data/examples/blog/src/controller.rb +13 -11
- data/examples/blog/src/element.rb +11 -6
- data/examples/blog/src/model.rb +8 -23
- data/examples/blog/template/edit.xhtml +3 -1
- data/examples/blog/template/index.xhtml +4 -4
- data/examples/caching.rb +4 -4
- data/examples/element.rb +10 -7
- data/examples/hello.rb +3 -4
- data/examples/simple.rb +5 -3
- data/examples/templates/template/external.amrita +19 -0
- data/examples/templates/template/{external.rmze → external.zmr} +2 -2
- data/examples/templates/template_amrita2.rb +48 -0
- data/examples/templates/template_erubis.rb +5 -2
- data/examples/templates/{template_ramaze.rb → template_ezamar.rb} +13 -7
- data/examples/templates/template_haml.rb +4 -1
- data/examples/templates/template_liquid.rb +2 -1
- data/examples/templates/template_markaby.rb +2 -1
- data/examples/todolist/conf/benchmark.yaml +35 -0
- data/examples/todolist/conf/debug.yaml +34 -0
- data/examples/todolist/conf/live.yaml +33 -0
- data/examples/todolist/conf/silent.yaml +31 -0
- data/examples/todolist/conf/stage.yaml +33 -0
- data/examples/todolist/main.rb +18 -0
- data/examples/todolist/public/404.jpg +0 -0
- data/examples/todolist/public/css/coderay.css +105 -0
- data/examples/todolist/public/css/ramaze_error.css +42 -0
- data/{lib/proto → examples/todolist}/public/error.xhtml +0 -0
- data/examples/todolist/public/favicon.ico +0 -0
- data/examples/todolist/public/js/jquery.js +1923 -0
- data/examples/todolist/public/ramaze.png +0 -0
- data/examples/todolist/src/controller/main.rb +56 -0
- data/examples/todolist/src/element/page.rb +26 -0
- data/examples/todolist/src/model.rb +14 -0
- data/examples/todolist/template/index.xhtml +17 -0
- data/examples/todolist/template/new.xhtml +7 -0
- data/examples/todolist/todolist.db +9 -0
- data/examples/whywiki/main.rb +3 -8
- data/examples/whywiki/template/show.xhtml +4 -0
- data/lib/proto/public/error.zmr +77 -0
- data/lib/proto/src/controller/main.rb +2 -1
- data/lib/proto/src/element/page.rb +2 -1
- data/lib/proto/src/model.rb +3 -2
- data/lib/ramaze.rb +7 -9
- data/lib/ramaze/adapter.rb +51 -0
- data/lib/ramaze/adapter/cgi.rb +23 -0
- data/lib/ramaze/adapter/fcgi.rb +22 -0
- data/lib/ramaze/adapter/mongrel.rb +7 -86
- data/lib/ramaze/adapter/webrick.rb +14 -133
- data/lib/ramaze/cache/memcached.rb +6 -0
- data/lib/ramaze/cache/yaml_store.rb +3 -1
- data/lib/ramaze/controller.rb +292 -2
- data/lib/ramaze/dispatcher.rb +85 -213
- data/lib/ramaze/error.rb +10 -0
- data/lib/ramaze/global.rb +8 -0
- data/lib/ramaze/helper/aspect.rb +30 -7
- data/lib/ramaze/helper/auth.rb +16 -9
- data/lib/ramaze/helper/cache.rb +40 -35
- data/lib/ramaze/helper/feed.rb +1 -1
- data/lib/ramaze/helper/flash.rb +34 -0
- data/lib/ramaze/helper/link.rb +8 -2
- data/lib/ramaze/helper/openid.rb +63 -0
- data/lib/ramaze/helper/redirect.rb +12 -11
- data/lib/ramaze/helper/stack.rb +5 -7
- data/lib/ramaze/inform.rb +12 -1
- data/lib/ramaze/snippets/kernel/aquire.rb +1 -1
- data/lib/ramaze/snippets/kernel/{self_method.rb → method.rb} +3 -18
- data/lib/ramaze/snippets/kernel/{rescue_require.rb → pretty_inspect.rb} +7 -6
- data/lib/ramaze/snippets/method/name.rb +22 -0
- data/lib/ramaze/snippets/{kernel → ramaze}/autoreload.rb +0 -0
- data/lib/ramaze/snippets/ramaze/caller_info.rb +14 -0
- data/lib/ramaze/snippets/{kernel → ramaze}/caller_lines.rb +3 -10
- data/lib/ramaze/snippets/rdoc/usage_no_exit.rb +49 -23
- data/lib/ramaze/snippets/string/DIVIDE.rb +0 -1
- data/lib/ramaze/store/default.rb +58 -2
- data/lib/ramaze/store/yaml.rb +161 -0
- data/lib/ramaze/template.rb +27 -86
- data/lib/ramaze/template/amrita2.rb +14 -19
- data/lib/ramaze/template/erubis.rb +15 -38
- data/lib/ramaze/template/ezamar.rb +100 -0
- data/lib/ramaze/template/ezamar/element.rb +166 -0
- data/lib/ramaze/template/ezamar/engine.rb +124 -0
- data/lib/ramaze/template/ezamar/morpher.rb +155 -0
- data/lib/ramaze/template/haml.rb +16 -43
- data/lib/ramaze/template/liquid.rb +11 -51
- data/lib/ramaze/template/markaby.rb +44 -42
- data/lib/ramaze/tool/mime.rb +18 -0
- data/lib/ramaze/tool/mime_types.yaml +615 -0
- data/lib/ramaze/trinity/request.rb +20 -196
- data/lib/ramaze/trinity/response.rb +4 -33
- data/lib/ramaze/trinity/session.rb +150 -72
- data/lib/ramaze/version.rb +1 -1
- data/spec/adapter_spec.rb +20 -0
- data/spec/public/favicon.ico +0 -0
- data/spec/public/ramaze.png +0 -0
- data/spec/public/test_download.css +141 -0
- data/spec/{tc_request.rb → request_tc_helper.rb} +45 -21
- data/spec/spec_all.rb +77 -34
- data/spec/spec_helper.rb +8 -157
- data/spec/spec_helper_context.rb +72 -0
- data/spec/spec_helper_requester.rb +52 -0
- data/spec/spec_helper_simple_http.rb +433 -0
- data/spec/tc_adapter_mongrel.rb +3 -15
- data/spec/tc_adapter_webrick.rb +4 -14
- data/spec/tc_cache.rb +3 -5
- data/spec/tc_controller.rb +22 -12
- data/spec/tc_dependencies.rb +13 -0
- data/spec/tc_element.rb +8 -7
- data/spec/tc_error.rb +13 -7
- data/spec/tc_global.rb +16 -18
- data/spec/tc_helper_aspect.rb +2 -4
- data/spec/tc_helper_auth.rb +15 -14
- data/spec/tc_helper_cache.rb +5 -7
- data/spec/tc_helper_feed.rb +0 -2
- data/spec/tc_helper_flash.rb +103 -0
- data/spec/tc_helper_form.rb +4 -6
- data/spec/tc_helper_link.rb +1 -3
- data/spec/tc_helper_redirect.rb +23 -8
- data/spec/tc_helper_stack.rb +31 -15
- data/spec/tc_morpher.rb +1 -3
- data/spec/tc_params.rb +48 -7
- data/spec/tc_request_mongrel.rb +9 -0
- data/spec/tc_request_webrick.rb +5 -0
- data/spec/tc_session.rb +41 -25
- data/spec/tc_store.rb +55 -6
- data/spec/tc_store_yaml.rb +71 -0
- data/spec/tc_template_amrita2.rb +3 -3
- data/spec/tc_template_erubis.rb +2 -3
- data/spec/{tc_template_ramaze.rb → tc_template_ezamar.rb} +15 -5
- data/spec/tc_template_haml.rb +4 -3
- data/spec/tc_template_liquid.rb +3 -4
- data/spec/tc_template_markaby.rb +4 -6
- data/spec/tc_tidy.rb +1 -3
- data/spec/template/amrita2/{data.html → data.amrita} +0 -0
- data/spec/template/amrita2/{index.html → index.amrita} +0 -0
- data/spec/template/amrita2/{sum.html → sum.amrita} +0 -0
- data/spec/template/ezamar/another/long/action.zmr +1 -0
- data/spec/template/ezamar/combined.zmr +1 -0
- data/spec/template/{ramaze/file_only.rmze → ezamar/file_only.zmr} +0 -0
- data/spec/template/{ramaze/index.rmze → ezamar/index.zmr} +0 -0
- data/spec/template/{ramaze/nested.rmze → ezamar/nested.zmr} +0 -0
- data/spec/template/ezamar/some__long__action.zmr +1 -0
- data/spec/template/{ramaze/sum.rmze → ezamar/sum.zmr} +0 -0
- metadata +181 -123
- data/doc/allison/LICENSE +0 -184
- data/doc/allison/README +0 -37
- data/doc/allison/allison.css +0 -300
- 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 -322
- data/doc/allison/cache/URL +0 -1
- data/doc/changes.txt +0 -2021
- data/doc/changes.xml +0 -2024
- data/lib/ramaze/snippets/kernel/silently.rb +0 -13
- data/lib/ramaze/snippets/thread/deadQUESTIONMARK.rb +0 -11
- data/lib/ramaze/template/haml/actionview_stub.rb +0 -20
- data/lib/ramaze/template/ramaze.rb +0 -177
- data/lib/ramaze/template/ramaze/element.rb +0 -166
- data/lib/ramaze/template/ramaze/morpher.rb +0 -156
- data/spec/tc_test.rb +0 -17
data/examples/blog/main.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
|
-
class MainController <
|
4
|
+
class MainController < Controller
|
5
5
|
helper :form, :auth, :aspect
|
6
6
|
|
7
|
+
trait :auth_table => {'manveru' => Digest::SHA1.hexdigest('password')}
|
8
|
+
|
7
9
|
def index
|
8
10
|
@title = 'Ramaze Blog'
|
9
|
-
@entries = Entry.
|
11
|
+
@entries = Entry.keys.reverse.map{|k| Entry[k]}
|
10
12
|
end
|
11
13
|
|
12
|
-
def view
|
13
|
-
@entry = Entry[
|
14
|
+
def view eid
|
15
|
+
@entry = Entry[eid]
|
14
16
|
end
|
15
17
|
|
16
18
|
def new
|
@@ -18,25 +20,25 @@ class MainController < Template::Ramaze
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def add
|
21
|
-
entry = Entry.new.
|
23
|
+
entry = Entry.new.merge!(request.params)
|
22
24
|
entry.time = Time.now
|
23
25
|
session[:result] = "#{entry.title} added successfully" if entry.save
|
24
26
|
redirect :/
|
25
27
|
end
|
26
28
|
|
27
|
-
def edit
|
28
|
-
@entry = Entry[
|
29
|
+
def edit eid
|
30
|
+
@entry = Entry[eid]
|
29
31
|
end
|
30
32
|
|
31
33
|
def save
|
32
|
-
redirect_referer unless
|
33
|
-
entry = Entry[
|
34
|
+
redirect_referer unless eid = request.params.delete('eid')
|
35
|
+
entry = Entry[eid].merge!(request.params)
|
34
36
|
session[:result] = "#{entry.title} saved successfully" if entry.save
|
35
37
|
redirect :/
|
36
38
|
end
|
37
39
|
|
38
|
-
def delete
|
39
|
-
if entry = Entry[
|
40
|
+
def delete eid
|
41
|
+
if entry = Entry[eid]
|
40
42
|
if entry.delete
|
41
43
|
session[:result] = "#{entry.title} deleted successfully"
|
42
44
|
else
|
@@ -1,8 +1,13 @@
|
|
1
|
-
class Page <
|
2
|
-
|
1
|
+
class Page < Controller
|
2
|
+
attr_accessor :content
|
3
3
|
helper :auth
|
4
4
|
|
5
|
+
def initialize content
|
6
|
+
@content = content
|
7
|
+
end
|
8
|
+
|
5
9
|
def render
|
10
|
+
p :render => content
|
6
11
|
%{
|
7
12
|
<html>
|
8
13
|
<head>
|
@@ -24,7 +29,7 @@ class Page < Element
|
|
24
29
|
<span id="title">
|
25
30
|
<a href="#{R :/}">#{@title || 'Blogging Ramaze'}</a>
|
26
31
|
</span>
|
27
|
-
<?r if
|
32
|
+
<?r if logged_in? ?>
|
28
33
|
<span id="login"> #{link R(:logout), :title => 'logout'} </span>
|
29
34
|
<?r else ?>
|
30
35
|
<span id="login"> #{link R(:login), :title => 'login'} </span>
|
@@ -35,13 +40,13 @@ class Page < Element
|
|
35
40
|
|
36
41
|
def sidebar
|
37
42
|
entries =
|
38
|
-
Entry.all.map do |e|
|
43
|
+
Entry.all.map do |eid, e|
|
39
44
|
%{
|
40
45
|
<div>
|
41
|
-
#{link R(:/, :view,
|
46
|
+
#{link R(:/, :view, eid), :title => e.title}
|
42
47
|
</div>
|
43
48
|
}
|
44
|
-
|
49
|
+
end
|
45
50
|
|
46
51
|
%{
|
47
52
|
<div id="sidebar">
|
data/examples/blog/src/model.rb
CHANGED
@@ -1,29 +1,14 @@
|
|
1
1
|
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
|
-
|
5
|
-
require 'rubygems'
|
6
|
-
gem 'facets', '=1.4.5'
|
7
|
-
require '/home/manveru/prog/projects/nitroproject/glycerin'
|
8
|
-
rescue LoadError
|
9
|
-
end
|
10
|
-
|
11
|
-
require 'og'
|
4
|
+
require 'ramaze/store/yaml'
|
12
5
|
|
13
|
-
|
14
|
-
attr_accessor :text, String
|
15
|
-
attr_accessor :time, Time
|
16
|
-
attr_accessor :author_name, String
|
17
|
-
attr_accessor :author_email, String
|
18
|
-
end
|
19
|
-
|
20
|
-
class Entry
|
21
|
-
attr_accessor :title, String
|
22
|
-
attr_accessor :text, String, :control => :textarea
|
23
|
-
attr_accessor :time, Time
|
24
|
-
has_many Comment
|
25
|
-
end
|
6
|
+
Entry = Ramaze::Store::YAML.new :entry
|
26
7
|
|
27
|
-
|
28
|
-
|
8
|
+
if Entry.empty?
|
9
|
+
entry = Entry.new
|
10
|
+
entry.time = Time.now
|
11
|
+
entry.title = 'Nothing special'
|
12
|
+
entry.text = 'even less special'
|
13
|
+
entry.save
|
29
14
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<Page>
|
2
2
|
<form method="POST" action="#{R self, :save}">
|
3
3
|
<input type="hidden" name="oid" value="#{@entry.oid}" />
|
4
|
-
#{
|
4
|
+
<input type="text" name="title" value="#{@entry.title}" />
|
5
|
+
<textarea name="text">#{@entry.text}</textarea>
|
6
|
+
<input type="submit" />
|
5
7
|
</form>
|
6
8
|
</Page>
|
@@ -12,13 +12,13 @@
|
|
12
12
|
#{BlueCloth.new(entry.text.to_s).to_html}
|
13
13
|
</div>
|
14
14
|
<div class="menu">
|
15
|
-
<?r if
|
16
|
-
#{link self, :delete, entry.
|
17
|
-
#{link self, :edit, entry.
|
15
|
+
<?r if logged_in? ?>
|
16
|
+
#{link self, :delete, entry.eid, :title => 'Delete'}
|
17
|
+
#{link self, :edit, entry.eid, :title => 'Edit'}<br />
|
18
18
|
<?r end ?>
|
19
19
|
Entry #{@entries.size - i}/#{@entries.size}
|
20
20
|
</div>
|
21
21
|
</div>
|
22
22
|
<?r end ?>
|
23
|
-
#{link(self, :new, :title => 'New Entry') if
|
23
|
+
#{link(self, :new, :title => 'New Entry') if logged_in?}
|
24
24
|
</Page>
|
data/examples/caching.rb
CHANGED
@@ -2,9 +2,11 @@ require 'ramaze'
|
|
2
2
|
|
3
3
|
include Ramaze
|
4
4
|
|
5
|
-
class MainController <
|
5
|
+
class MainController < Controller
|
6
6
|
helper :cache
|
7
7
|
|
8
|
+
trait :actions_cached => [:index]
|
9
|
+
|
8
10
|
def index
|
9
11
|
calc = "100_000 ** 100_00"
|
10
12
|
%[
|
@@ -14,10 +16,8 @@ class MainController < Template::Ramaze
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def invalidate
|
17
|
-
|
19
|
+
action_cache.clear
|
18
20
|
end
|
19
|
-
|
20
|
-
cache :index
|
21
21
|
end
|
22
22
|
|
23
23
|
run
|
data/examples/element.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
require 'ramaze'
|
2
2
|
include Ramaze
|
3
3
|
|
4
|
-
class Page <
|
4
|
+
class Page < Ezamar::Element
|
5
5
|
def render
|
6
6
|
%{
|
7
7
|
<html>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
<head>
|
9
|
+
<title>examples/element</title>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>#{@hash['title']}</h1>
|
13
|
+
#{content}
|
14
|
+
</body>
|
12
15
|
</html>
|
13
16
|
}
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
17
|
-
class SideBar <
|
20
|
+
class SideBar < Ezamar::Element
|
18
21
|
def render
|
19
22
|
%{
|
20
23
|
<div class="sidebar">
|
@@ -24,7 +27,7 @@ class SideBar < Template::Ramaze::Element
|
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
27
|
-
class MainController <
|
30
|
+
class MainController < Controller
|
28
31
|
def index
|
29
32
|
%{
|
30
33
|
<Page title="Test">
|
data/examples/hello.rb
CHANGED
@@ -6,18 +6,17 @@ require 'ramaze'
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
8
|
# This is named MainController to automagically map it to '/'
|
9
|
-
# Global.mapping['/']
|
9
|
+
# Global.mapping['/'] = MainController
|
10
10
|
# would do the same thing.
|
11
11
|
# you can access it now with http://localhost:7000/
|
12
12
|
# This should output
|
13
13
|
# Hello, World!
|
14
14
|
# in your browser
|
15
15
|
|
16
|
-
class MainController <
|
16
|
+
class MainController < Controller
|
17
17
|
def index
|
18
18
|
"Hello, World!"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
# start
|
22
|
+
start
|
data/examples/simple.rb
CHANGED
@@ -22,7 +22,7 @@ require 'ramaze'
|
|
22
22
|
|
23
23
|
include Ramaze
|
24
24
|
|
25
|
-
class SimpleController <
|
25
|
+
class SimpleController < Controller
|
26
26
|
def index
|
27
27
|
"simple"
|
28
28
|
end
|
@@ -48,13 +48,15 @@ class SimpleController < Template::Ramaze
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
class OtherController <
|
51
|
+
class OtherController < Controller
|
52
52
|
def index
|
53
53
|
"Hello, World from #{self.class.name}"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
Global.mapping
|
57
|
+
Global.mapping = {
|
58
58
|
'/' => SimpleController,
|
59
59
|
'/other' => OtherController
|
60
60
|
}
|
61
|
+
|
62
|
+
start
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Template::Amrita2 external</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<h1 id="title">Title</h1>
|
7
|
+
<a id="link_home">Home</a>
|
8
|
+
<p>
|
9
|
+
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
10
|
+
<a id="link_one"></a><br />
|
11
|
+
<a id="link_two"></a><br />
|
12
|
+
<a id="link_three"></a>
|
13
|
+
</p>
|
14
|
+
<div id="args">
|
15
|
+
*args
|
16
|
+
</div>
|
17
|
+
<div id="inspect_parameters"></div>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<title>Template::
|
3
|
+
<title>Template::Ezamar external</title>
|
4
4
|
</head>
|
5
5
|
<body>
|
6
|
-
<h1>The #{@action} Template for
|
6
|
+
<h1>The #{@action} Template for Ezamar</h1>
|
7
7
|
#{link :/, :title => 'Home'}
|
8
8
|
<p>
|
9
9
|
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'ramaze'
|
5
|
+
|
6
|
+
include Ramaze
|
7
|
+
|
8
|
+
# TODO:
|
9
|
+
# implement the amrita2 example, man, this engine is awkward :P
|
10
|
+
|
11
|
+
class MainController < Controller
|
12
|
+
|
13
|
+
trait :engine => Template::Amrita2
|
14
|
+
|
15
|
+
def index
|
16
|
+
%{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
|
17
|
+
end
|
18
|
+
|
19
|
+
def title
|
20
|
+
"The #{@action} Template for Ramaze"
|
21
|
+
end
|
22
|
+
|
23
|
+
def link_home
|
24
|
+
link :/, :title => 'Home'
|
25
|
+
end
|
26
|
+
|
27
|
+
def link_one
|
28
|
+
link self, @action, :one, :title => "#@action/one"
|
29
|
+
end
|
30
|
+
|
31
|
+
def link_two
|
32
|
+
link self, @action, :one, :two, :three, :title => "#@action/one/two/three"
|
33
|
+
end
|
34
|
+
|
35
|
+
def link_three
|
36
|
+
link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar"
|
37
|
+
end
|
38
|
+
|
39
|
+
def inspect_parameters
|
40
|
+
request.params.inspect
|
41
|
+
end
|
42
|
+
|
43
|
+
def args
|
44
|
+
@params.map{|arg| "<span>#{arg}</span>"}.join(' ')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
start
|
@@ -5,7 +5,10 @@ require 'ramaze'
|
|
5
5
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
|
-
class MainController <
|
8
|
+
class MainController < Controller
|
9
|
+
|
10
|
+
trait :engine => Template::Erubis
|
11
|
+
|
9
12
|
def index
|
10
13
|
%{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
|
11
14
|
end
|
@@ -15,7 +18,7 @@ class MainController < Template::Erubis
|
|
15
18
|
transform %q{
|
16
19
|
<html>
|
17
20
|
<head>
|
18
|
-
<title>Template::
|
21
|
+
<title>Template::Erubis internal</title>
|
19
22
|
</head>
|
20
23
|
<body>
|
21
24
|
<h1>The <%= @action %> Template</h1>
|
@@ -5,25 +5,29 @@ require 'ramaze'
|
|
5
5
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
|
-
class MainController <
|
8
|
+
class MainController < Controller
|
9
|
+
|
10
|
+
helper :link
|
11
|
+
|
9
12
|
def index
|
10
13
|
%{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
|
11
14
|
end
|
12
15
|
|
13
16
|
def internal *args
|
14
17
|
@args = args
|
15
|
-
|
18
|
+
%q{
|
16
19
|
<html>
|
17
20
|
<head>
|
18
|
-
<title>Template::
|
21
|
+
<title>Template::Ezamar internal</title>
|
19
22
|
</head>
|
20
23
|
<body>
|
21
|
-
<h1>The #{@action} Template</h1>
|
24
|
+
<h1>The #{@action} Template for Ezamar</h1>
|
25
|
+
#{link :/, :title => 'Home'}
|
22
26
|
<p>
|
23
27
|
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
24
|
-
#{link self, @action, :one, :title =>
|
25
|
-
#{link self, @action, :one, :two, :three, :title =>
|
26
|
-
#{link self, @action, :one, :foo => :bar, :title =>
|
28
|
+
#{link self, @action, :one, :title => "#@action/one"}<br />
|
29
|
+
#{link self, @action, :one, :two, :three, :title => "#@action/one/two/three"}<br />
|
30
|
+
#{link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar"}<br />
|
27
31
|
</p>
|
28
32
|
<div>
|
29
33
|
The arguments you have passed to this action are:
|
@@ -47,3 +51,5 @@ class MainController < Template::Ramaze
|
|
47
51
|
@args = args
|
48
52
|
end
|
49
53
|
end
|
54
|
+
|
55
|
+
run
|
@@ -5,7 +5,10 @@ require 'ramaze'
|
|
5
5
|
|
6
6
|
include Ramaze
|
7
7
|
|
8
|
-
class MainController <
|
8
|
+
class MainController < Controller
|
9
|
+
|
10
|
+
trait :engine => Template::Haml
|
11
|
+
|
9
12
|
def index
|
10
13
|
%{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
|
11
14
|
end
|