Haru Iida avatar Haru Iida committed cf99c71

fixes #1186 wiki#show for new wiki without edit privileges causes error 500 instead of 404.

Comments (0)

Files changed (2)

   author_url 'http://twitter.com/haru_iida'
   description 'This is a Wiki Extensions plugin for Redmine'
   url "http://www.r-labs.org/projects/r-labs/wiki/Wiki_Extensions_en"
-  version '0.6.2'
+  version '0.6.3'
   requires_redmine :version_or_higher => '2.2.0'
 
   project_module :wiki_extensions do

lib/wiki_extensions_wiki_controller_patch.rb

 # Wiki Extensions plugin for Redmine
-# Copyright (C) 2009-2012  Haruyuki Iida
+# Copyright (C) 2009-2013  Haruyuki Iida
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 begin
-require_dependency 'application'
+  require_dependency 'application'
 rescue LoadError
 end
 require_dependency 'wiki_controller'
       alias_method_chain :respond_to, :wiki_extensions
       alias_method_chain :render, :wiki_extensions
       class << self
-        
-        
+
+
       end
-      
+
     end
 
   end
 
 module InstanceMethodsForWikiExtensionWikiController
   def render_with_wiki_extensions(args = nil)
-    if args and @project and WikiExtensionsUtil.is_enabled?(@project)
+    if args and @project and WikiExtensionsUtil.is_enabled?(@project) and @content
       if (args[:partial] == 'common/preview')
         WikiExtensionsFootnote.preview_page.wiki_extension_data[:footnotes] = []
       end
   end
 
   def respond_to_with_wiki_extensions(&block)
-    if @project and WikiExtensionsUtil.is_enabled?(@project)
+    if @project and WikiExtensionsUtil.is_enabled?(@project) and @content
       if (@_action_name == 'show')
         wiki_extensions_include_header
-        wiki_extensions_add_fnlist 
+        wiki_extensions_add_fnlist
         wiki_extensions_include_footer
       end
     end
   def wiki_extensions_get_current_page
     @page
   end
+
   private
 
   def wiki_extensions_save_tags
     return true if request.get?
-      
+
     extension = params[:extension]
     return true unless extension
-    
+
     tags = extension[:tags]
 
     @page.set_tags(tags)
   end
-  
+
   def wiki_extensions_add_fnlist
     text = @content.text
     text << "\n\n{{fnlist}}\n"
   end
-  
+
   def wiki_extensions_include_header
     return if @page.title == 'Header' || @page.title == 'Footer'
     header = @wiki.find_page('Header')
     return unless header
     text = "\n"
-	text << '<div id="wiki_extentions_header">'
+    text << '<div id="wiki_extentions_header">'
     text << "\n\n"
     text << header.content.text
     text << "\n\n</div>"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.