Add URL for page creation to allow preemption by extensions

This commit is contained in:
Arran Cudbard-Bell
2011-06-19 21:25:16 +02:00
committed by Arran Cudbard-Bell
parent 7045f7f92d
commit 1d5bfbb162
+13 -5
View File
@@ -101,7 +101,7 @@ module Precious
mustache :edit mustache :edit
end end
else else
mustache :create redirect "/create/#{CGI.escape(@name)}"
end end
end end
@@ -124,7 +124,17 @@ module Precious
redirect "/#{page.escaped_url_path}" redirect "/#{page.escaped_url_path}"
end end
get '/create/*' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@name = params[:splat].first
if wiki.page(@name)
redirect "/#{CGI.escape(@name)}"
else
mustache :create
end
end
post '/create' do post '/create' do
name = params[:page] name = params[:page]
path = sanitize_empty_params(params[:path]) path = sanitize_empty_params(params[:path])
@@ -298,9 +308,7 @@ module Precious
content_type file.mime_type content_type file.mime_type
file.raw_data file.raw_data
else else
@name = name redirect "/create/#{CGI.escape(name)}"
@path = path
mustache :create
end end
end end