diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 29e3a2ff..e41aa5c5 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -29,7 +29,7 @@ class AdminController < ApplicationController if params['address'] unless (request.post? || ENV["RAILS_ENV"] == "test") headers['Allow'] = 'POST' - render(:status => 405, :text => 'You must use an HTTP POST') + render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error') return end # form submitted @@ -56,7 +56,7 @@ class AdminController < ApplicationController if system_password unless (request.post? || ENV["RAILS_ENV"] == "test") headers['Allow'] = 'POST' - render(:status => 405, :text => 'You must use an HTTP POST') + render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error') return end # form submitted @@ -93,7 +93,7 @@ class AdminController < ApplicationController def remove_orphaned_pages unless (request.post? || ENV["RAILS_ENV"] == "test") headers['Allow'] = 'POST' - render(:status => 405, :text => 'You must use an HTTP POST') + render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error') return end if wiki.authenticate(params['system_password_orphaned']) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index bac9b63b..0d1d52cc 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -36,7 +36,7 @@ class ApplicationController < ActionController::Base if @web_name @web = @wiki.webs[@web_name] if @web.nil? - render(:status => 404, :text => "Unknown web '#{@web_name}'") + render(:status => 404, :text => "Unknown web '#{@web_name}'", :layout => 'error') return false end end diff --git a/app/controllers/file_controller.rb b/app/controllers/file_controller.rb index 0082eec0..21cde860 100644 --- a/app/controllers/file_controller.rb +++ b/app/controllers/file_controller.rb @@ -14,7 +14,7 @@ class FileController < ApplicationController if params['file'] unless (request.post? || ENV["RAILS_ENV"] == "test") headers['Allow'] = 'POST' - render(:status => 405, :text => 'You must use an HTTP POST') + render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error') return end # form supplied @@ -63,7 +63,7 @@ class FileController < ApplicationController protected def check_allow_uploads - render(:status => 404, :text => "Web #{params['web'].inspect} not found") and return false unless @web + render(:status => 404, :text => "Web #{params['web'].inspect} not found", :layout => 'error') and return false unless @web if @web.allow_uploads? return true else diff --git a/app/views/layouts/error.html.erb b/app/views/layouts/error.html.erb new file mode 100644 index 00000000..22c4fc2c --- /dev/null +++ b/app/views/layouts/error.html.erb @@ -0,0 +1,48 @@ + + + + + <%= h headers['Status'] %> + + + + + + <%= javascript_include_tag 'page_helper' %> + + + + <%= stylesheet_link_tag 'instiki' unless @inline_style %> + + + <%= javascript_include_tag :defaults %> + <% if @web %> + <%= auto_discovery_link_tag(:atom, :controller => 'wiki', :web => @web.address, :action => 'atom_with_headlines') %> + <%= auto_discovery_link_tag(:atom, :controller => 'wiki', :web => @web.address, :action => 'atom_with_content') %> + <% end %> + + + + +
+
+

+ <%= h headers['Status'] %> +

+ +<%= h @content_for_layout %> + +
+ +
+ + +