cortex-reaver 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cortex_reaver +7 -2
- data/lib/cortex_reaver.rb +51 -71
- data/lib/cortex_reaver/config.rb +23 -7
- data/lib/cortex_reaver/controller/admin.rb +6 -8
- data/lib/cortex_reaver/controller/comment.rb +17 -17
- data/lib/cortex_reaver/controller/config.rb +3 -2
- data/lib/cortex_reaver/controller/controller.rb +22 -0
- data/lib/cortex_reaver/controller/documentation.rb +1 -3
- data/lib/cortex_reaver/controller/journal.rb +13 -12
- data/lib/cortex_reaver/controller/main.rb +36 -29
- data/lib/cortex_reaver/controller/page.rb +15 -11
- data/lib/cortex_reaver/controller/photograph.rb +21 -15
- data/lib/cortex_reaver/controller/project.rb +16 -13
- data/lib/cortex_reaver/controller/tag.rb +16 -14
- data/lib/cortex_reaver/controller/user.rb +11 -13
- data/lib/cortex_reaver/helper/attachments.rb +18 -12
- data/lib/cortex_reaver/helper/auth.rb +2 -2
- data/lib/cortex_reaver/helper/canonical.rb +2 -2
- data/lib/cortex_reaver/helper/crud.rb +78 -38
- data/lib/cortex_reaver/helper/feeds.rb +2 -5
- data/lib/cortex_reaver/helper/form.rb +1 -1
- data/lib/cortex_reaver/helper/navigation.rb +1 -1
- data/lib/cortex_reaver/helper/photographs.rb +12 -3
- data/lib/cortex_reaver/helper/template.rb +37 -0
- data/lib/cortex_reaver/{view/blank_layout.rhtml → layout/blank.rhtml} +1 -1
- data/lib/cortex_reaver/{view/text_layout.rhtml → layout/text.rhtml} +1 -1
- data/lib/cortex_reaver/migrations/013_draft.rb +17 -0
- data/lib/cortex_reaver/model/comment.rb +64 -53
- data/lib/cortex_reaver/model/journal.rb +23 -21
- data/lib/cortex_reaver/model/model.rb +9 -0
- data/lib/cortex_reaver/model/page.rb +24 -42
- data/lib/cortex_reaver/model/photograph.rb +17 -17
- data/lib/cortex_reaver/model/project.rb +21 -18
- data/lib/cortex_reaver/model/tag.rb +12 -8
- data/lib/cortex_reaver/model/user.rb +79 -41
- data/lib/cortex_reaver/public/css/main.css +4 -0
- data/lib/cortex_reaver/snippets/numeric.rb +15 -0
- data/lib/cortex_reaver/snippets/ramaze/cache/memcached.rb +14 -0
- data/lib/cortex_reaver/support/attachments.rb +113 -105
- data/lib/cortex_reaver/support/cached_rendering.rb +65 -62
- data/lib/cortex_reaver/support/canonical.rb +82 -85
- data/lib/cortex_reaver/support/comments.rb +57 -51
- data/lib/cortex_reaver/support/cortex_reaver_validation_helpers.rb +13 -0
- data/lib/cortex_reaver/support/sequenceable.rb +202 -203
- data/lib/cortex_reaver/support/tags.rb +103 -94
- data/lib/cortex_reaver/support/timestamps.rb +27 -21
- data/lib/cortex_reaver/support/viewable.rb +17 -0
- data/lib/cortex_reaver/version.rb +3 -3
- data/lib/cortex_reaver/view/admin/index.rhtml +2 -2
- data/lib/cortex_reaver/view/comments/comment.rhtml +4 -1
- data/lib/cortex_reaver/view/comments/list.rhtml +1 -1
- data/lib/cortex_reaver/view/comments/post_form.rhtml +1 -1
- data/lib/cortex_reaver/view/journals/form.rhtml +3 -1
- data/lib/cortex_reaver/view/journals/journal.rhtml +6 -4
- data/lib/cortex_reaver/view/journals/list.rhtml +2 -2
- data/lib/cortex_reaver/view/journals/show.rhtml +1 -1
- data/lib/cortex_reaver/view/pages/form.rhtml +2 -1
- data/lib/cortex_reaver/view/pages/list.rhtml +2 -2
- data/lib/cortex_reaver/view/pages/show.rhtml +1 -1
- data/lib/cortex_reaver/view/photographs/form.rhtml +7 -3
- data/lib/cortex_reaver/view/photographs/list.rhtml +1 -1
- data/lib/cortex_reaver/view/photographs/show.rhtml +7 -7
- data/lib/cortex_reaver/view/projects/form.rhtml +1 -0
- data/lib/cortex_reaver/view/projects/list.rhtml +3 -3
- data/lib/cortex_reaver/view/projects/show.rhtml +5 -2
- data/lib/cortex_reaver/view/tags/list.rhtml +6 -2
- data/lib/cortex_reaver/view/tags/show.rhtml +10 -5
- data/lib/cortex_reaver/view/users/form.rhtml +1 -1
- data/lib/cortex_reaver/view/users/list.rhtml +5 -2
- data/lib/cortex_reaver/view/users/login.rhtml +1 -1
- data/lib/cortex_reaver/view/users/show.rhtml +5 -1
- metadata +159 -149
- data/lib/cortex_reaver/public/dispatch.fcgi +0 -11
- data/lib/cortex_reaver/snippets/ramaze/dispatcher/file.rb +0 -37
- data/lib/cortex_reaver/support/pagination.rb +0 -38
- data/lib/cortex_reaver/view/error.rhtml +0 -72
- data/lib/cortex_reaver/view/photographs/short.rhtml +0 -3
data/bin/cortex_reaver
CHANGED
@@ -95,6 +95,7 @@ module CortexReaver
|
|
95
95
|
# Connect to current DB
|
96
96
|
reload_config
|
97
97
|
setup_db false
|
98
|
+
require 'sequel/extensions/migration'
|
98
99
|
current_version = Sequel::Migrator.get_current_migration_version(db)
|
99
100
|
|
100
101
|
puts "Using database #{config[:database][:host]}/#{config[:database][:database]}."
|
@@ -108,7 +109,7 @@ module CortexReaver
|
|
108
109
|
|
109
110
|
# Connect to dump DB
|
110
111
|
dump = Sequel.connect "sqlite:////#{File.expand_path(file)}"
|
111
|
-
Sequel::Migrator.apply dump, LIB_DIR
|
112
|
+
Sequel::Migrator.apply dump, File.join(LIB_DIR,:migrations), current_version
|
112
113
|
|
113
114
|
# Copy tables
|
114
115
|
db.tables.each do |table|
|
@@ -127,6 +128,7 @@ module CortexReaver
|
|
127
128
|
# Connect to dump DB
|
128
129
|
file = @values[:load_file]
|
129
130
|
dump = Sequel.connect "sqlite:////#{File.expand_path(file)}"
|
131
|
+
require 'sequel/extensions/migration'
|
130
132
|
current_version = Sequel::Migrator.get_current_migration_version(dump)
|
131
133
|
|
132
134
|
# Connect to current DB
|
@@ -159,16 +161,19 @@ module CortexReaver
|
|
159
161
|
reload_config
|
160
162
|
response = open("http://#{config[:host] || 'localhost'}:#{config[:port]}/")
|
161
163
|
puts response.status.join(' ');
|
164
|
+
|
162
165
|
when :migrate
|
163
166
|
version = @values[:schema_version]
|
164
167
|
|
165
168
|
# Get ready
|
166
169
|
reload_config
|
167
170
|
setup_db false
|
171
|
+
self.load
|
168
172
|
init
|
169
173
|
|
170
174
|
puts "Using database #{config[:database][:host]}/#{config[:database][:database]}."
|
171
175
|
|
176
|
+
require 'sequel/extensions/migration'
|
172
177
|
current_version = Sequel::Migrator.get_current_migration_version(db)
|
173
178
|
latest_version = Sequel::Migrator.latest_migration_version(File.join(LIB_DIR, 'migrations'))
|
174
179
|
|
@@ -212,7 +217,6 @@ module CortexReaver
|
|
212
217
|
# Start an IRB session
|
213
218
|
reload_config
|
214
219
|
setup
|
215
|
-
Ramaze::Global.console = true
|
216
220
|
|
217
221
|
# Don't let IRB try to interpret our command line
|
218
222
|
ARGV.clear
|
@@ -233,6 +237,7 @@ module CortexReaver
|
|
233
237
|
|
234
238
|
when :test
|
235
239
|
require File.join(DIR, '..', 'spec', 'main.rb')
|
240
|
+
|
236
241
|
else
|
237
242
|
abort("Unknown action: #{@action}")
|
238
243
|
end
|
data/lib/cortex_reaver.rb
CHANGED
@@ -7,6 +7,10 @@ begin
|
|
7
7
|
require 'sequel'
|
8
8
|
require 'yaml'
|
9
9
|
require 'socket'
|
10
|
+
|
11
|
+
require 'sequel/extensions/migration'
|
12
|
+
require 'sequel/extensions/inflector'
|
13
|
+
require 'sequel/extensions/blank'
|
10
14
|
rescue LoadError => e
|
11
15
|
puts e
|
12
16
|
puts "You probably need to install some packages Cortex Reaver needs. Try:
|
@@ -18,8 +22,8 @@ end
|
|
18
22
|
module CortexReaver
|
19
23
|
# Paths
|
20
24
|
ROOT = File.expand_path(File.join(__DIR__, '..'))
|
21
|
-
LIB_DIR = File.join(ROOT, 'lib', 'cortex_reaver')
|
22
|
-
HOME_DIR = Dir.pwd
|
25
|
+
LIB_DIR = File.expand_path(File.join(ROOT, 'lib', 'cortex_reaver'))
|
26
|
+
HOME_DIR = File.expand_path(Dir.pwd)
|
23
27
|
|
24
28
|
# Some basic initial requirements
|
25
29
|
require File.join(LIB_DIR, 'version')
|
@@ -44,18 +48,27 @@ module CortexReaver
|
|
44
48
|
|
45
49
|
# Prepare Ramaze, create directories, etc.
|
46
50
|
def self.init
|
47
|
-
#
|
48
|
-
Ramaze
|
49
|
-
|
50
|
-
|
51
|
+
# App
|
52
|
+
Ramaze.options.app.name = :cortex_reaver
|
53
|
+
|
54
|
+
# Root directory
|
55
|
+
Ramaze::App[:cortex_reaver].options.roots = [LIB_DIR]
|
56
|
+
if config[:root]
|
57
|
+
Ramaze::App[:cortex_reaver].options.roots.unshift(config[:root])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Server options
|
61
|
+
Ramaze.options.adapter.handler = config[:adapter]
|
62
|
+
Ramaze.options.adapter.host = config[:host]
|
63
|
+
Ramaze.options.adapter.port = config[:port]
|
51
64
|
|
52
65
|
# Check directories
|
53
|
-
if config[:
|
66
|
+
if config[:root] and not File.directory? config.public_root
|
54
67
|
# Try to create a public directory
|
55
68
|
begin
|
56
69
|
FileUtils.mkdir_p config[:public_root]
|
57
70
|
rescue => e
|
58
|
-
Ramaze::Log.warn "Unable to create a public directory at #{config
|
71
|
+
Ramaze::Log.warn "Unable to create a public directory at #{config.public_root}: #{e}."
|
59
72
|
end
|
60
73
|
end
|
61
74
|
if config[:log_root] and not File.directory? config[:log_root]
|
@@ -75,36 +88,37 @@ module CortexReaver
|
|
75
88
|
|
76
89
|
unless config[:daemon]
|
77
90
|
# Log to console
|
78
|
-
Ramaze::Log.loggers <<
|
91
|
+
Ramaze::Log.loggers << Logger.new(STDOUT)
|
79
92
|
end
|
80
93
|
|
81
94
|
case config[:mode]
|
82
95
|
when :production
|
96
|
+
Ramaze.options.mode = :live
|
97
|
+
|
98
|
+
# Set up cache
|
99
|
+
case config[:cache]
|
100
|
+
when :memcache
|
101
|
+
Ramaze::Cache.options.default = Ramaze::Cache::MemCache
|
102
|
+
end
|
103
|
+
|
83
104
|
if config[:log_root]
|
84
105
|
# Log to file
|
85
|
-
Ramaze::Log.loggers <<
|
86
|
-
File.join(config[:log_root], 'production.log')
|
87
|
-
[:error, :info, :notice]
|
106
|
+
Ramaze::Log.loggers << Logger.new(
|
107
|
+
File.join(config[:log_root], 'production.log')
|
88
108
|
)
|
109
|
+
Ramaze::Log.level = Logger::Severity::INFO
|
89
110
|
end
|
90
|
-
|
91
|
-
# Don't reload source code
|
92
|
-
Ramaze::Global.sourcereload = false
|
93
|
-
|
94
|
-
# Don't expose errors
|
95
|
-
Ramaze::Dispatcher::Error::HANDLE_ERROR.update({
|
96
|
-
ArgumentError => [404, 'error_404'],
|
97
|
-
Exception => [500, 'error_500']
|
98
|
-
})
|
99
111
|
when :development
|
112
|
+
Ramaze.options.mode = :dev
|
113
|
+
|
100
114
|
if config[:log_root]
|
101
115
|
# Log to file
|
102
|
-
Ramaze::Log.loggers <<
|
116
|
+
Ramaze::Log.loggers << Logger.new(
|
103
117
|
File.join(config[:log_root], 'development.log')
|
104
118
|
)
|
119
|
+
Ramaze::Log.level = Logger::Severity::DEBUG
|
105
120
|
|
106
121
|
# Also use SQL log
|
107
|
-
require 'logger'
|
108
122
|
db.logger = Logger.new(
|
109
123
|
File.join(config[:log_root], 'sql.log')
|
110
124
|
)
|
@@ -114,31 +128,15 @@ module CortexReaver
|
|
114
128
|
end
|
115
129
|
|
116
130
|
# Prepare view directory
|
117
|
-
if config
|
118
|
-
if not File.directory? config
|
131
|
+
if config.view_root
|
132
|
+
if not File.directory? config.view_root
|
119
133
|
# Try to create a view directory
|
120
134
|
begin
|
121
|
-
FileUtils.mkdir_p config
|
135
|
+
FileUtils.mkdir_p config.view_root
|
122
136
|
rescue => e
|
123
137
|
Ramaze::Log.warn "Unable to create a view directory at #{config[:view_root]}: #{e}."
|
124
138
|
end
|
125
139
|
end
|
126
|
-
|
127
|
-
if File.directory? config[:view_root]
|
128
|
-
# Link in default views
|
129
|
-
source = File.join(LIB_DIR, 'view')
|
130
|
-
dest = config[:view_root].sub(/\/$/, '')
|
131
|
-
Find.find(source) do |path|
|
132
|
-
dest_path = path.sub(source, dest)
|
133
|
-
if File.directory? path and not File.exists? dest_path
|
134
|
-
# Link this directory
|
135
|
-
FileUtils.ln_s path, dest_path
|
136
|
-
Find.prune
|
137
|
-
elsif File.file? path and not File.exists? dest_path
|
138
|
-
FileUtils.ln_s path, dest_path
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
140
|
end
|
143
141
|
|
144
142
|
# Load plugins
|
@@ -151,12 +149,14 @@ module CortexReaver
|
|
151
149
|
# Load libraries
|
152
150
|
def self.load
|
153
151
|
# Load controllers and models
|
152
|
+
require File.join(LIB_DIR, 'config')
|
153
|
+
require File.join(LIB_DIR, 'plugin')
|
154
|
+
require File.join(LIB_DIR, 'version')
|
154
155
|
Ramaze::acquire File.join(LIB_DIR, 'snippets', '**', '*')
|
155
156
|
Ramaze::acquire File.join(LIB_DIR, 'support', '*')
|
156
|
-
|
157
|
+
require File.join(LIB_DIR, 'model', 'model')
|
157
158
|
Ramaze::acquire File.join(LIB_DIR, 'helper', '*')
|
158
|
-
|
159
|
-
Ramaze::acquire File.join(LIB_DIR, '**', '*')
|
159
|
+
require File.join(LIB_DIR, 'controller', 'controller')
|
160
160
|
end
|
161
161
|
|
162
162
|
# Reloads the site configuration
|
@@ -179,23 +179,6 @@ module CortexReaver
|
|
179
179
|
def self.run
|
180
180
|
# Shutdown callback
|
181
181
|
at_exit do
|
182
|
-
# Unlink templates
|
183
|
-
begin
|
184
|
-
if config[:view_root]
|
185
|
-
Find.find(config[:view_root]) do |path|
|
186
|
-
if File.symlink? path # TODO: identify link target
|
187
|
-
begin
|
188
|
-
File.delete path
|
189
|
-
rescue => e
|
190
|
-
Ramaze::Log.error "Unable to unlink symlinked view #{path}: #{e}"
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
rescue => e2
|
196
|
-
Ramaze::Log.error "Unable to unlink symlinked views in #{config[:view_root]}: #{e}"
|
197
|
-
end
|
198
|
-
|
199
182
|
# Remove pidfile
|
200
183
|
FileUtils.rm(config[:pidfile]) if File.exist? config[:pidfile]
|
201
184
|
end
|
@@ -203,12 +186,8 @@ module CortexReaver
|
|
203
186
|
Ramaze::Log.info "Cortex Reaver #{Process.pid} stalking victims."
|
204
187
|
|
205
188
|
# Run Ramaze
|
206
|
-
Ramaze.
|
207
|
-
|
208
|
-
:adapter => config[:adapter],
|
209
|
-
:host => config[:host],
|
210
|
-
:port => config[:port]
|
211
|
-
)
|
189
|
+
# Ramaze.start :root => [config[:root], LIB_DIR]
|
190
|
+
Ramaze.start :root => LIB_DIR
|
212
191
|
|
213
192
|
puts "Cortex Reaver finished."
|
214
193
|
end
|
@@ -218,11 +197,11 @@ module CortexReaver
|
|
218
197
|
# Connect to DB
|
219
198
|
setup_db
|
220
199
|
|
221
|
-
# Prepare Ramaze, check directories, etc.
|
222
|
-
init
|
223
|
-
|
224
200
|
# Load library
|
225
201
|
self.load
|
202
|
+
|
203
|
+
# Prepare Ramaze, check directories, etc.
|
204
|
+
init
|
226
205
|
end
|
227
206
|
|
228
207
|
# Connect to DB. If check_schema is false, doesn't check to see that the schema
|
@@ -238,6 +217,7 @@ module CortexReaver
|
|
238
217
|
string = "#{d[:driver]}://#{d[:user]}:#{d[:password]}@#{d[:host]}/#{d[:database]}"
|
239
218
|
end
|
240
219
|
|
220
|
+
# Connect
|
241
221
|
begin
|
242
222
|
@db = Sequel.connect(string)
|
243
223
|
rescue => e
|
data/lib/cortex_reaver/config.rb
CHANGED
@@ -4,11 +4,8 @@ module CortexReaver
|
|
4
4
|
# Pass a YAML file with configuration options. At a minimum, it should specify
|
5
5
|
# :database = {:proto, :username, :pasword, :host, :database}
|
6
6
|
# or :database = "sequel_connect_string"
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# HOME_DIR/public.
|
10
|
-
# :view_root - The directory containing erubis view templates. Defaults to
|
11
|
-
# Cortex Reaver's builtin templates.
|
7
|
+
# :root - The directory containing public/, layout/, and view/.
|
8
|
+
# Defaults to HOME_DIR.
|
12
9
|
# :log_root - The directory that Cortex Reaver should log to. Defaults to
|
13
10
|
# HOME_DIR/log. If nil, file logging disabled.
|
14
11
|
# :plugin_root - The directory that Cortex Reaver plugins live in. Defaults
|
@@ -17,6 +14,7 @@ module CortexReaver
|
|
17
14
|
# :daemon - Whether to daemonize or not. Defaults to :true if :mode
|
18
15
|
# is :production, otherwise nil.
|
19
16
|
# :adapter - The Ramaze adapter name (default 'thin')
|
17
|
+
# :cache - The Ramaze cache to use (default: :memory)
|
20
18
|
# :host - Host to bind to
|
21
19
|
# :port - Port to bind to (default 7000)
|
22
20
|
# :pidfile - Process ID file for this server. Defaults to
|
@@ -38,12 +36,12 @@ module CortexReaver
|
|
38
36
|
File.expand_path(CortexReaver::HOME_DIR),
|
39
37
|
'cortex_reaver.db'
|
40
38
|
)
|
41
|
-
self[:
|
42
|
-
self[:view_root] = nil
|
39
|
+
self[:root] = CortexReaver::HOME_DIR
|
43
40
|
self[:log_root] = File.join(CortexReaver::HOME_DIR, 'log')
|
44
41
|
self[:plugin_root] = File.join(CortexReaver::HOME_DIR, 'plugins')
|
45
42
|
self[:mode] = :production
|
46
43
|
self[:adapter] = 'thin'
|
44
|
+
self[:cache] = :memory
|
47
45
|
self[:host] = nil
|
48
46
|
self[:port] = 7000
|
49
47
|
self[:plugins] = []
|
@@ -73,5 +71,23 @@ module CortexReaver
|
|
73
71
|
# Compile views
|
74
72
|
self[:compile_views] ||= true if self[:mode] == :production
|
75
73
|
end
|
74
|
+
|
75
|
+
def public_root
|
76
|
+
if self[:root]
|
77
|
+
File.join(self[:root], 'public')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def view_root
|
82
|
+
if self[:root]
|
83
|
+
File.join(self[:root], 'view')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def layout_root
|
88
|
+
if self[:root]
|
89
|
+
File.join(self[:root], 'layout')
|
90
|
+
end
|
91
|
+
end
|
76
92
|
end
|
77
93
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
module CortexReaver
|
2
|
-
class AdminController <
|
2
|
+
class AdminController < Controller
|
3
3
|
|
4
4
|
map '/admin'
|
5
|
-
layout '/text_layout'
|
6
|
-
engine :Erubis
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
layout(:text) do
|
7
|
+
not request.xhr?
|
8
|
+
end
|
9
|
+
|
10
|
+
helper :aspect
|
13
11
|
|
14
12
|
before_all do
|
15
13
|
require_roles :admin
|
@@ -1,25 +1,27 @@
|
|
1
1
|
module CortexReaver
|
2
|
-
class CommentController <
|
2
|
+
class CommentController < Controller
|
3
3
|
MODEL = Comment
|
4
4
|
|
5
5
|
map '/comments'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
|
7
|
+
layout(:text) do |name, wish|
|
8
|
+
not request.xhr? and name != 'atom'
|
9
|
+
end
|
10
|
+
|
11
|
+
alias_view :edit, :form
|
12
|
+
alias_view :new, :form
|
13
|
+
alias_view :page, :list
|
14
|
+
alias_view :index, :list
|
10
15
|
|
11
16
|
helper :cache,
|
12
|
-
:error,
|
13
|
-
:auth,
|
14
|
-
:form,
|
15
|
-
:workflow,
|
16
|
-
:navigation,
|
17
17
|
:date,
|
18
18
|
:canonical,
|
19
19
|
:crud,
|
20
20
|
:feeds
|
21
21
|
|
22
|
-
|
22
|
+
cache_action(:method => :index, :ttl => 120) do
|
23
|
+
user.id.to_i.to_s + flash.inspect
|
24
|
+
end
|
23
25
|
|
24
26
|
on_save do |comment, request|
|
25
27
|
comment.title = request[:title]
|
@@ -55,15 +57,13 @@ module CortexReaver
|
|
55
57
|
def page(page)
|
56
58
|
@title = "Recent Comments"
|
57
59
|
@comments = Comment.order(:created_on).reverse.limit(16)
|
58
|
-
|
59
|
-
render_template :list
|
60
60
|
end
|
61
61
|
|
62
62
|
# This action is referenced by public comment-posting forms.
|
63
63
|
def post
|
64
64
|
unless request.post?
|
65
65
|
flash[:error] = "No comment to post!"
|
66
|
-
redirect_to
|
66
|
+
redirect_to MainController.r
|
67
67
|
end
|
68
68
|
|
69
69
|
# Check for robots
|
@@ -71,7 +71,7 @@ module CortexReaver
|
|
71
71
|
request[:comment].blank?
|
72
72
|
# Robot!?
|
73
73
|
flash[:error] = "Cortex Reaver is immune to your drivel, spambot."
|
74
|
-
redirect
|
74
|
+
redirect MainController.r
|
75
75
|
end
|
76
76
|
|
77
77
|
begin
|
@@ -110,7 +110,7 @@ module CortexReaver
|
|
110
110
|
raise unless @comment.save
|
111
111
|
|
112
112
|
# Clear action cache
|
113
|
-
|
113
|
+
Ramaze::Cache.action.clear
|
114
114
|
|
115
115
|
flash[:notice] = "Your comment (<a href=\"##{@comment.url.gsub(/.*#/, '')}\">#{h @comment.title}</a>) has been posted."
|
116
116
|
redirect @comment.parent.url
|
@@ -124,7 +124,7 @@ module CortexReaver
|
|
124
124
|
session[:pending_comment] = @comment
|
125
125
|
redirect @comment.parent.url + '#post-comment'
|
126
126
|
else
|
127
|
-
redirect
|
127
|
+
redirect MainController.r
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|