nitro 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +218 -0
- data/INSTALL +3 -0
- data/README +4 -2
- data/Rakefile +150 -8
- data/benchmark/bench.rb +1 -1
- data/doc/AUTHORS +2 -8
- data/doc/RELEASES +63 -1
- data/examples/ajax/controller.rb +2 -2
- data/examples/ajax/public/index.xhtml +3 -1
- data/examples/ajax/run.rb +3 -3
- data/examples/blog/README +8 -0
- data/examples/blog/cache/entriesadmintrue +3 -0
- data/examples/blog/run.rb +38 -40
- data/examples/blog/src/blog.rb +2 -1
- data/examples/blog/src/controller.rb +40 -20
- data/examples/blog/src/mailer.rb +2 -2
- data/examples/blog/src/models/blog.rb +2 -1
- data/examples/blog/src/models/content.rb +4 -33
- data/examples/blog/src/views/error.xhtml +1 -1
- data/examples/blog/src/xsl/style.xsl +1 -1
- data/examples/blog/test/tc_blog.rb +43 -0
- data/examples/flash/run.rb +2 -2
- data/examples/no_xsl_blog/lib/blog.rb +1 -1
- data/examples/no_xsl_blog/lib/blog/controller.rb +26 -17
- data/examples/no_xsl_blog/lib/blog/model.rb +3 -3
- data/examples/no_xsl_blog/lib/blog/template.rb +1 -1
- data/examples/no_xsl_blog/lib/content.rb +3 -7
- data/examples/no_xsl_blog/run.rb +34 -34
- data/examples/tiny/public/deep/dir/hello.xhtml +2 -0
- data/examples/tiny/run.rb +2 -2
- data/examples/wee_style/run.rb +5 -3
- data/examples/why_wiki/run.rb +5 -3
- data/install.rb +1 -1
- data/lib/nitro.rb +10 -9
- data/lib/nitro/adapters/cgi.rb +27 -2
- data/lib/nitro/adapters/fastcgi.rb +6 -2
- data/lib/nitro/adapters/webrick.rb +11 -9
- data/lib/nitro/buffering.rb +2 -2
- data/lib/nitro/builders/atom.rb +78 -0
- data/lib/nitro/builders/form.rb +2 -2
- data/lib/nitro/builders/rss.rb +4 -4
- data/lib/nitro/builders/table.rb +2 -2
- data/lib/nitro/builders/xhtml.rb +5 -8
- data/lib/nitro/builders/xml.rb +38 -14
- data/lib/nitro/caching.rb +2 -2
- data/lib/nitro/caching/actions.rb +2 -2
- data/lib/nitro/caching/fragments.rb +2 -2
- data/lib/nitro/caching/invalidation.rb +2 -28
- data/lib/nitro/caching/output.rb +3 -3
- data/lib/nitro/caching/stores.rb +4 -4
- data/lib/nitro/conf.rb +11 -6
- data/lib/nitro/context.rb +2 -2
- data/lib/nitro/controller.rb +12 -7
- data/lib/nitro/cookie.rb +2 -2
- data/lib/nitro/dispatcher.rb +33 -40
- data/lib/nitro/environment.rb +1 -1
- data/lib/nitro/localization.rb +5 -7
- data/lib/nitro/mail.rb +2 -2
- data/lib/nitro/markup.rb +5 -5
- data/lib/nitro/output.rb +2 -2
- data/lib/nitro/part.rb +8 -5
- data/lib/nitro/render.rb +46 -45
- data/lib/nitro/request.rb +7 -6
- data/lib/nitro/response.rb +14 -5
- data/lib/nitro/routing.rb +2 -2
- data/lib/nitro/runner.rb +57 -17
- data/lib/nitro/scaffold.rb +14 -8
- data/lib/nitro/session.rb +7 -4
- data/lib/nitro/session/drb.rb +2 -2
- data/lib/nitro/session/drbserver.rb +2 -2
- data/lib/nitro/session/memory.rb +2 -2
- data/lib/nitro/shaders.rb +8 -7
- data/lib/nitro/simple.rb +4 -1
- data/lib/nitro/template.rb +8 -8
- data/lib/nitro/testing.rb +6 -0
- data/lib/nitro/testing/assertions.rb +102 -0
- data/lib/nitro/testing/context.rb +52 -0
- data/lib/nitro/testing/testcase.rb +55 -0
- data/lib/nitro/ui/pager.rb +3 -3
- data/lib/nitro/ui/popup.rb +8 -13
- data/lib/nitro/ui/tabs.rb +4 -10
- data/lib/nitro/uri.rb +7 -7
- data/proto/doc/README +1 -0
- data/proto/public/cgi.rb +5 -0
- data/proto/run.rb +2 -4
- data/test/nitro/adapters/tc_cgi.rb +1 -1
- data/test/nitro/adapters/tc_webrick.rb +1 -2
- data/test/nitro/builders/tc_atom.rb +26 -0
- data/test/nitro/builders/tc_rss.rb +3 -2
- data/test/nitro/builders/tc_table.rb +1 -1
- data/test/nitro/builders/tc_xhtml.rb +4 -3
- data/test/nitro/builders/tc_xml.rb +7 -7
- data/test/nitro/tc_context.rb +1 -1
- data/test/nitro/tc_controller.rb +5 -3
- data/test/nitro/tc_dispatcher.rb +19 -18
- data/test/nitro/tc_localization.rb +1 -1
- data/test/nitro/tc_mail.rb +1 -1
- data/test/nitro/tc_session.rb +1 -1
- data/test/nitro/tc_template.rb +1 -1
- data/test/nitro/tc_uri.rb +3 -4
- data/test/nitro/ui/tc_pager.rb +7 -7
- data/test/public/blog/inc1.xhtml +2 -0
- data/test/public/blog/inc2.xhtml +1 -0
- data/test/public/blog/list.xhtml +3 -0
- metadata +180 -203
- data/examples/blog/cache/entriesadmin +0 -12
- data/lib/nitro/cluster.rb +0 -218
- data/lib/nitro/component.rb +0 -15
- data/lib/nitro/filters.rb +0 -215
- data/lib/nitro/ui/date-select.rb +0 -69
- data/test/nitro/tc_filters.rb +0 -111
data/doc/RELEASES
CHANGED
|
@@ -1,4 +1,66 @@
|
|
|
1
|
-
== Version 0.
|
|
1
|
+
== Version 0.16.0
|
|
2
|
+
|
|
3
|
+
A snapshot of the latest developments. Many, many subtle improvements,
|
|
4
|
+
new features and a major cleanup of the source code. Thanks to
|
|
5
|
+
James Britt for significantly contributing to this release.
|
|
6
|
+
|
|
7
|
+
Most notable attitions:
|
|
8
|
+
|
|
9
|
+
* Aspect Oriented Programming support. This new system
|
|
10
|
+
is used to reimplement features such as Controller filters,
|
|
11
|
+
Og callbacks and Og observers. By using this unified
|
|
12
|
+
system you can now add Observers to controllers and use
|
|
13
|
+
a metalanguage for wraping Og object callbacks:
|
|
14
|
+
|
|
15
|
+
class Controller
|
|
16
|
+
pre :force_login, :where => :prepend
|
|
17
|
+
wrap Benchmark, :on => :index
|
|
18
|
+
post :taraa, :on => login
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
module Timestamped
|
|
22
|
+
pre :on => :og_insert { |this| this.create_time = Time.now }
|
|
23
|
+
pre :on => :og_update { |this| this.update_time = Time.now }
|
|
24
|
+
pre :on => [:og_insert, :og_update] { |this| this.create_time = Time.now }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
This feature will be used extensivelly in future versions
|
|
28
|
+
to improve logging, the shaders and more.
|
|
29
|
+
|
|
30
|
+
* Added support for Test Driven Development. Many helpers
|
|
31
|
+
and utility methods are added to the standard TestCase
|
|
32
|
+
class, more will come in a future version:
|
|
33
|
+
|
|
34
|
+
handle(
|
|
35
|
+
'/login',
|
|
36
|
+
request = { 'password' => Blog.password }
|
|
37
|
+
)
|
|
38
|
+
assert_redirect
|
|
39
|
+
assert_session_has(:owner)
|
|
40
|
+
assert_session_equal(:username, 'George Moschovitis')
|
|
41
|
+
assert_has_cookie('nauth')
|
|
42
|
+
assert_has_no_cookie('wow')
|
|
43
|
+
assert_cookie_equal('nauth', 'just an example, not used :)')
|
|
44
|
+
|
|
45
|
+
* CGI adapter (by James Britt)
|
|
46
|
+
|
|
47
|
+
* Major cleanup of the source. Converted the N namespace to
|
|
48
|
+
Nitro, to be more compatible with other Ruby projects.
|
|
49
|
+
|
|
50
|
+
* Add Og Timestamped mixin.
|
|
51
|
+
|
|
52
|
+
* Og improvements.
|
|
53
|
+
|
|
54
|
+
* Improved runner helper.
|
|
55
|
+
|
|
56
|
+
* Improved reloading support.
|
|
57
|
+
|
|
58
|
+
* Improved the Gem installation process.
|
|
59
|
+
|
|
60
|
+
* Fixed all reported bugs.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
== Version 0.15.0 was released on 04/04/2005.
|
|
2
64
|
|
|
3
65
|
A great release. Many cool new features and tons of subtle
|
|
4
66
|
improvements. We also welcome a new core developer, Anastastios
|
data/examples/ajax/controller.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id: controller.rb
|
|
3
|
+
# $Id: controller.rb 1 2005-04-11 11:04:30Z gmosx $
|
|
4
4
|
|
|
5
5
|
require 'nitro/controller'
|
|
6
6
|
|
|
7
7
|
COUNTRIES = %w{ Greece USA England Germany Italy Canada France Japan Australia Holland }
|
|
8
8
|
|
|
9
|
-
class AjaxController <
|
|
9
|
+
class AjaxController < Nitro::Controller
|
|
10
10
|
def hit
|
|
11
11
|
puts "-----------------------------> hit #{request['val']}"
|
|
12
12
|
end
|
|
@@ -60,7 +60,9 @@ function getWord(input, evt) {
|
|
|
60
60
|
<body>
|
|
61
61
|
<h1>Server side autocompletion</h1>
|
|
62
62
|
<form>
|
|
63
|
-
Enter a Country
|
|
63
|
+
<b>Enter a Country:</b> <input type="text" id="country" name="country" value="" onkeyup="getWord(this,event)" autocomplete="off" />
|
|
64
|
+
<br />
|
|
65
|
+
try one of #{COUNTRIES.join(', ')}
|
|
64
66
|
</form>
|
|
65
67
|
<h1>Send data to a server action</h1>
|
|
66
68
|
<p>
|
data/examples/ajax/run.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id: run.rb
|
|
3
|
+
# $Id: run.rb 1 2005-04-11 11:04:30Z gmosx $
|
|
4
4
|
|
|
5
5
|
require 'nitro'
|
|
6
6
|
require 'controller'
|
|
7
7
|
|
|
8
|
-
include
|
|
8
|
+
include Nitro
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Nitro.run(
|
|
11
11
|
:host => '127.0.0.1',
|
|
12
12
|
:port => 9999,
|
|
13
13
|
:dispatcher => Dispatcher.new(AjaxController)
|
data/examples/blog/README
CHANGED
|
@@ -25,6 +25,10 @@ Exec the following command:
|
|
|
25
25
|
|
|
26
26
|
$ ruby run.rb
|
|
27
27
|
|
|
28
|
+
or with gems
|
|
29
|
+
|
|
30
|
+
$ ruby -rubygems run.rb
|
|
31
|
+
|
|
28
32
|
then point your browser to:
|
|
29
33
|
|
|
30
34
|
http://127.0.0.1:9999
|
|
@@ -51,6 +55,10 @@ debugging information.
|
|
|
51
55
|
|
|
52
56
|
$ ruby run.rb --debug
|
|
53
57
|
|
|
58
|
+
or with gems
|
|
59
|
+
|
|
60
|
+
$ ruby -rubygems run.rb --debug
|
|
61
|
+
|
|
54
62
|
In debug mode the view files (xhtml/xsl/etc) are automatically
|
|
55
63
|
reloaded. The controller classes are also relaoded.
|
|
56
64
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<div class="entry"><h2 class="date">April 18, 2005</h2><div class="post"><h3 class="title">fdsfsdfs</h3>dfdsfdsf<div class="footer">posted by George Moschovitis at <a href="view_entry?oid=3">10:15 AM</a> | <a href="view_entry?oid=3#comments">0 comments</a>.[<a href="del_entry?oid=3">del</a>]</div></div></div><div class="entry"><h2 class="date">April 18, 2005</h2><div class="post"><h3 class="title">fsfdsf</h3>sdfsfs<div class="footer">posted by George Moschovitis at <a href="view_entry?oid=2">00:19 AM</a> | <a href="view_entry?oid=2#comments">0 comments</a>.[<a href="del_entry?oid=2">del</a>]</div></div></div><div class="entry"><h2 class="date">April 17, 2005</h2><div class="post"><h3 class="title">dfdsfds</h3>fdsfdsfds<div class="footer">posted by George Moschovitis at <a href="view_entry?oid=1">11:28 AM</a> | <a href="view_entry?oid=1#comments">1 comments</a>.[<a href="del_entry?oid=1">del</a>]</div></div></div><div class="pager"><ul>
|
|
2
|
+
<li class="active">1</li>
|
|
3
|
+
</ul><div class="clear">.</div></div>
|
data/examples/blog/run.rb
CHANGED
|
@@ -1,50 +1,48 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
|
-
# (c)
|
|
3
|
-
# $Id: run.rb
|
|
2
|
+
# (c) 2005 Navel, all rights reserved.
|
|
3
|
+
# $Id: run.rb 1 2005-04-11 11:04:30Z gmosx $
|
|
4
4
|
|
|
5
5
|
require 'nitro'
|
|
6
6
|
require 'og'
|
|
7
7
|
|
|
8
8
|
require 'blog'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Og.create_schema = false
|
|
14
|
-
# Session.store_type = :drb
|
|
15
|
-
Caching::Fragments.store = Caching::FileStore.new
|
|
16
|
-
|
|
17
|
-
Localization.add(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Rendering.shader = XSLTShader.new('src/xsl/style.xsl',
|
|
36
|
-
LocalizationShader.new(
|
|
37
|
-
RubyShader.new(
|
|
38
|
-
CompressShader.new
|
|
9
|
+
|
|
10
|
+
include Nitro
|
|
11
|
+
|
|
12
|
+
Nitro.run do |conf|
|
|
13
|
+
# Og.create_schema = false
|
|
14
|
+
# Session.store_type = :drb
|
|
15
|
+
Caching::Fragments.store = Caching::FileStore.new
|
|
16
|
+
|
|
17
|
+
Localization.add(
|
|
18
|
+
:en => 'conf/locales/en.yml',
|
|
19
|
+
:de => 'conf/locales/de.yml'
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
Og.connect(
|
|
23
|
+
:adapter => 'psql',
|
|
24
|
+
:database => 'blog',
|
|
25
|
+
:user => 'postgres',
|
|
26
|
+
:password => 'navelrulez',
|
|
27
|
+
:connection_count => 3
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
Rendering.shader = XSLTShader.new('src/xsl/style.xsl',
|
|
31
|
+
LocalizationShader.new(
|
|
32
|
+
RubyShader.new(
|
|
33
|
+
CompressShader.new
|
|
34
|
+
)
|
|
39
35
|
)
|
|
40
36
|
)
|
|
41
|
-
)
|
|
42
37
|
|
|
43
|
-
conf =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
:dispatcher => Dispatcher.new(BlogController, :xml => 'text/xml')
|
|
48
|
-
)
|
|
38
|
+
conf.dispatcher = Dispatcher.new(
|
|
39
|
+
:root => BlogController,
|
|
40
|
+
'xml' => XmlController
|
|
41
|
+
)
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
conf.set(
|
|
44
|
+
:name => 'Nitro Blog',
|
|
45
|
+
:host => '127.0.0.1',
|
|
46
|
+
:port => 9999
|
|
47
|
+
)
|
|
48
|
+
end
|
data/examples/blog/src/blog.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id: blog.rb
|
|
3
|
+
# $Id: blog.rb 1 2005-04-11 11:04:30Z gmosx $
|
|
4
4
|
|
|
5
5
|
# A simple blog to demonstrate the power of Nitro.
|
|
6
6
|
|
|
@@ -17,4 +17,5 @@ class Blog
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
require 'controller'
|
|
20
|
+
require 'mailer'
|
|
20
21
|
require 'models/blog'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
|
-
# (c)
|
|
3
|
-
# $Id: controller.rb
|
|
2
|
+
# (c) 2005 Navel, all rights reserved.
|
|
3
|
+
# $Id: controller.rb 20 2005-04-15 15:18:36Z gmosx $
|
|
4
4
|
|
|
5
5
|
require 'nitro/controller'
|
|
6
6
|
require 'nitro/ui/pager'
|
|
@@ -11,13 +11,18 @@ require 'models/blog'
|
|
|
11
11
|
|
|
12
12
|
# The controller of the Blog part.
|
|
13
13
|
|
|
14
|
-
class BlogController <
|
|
14
|
+
class BlogController < Nitro::Controller
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
pre :get_errors
|
|
17
|
+
post :cache_invalidate, :on => [ :new_entry, :new_comment, :del_entry, :del_comment ]
|
|
18
|
+
wrap Nitro::LocalizationAspect, :pre => :localize
|
|
19
|
+
|
|
20
|
+
# generate default BlogEntry related actions.
|
|
19
21
|
|
|
20
22
|
scaffold BlogEntry, :name => 'entry', :index => true # , :nosuffix => true
|
|
23
|
+
|
|
24
|
+
# generate default Comment related actions.
|
|
25
|
+
|
|
21
26
|
scaffold Comment
|
|
22
27
|
|
|
23
28
|
# as an example of full page caching.
|
|
@@ -56,12 +61,6 @@ class BlogController < N::Controller
|
|
|
56
61
|
end
|
|
57
62
|
action :myview, :route => /view\/(.*)/, 'oid' => 1
|
|
58
63
|
|
|
59
|
-
# example of generated view
|
|
60
|
-
|
|
61
|
-
def list_entry__xml
|
|
62
|
-
o.build_rss(@entries, :description => 'Blog entries', :link => context.host_url)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
64
|
def mail_entry
|
|
66
65
|
entry = BlogEntry[request['oid']]
|
|
67
66
|
BlogMailer.deliver_blog_entry_email(request['to'], entry)
|
|
@@ -77,18 +76,13 @@ class BlogController < N::Controller
|
|
|
77
76
|
|
|
78
77
|
comment.save!
|
|
79
78
|
end
|
|
80
|
-
|
|
81
|
-
# example of generated view
|
|
82
|
-
|
|
83
|
-
def list_comment__xml
|
|
84
|
-
@out.build_rss(@comments, :description => 'Blog comments', :link => context.host_url)
|
|
85
|
-
end
|
|
86
79
|
|
|
87
80
|
def login
|
|
88
81
|
if password = request['password']
|
|
89
82
|
if password == Blog.password
|
|
90
83
|
session[:owner] = true
|
|
91
84
|
session[:username] = Blog.username
|
|
85
|
+
request.add_cookie 'nauth', 'just an example, not used :)'
|
|
92
86
|
redirect '/'
|
|
93
87
|
else
|
|
94
88
|
@error = 'Invalid password'
|
|
@@ -129,7 +123,33 @@ private
|
|
|
129
123
|
# gmosx: will be improved.
|
|
130
124
|
expire_fragment('entriesadmin')
|
|
131
125
|
expire_fragment('entriesadmintrue')
|
|
132
|
-
Logger.info 'cache (after filter example)'
|
|
133
126
|
end
|
|
134
|
-
|
|
135
127
|
end
|
|
128
|
+
|
|
129
|
+
# A special controller for that presents
|
|
130
|
+
# the blog content using XML (RSS). This controller
|
|
131
|
+
# reuses the BlogController actions but adds
|
|
132
|
+
# XML templates.
|
|
133
|
+
|
|
134
|
+
class XmlController < BlogController
|
|
135
|
+
@base = 'xml'
|
|
136
|
+
@content_type = 'text/xml'
|
|
137
|
+
@template_root = 'src/views/xml'
|
|
138
|
+
|
|
139
|
+
# This is the prefered way to add programmatically
|
|
140
|
+
# generated output. The method list_entry_template is
|
|
141
|
+
# called after list_entry.
|
|
142
|
+
|
|
143
|
+
def list_entry_template
|
|
144
|
+
o.build_rss(@entries, :description => 'Blog entries', :link => context.host_url)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Another way to overload the method for RSS output.
|
|
148
|
+
# Not that flexible though.
|
|
149
|
+
|
|
150
|
+
def list_comment
|
|
151
|
+
super
|
|
152
|
+
o.build_rss(@comments, :description => 'Blog comments', :link => context.host_url)
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
data/examples/blog/src/mailer.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id: mailer.rb
|
|
3
|
+
# $Id: mailer.rb 1 2005-04-11 11:04:30Z gmosx $
|
|
4
4
|
|
|
5
5
|
require 'nitro/mail'
|
|
6
6
|
|
|
7
7
|
# A simple mailer.
|
|
8
8
|
|
|
9
|
-
class BlogMailer <
|
|
9
|
+
class BlogMailer < Nitro::Mailer
|
|
10
10
|
|
|
11
11
|
def initialize(*p)
|
|
12
12
|
super(*p)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id: blog.rb
|
|
3
|
+
# $Id: blog.rb 20 2005-04-15 15:18:36Z gmosx $
|
|
4
4
|
|
|
5
5
|
require 'models/content'
|
|
6
6
|
|
|
@@ -15,6 +15,7 @@ class Comment; end
|
|
|
15
15
|
module Common
|
|
16
16
|
include BaseContent
|
|
17
17
|
include CreateTime
|
|
18
|
+
|
|
18
19
|
prop_accessor :author, String
|
|
19
20
|
validate_value :body
|
|
20
21
|
end
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id: content.rb
|
|
3
|
+
# $Id: content.rb 23 2005-04-16 18:20:00Z gmosx $
|
|
4
4
|
|
|
5
5
|
require 'nitro/markup'
|
|
6
6
|
|
|
7
|
-
include N
|
|
8
|
-
|
|
9
7
|
# The foundamental Content Unit.
|
|
10
8
|
|
|
11
9
|
module BaseContent
|
|
12
|
-
include Markup
|
|
10
|
+
include Nitro::Markup
|
|
13
11
|
prop_accessor :title, String
|
|
14
12
|
prop_accessor :body, String, :markup => true, :ui => :textarea
|
|
15
13
|
end
|
|
@@ -19,34 +17,7 @@ end
|
|
|
19
17
|
module CreateTime
|
|
20
18
|
prop_accessor :create_time, Time
|
|
21
19
|
prop_accessor :update_time, Time
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@create_time = @update_time = Time.now
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def og_pre_update(conn)
|
|
28
|
-
@update_time = Time.now
|
|
29
|
-
end
|
|
20
|
+
pre "@create_time = @update_time = Time.now", :on => :og_insert
|
|
21
|
+
pre "@update_time = Time.now", :on => :og_update
|
|
30
22
|
end
|
|
31
23
|
|
|
32
|
-
# The foundamental Content Unit.
|
|
33
|
-
#--
|
|
34
|
-
# THINK: rename this to Entity?
|
|
35
|
-
#++
|
|
36
|
-
|
|
37
|
-
module Content
|
|
38
|
-
include BaseContent
|
|
39
|
-
prop_accessor :name, String
|
|
40
|
-
prop_accessor :ctime, Time
|
|
41
|
-
prop_accessor :mtime, Time
|
|
42
|
-
|
|
43
|
-
def initialize(*args)
|
|
44
|
-
@ctime = @mtime = Time.now
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# A Category.
|
|
49
|
-
|
|
50
|
-
class Category
|
|
51
|
-
include BaseContent
|
|
52
|
-
end
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
<?r for error, path in @context.rendering_errors ?>
|
|
30
30
|
<div class="path"><strong>Path:</strong> #{path}</div>
|
|
31
|
-
<div class="error"><strong>#{error.class.name}:</strong> #{
|
|
31
|
+
<div class="error"><strong>#{error.class.name}:</strong> #{Nitro::Markup.expand(error.to_s)}</div>
|
|
32
32
|
<div class="load">Click here to <strong><a href="#{request.uri}">reload</a></strong>.</div>
|
|
33
33
|
<div class="load">Click here to go to the <strong><a href="#{request.referer}">referer</a></strong>.</div>
|
|
34
34
|
<h2><a href="#" onclick="document.getElementById('trace').style.display = 'block'; return false">Stack Trace</a></h2>
|