Handle duplicate page error in frontend. Closes #10.
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
and have bugs that may allow non-whitelisted HTML to sneak
|
and have bugs that may allow non-whitelisted HTML to sneak
|
||||||
through.
|
through.
|
||||||
* Introduce Ruby 1.9 compatibility fixes.
|
* Introduce Ruby 1.9 compatibility fixes.
|
||||||
|
* Handle duplicate page errors in frontend.
|
||||||
|
|
||||||
# 1.0.1 / 2010-08-12
|
# 1.0.1 / 2010-08-12
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,13 @@ module Precious
|
|||||||
|
|
||||||
format = params[:format].intern
|
format = params[:format].intern
|
||||||
|
|
||||||
wiki.write_page(name, format, params[:content], commit_message)
|
begin
|
||||||
redirect "/#{name}"
|
wiki.write_page(name, format, params[:content], commit_message)
|
||||||
|
redirect "/#{name}"
|
||||||
|
rescue Gollum::DuplicatePageError => e
|
||||||
|
@message = "Duplicate page: #{e.message}"
|
||||||
|
mustache :error
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
post '/preview' do
|
post '/preview' do
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<div class="guide">
|
||||||
|
<div class="main">
|
||||||
|
<div class="actions">
|
||||||
|
<a href="/">Home</a>
|
||||||
|
</div>
|
||||||
|
<h1>Error</h1>
|
||||||
|
<div class="error">
|
||||||
|
{{message}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
module Precious
|
||||||
|
module Views
|
||||||
|
class Error < Layout
|
||||||
|
attr_reader :message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user