Commits

Haru Iida committed 47a062e

fixes #764 Toolbar of wiki form was broken with ChiliProject 1.4

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.3.3'
+  version '0.3.4'
   requires_redmine :version_or_higher => '1.1.0'
 
   project_module :wiki_extensions do

lib/wiki_extensions_helper_patch.rb

     
     base.class_eval do
       unloadable # Send unloadable so it will not be unloaded in development
-      major, minor = Redmine::VERSION.to_a
-      if major == 1 and minor < 2
+      if WikiExtensionsHelperPatch::has_heads_for_wiki_formatter?
+        alias_method_chain :heads_for_wiki_formatter, :wiki_smiles
+      else
         alias_method_chain :wikitoolbar_for, :wiki_smiles
-      else
-        alias_method_chain :heads_for_wiki_formatter, :wiki_smiles
+      end      
+    end
+  end
+  def self.has_heads_for_wiki_formatter?
+    major, minor = Redmine::VERSION.to_a
+    if Redmine::Info.app_name == 'Redmine'
+      if major > 1
+        return true
       end
-      
+      if major == 1 and minor > 1
+        return true
+      end
+    else
+      if major > 1
+        return true
+      end
     end
-
+    false
   end
 end
 
     o = ""
     o << stylesheet_link_tag(baseurl + "/plugin_assets/redmine_wiki_extensions/stylesheets/wiki_smiles.css") +javascript_include_tag('jstoolbar/jstoolbar')
     o << javascript_include_tag('jstoolbar/textile')
-      #here added a new js tag#
+    #here added a new js tag#
     o << javascript_include_tag(baseurl + "/plugin_assets/redmine_wiki_extensions/javascripts/wiki_smiles.js")
     emoticons = WikiExtensions::Emoticons.new
     o << '<script type="text/javascript">'
     useragent = request.env['HTTP_USER_AGENT']
     return useragent.match(/IE[ ]+[67]./) != nil
   end
-
+  
+ 
 end
 
 Redmine::WikiFormatting::Textile::Helper.send(:include, WikiExtensionsHelperPatch)