Permalink
Browse files

for redmine 1.1.0

wiki related routing parameter names were changed.
  • Loading branch information...
1 parent 2957fa4 commit ef277b203d3e978ce2cff2153a690cb727ca1b55 @tckz committed Jan 11, 2011
View
@@ -52,7 +52,7 @@ Redmine Wiki Graphviz-macro plugin will allow Redmine's wiki to render graph ima
== Requirement
-* Redmine 0.8.0 RC1 or later.
+* Redmine 1.1.0 or later.
* Graphviz http://www.graphviz.org
* There are 2ways about setting up graphviz for this plugin.
* The one is using Gv which is ruby binding of graphviz.
@@ -112,30 +112,18 @@ This plugin is licensed under the GNU GPL v2. See COPYRIGHT.txt and GPL.txt for
== My environment
-* CentOS 5.5
-* ruby-1.8.7-p299(from source)
-* memcached-1.2.6-1.el5.rf
-* MySQL-server-5.0.51a-tritonn.1.0.10
-* graphviz-2.26.3-1.el5
-* graphviz-gd-2.26.3-1.el5
-* graphviz-ruby-2.26.3-1.el5
-* passenger (2.2.15)
-* redmine-1.0.0
+* CentOS 5.5 x64
+* ruby-1.8.7-p248
+* MySQL-server-5.0.67-tritonn.1.0.12
+* graphviz-2.26.0
+* redmine-1.1.0
== My environment 2
-* CentOS 5.4
-* ruby-1.8.7-p248(from source)
-* mysql-server-5.0.77-3.el5
-* graphviz-2.26.0(from source)
-* redmine-0.9.2
-
-== My environment 3
-
* Windows XP Pro SP3(ja)
* ruby-1.8.7-p299(provided by rumix. http://ruby.morphball.net/rumix/)
* sqlite-3.7.0
* graphviz-2.26.3
-* redmine-1.0.0
+* redmine-1.1.0
@@ -6,7 +6,7 @@ class WikiGraphvizController < ApplicationController
include WikiGraphvizHelper
def graphviz
- @page = @wiki.find_page(params[:page], :project => @project)
+ @page = @wiki.find_page(params[:id], :project => @project)
if @page.nil?
render_404
return
@@ -39,7 +39,7 @@ def wiki_authorize
end
def find_wiki
- @project = Project.find(params[:id])
+ @project = Project.find(params[:project_id])
@wiki = @project.wiki
render_404 unless @wiki
rescue ActiveRecord::RecordNotFound
@@ -51,7 +51,7 @@ def render_graph(params, dot_text, options = {})
end
- def make_macro_output_by_title(macro_params, wiki_id)
+ def make_macro_output_by_title(macro_params, project_id)
page = @wiki.find_page(macro_params[:title], :project => @project)
if page.nil? ||
!User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
@@ -63,17 +63,17 @@ def make_macro_output_by_title(macro_params, wiki_id)
end
content = page.content_for_version(macro_params[:version])
- self.make_macro_output_by_text(content.text, macro_params, wiki_id)
+ self.make_macro_output_by_text(content.text, macro_params, project_id)
end
- def make_macro_output_by_text(dottext, macro_params, wiki_id)
+ def make_macro_output_by_text(dottext, macro_params, project_id)
graph = self.render_graph(macro_params, dottext)
if !graph[:image]
raise "page=#{macro_params[:title]}, error=#{graph[:message]}"
end
macro = {
- :wiki_id => wiki_id,
+ :project_id => project_id,
:params => macro_params,
:graph => graph,
:dottext => dottext,
@@ -286,7 +286,7 @@ def initialize(view, wiki_content)
@view.controller.extend(WikiGraphvizHelper)
end
- def graphviz(args, wiki_id)
+ def graphviz(args, project_id)
begin
title = args.pop.to_s
if title == ""
@@ -297,7 +297,7 @@ def graphviz(args, wiki_id)
macro_params = @macro_params.clone
macro_params[:title] = title
@view.controller.countup_macro_index()
- @view.controller.make_macro_output_by_title(macro_params, wiki_id)
+ @view.controller.make_macro_output_by_title(macro_params, project_id)
rescue => e
# wiki_formatting.rb(about redmine 1.0.0) catch exception and write e.to_s into HTML. so escape message.
ex = RuntimeError.new(ERB::Util.html_escape(e.message))
@@ -306,7 +306,7 @@ def graphviz(args, wiki_id)
end
end
- def graphviz_me(args, wiki_id, title)
+ def graphviz_me(args, project_id, title)
begin
if @content.nil?
return ""
@@ -316,7 +316,7 @@ def graphviz_me(args, wiki_id, title)
macro_params = @macro_params.clone
macro_params[:title] = title
@view.controller.countup_macro_index()
- @view.controller.make_macro_output_by_text(@content.text, macro_params, wiki_id)
+ @view.controller.make_macro_output_by_text(@content.text, macro_params, project_id)
rescue => e
# wiki_formatting.rb(about redmine 1.0.0) catch exception and write e.to_s into HTML. so escape message.
ex = RuntimeError.new(ERB::Util.html_escape(e.message))
@@ -4,8 +4,8 @@
url_for_rendered_img = url_for(
:controller => 'wiki_graphviz',
:action => 'graphviz',
- :id => macro[:wiki_id],
- :page => macro[:params][:title],
+ :project_id => macro[:project_id],
+ :id => macro[:params][:title],
:layout => macro[:params][:layout],
:format => macro[:params][:format],
:version => macro[:params][:version]
View
@@ -1,11 +1,5 @@
ActionController::Routing::Routes.draw do |map|
-
- if (Redmine::VERSION.to_a <=> [0, 9, 0]) >= 0
- # 0.9.0 or higher
- map.connect 'projects/:id/wiki/:page/graphviz', :controller => 'wiki_graphviz', :action => 'graphviz'
- else
- map.connect 'wiki/:id/:page/graphviz', :controller => 'wiki_graphviz', :action => 'graphviz'
- end
+ map.connect 'projects/:project_id/wiki/:id/graphviz', :controller => 'wiki_graphviz', :action => 'graphviz'
end
# vim: set ts=2 sw=2 sts=2:
View
@@ -5,10 +5,11 @@
Redmine::Plugin.register :wiki_graphviz_plugin do
name 'Graphviz Wiki-macro Plugin'
author 'tckz'
+ url "http://passing.breeze.cc/mt/" if respond_to?(:url)
description 'Render graph image from the wiki contents by Graphviz(http://www.graphviz.org/)'
- version '0.1.0'
+ version '0.2.0'
settings :default => {'cache_seconds' => '0'}, :partial => 'wiki_graphviz/settings'
- requires_redmine '0.8.0'
+ requires_redmine :version_or_higher => '1.1.0'
Redmine::WikiFormatting::Macros.register do
@@ -32,7 +33,7 @@
EOF
macro :graphviz do |wiki_content_obj, args|
m = WikiGraphvizHelper::Macro.new(self, wiki_content_obj)
- m.graphviz(args, params[:id])
+ m.graphviz(args, params[:project_id])
end
desc <<'EOF'
@@ -45,7 +46,7 @@
EOF
macro :graphviz_me do |wiki_content_obj, args|
m = WikiGraphvizHelper::Macro.new(self, wiki_content_obj)
- m.graphviz_me(args, params[:id], params[:page])
+ m.graphviz_me(args, params[:project_id], params[:id])
end
end
end
View
@@ -1,5 +0,0 @@
-
-# for earlier redmine(e.g. 0.8.7)
-
-require File.join(File.dirname(__FILE__), "config", "routes.rb")
-
@@ -3,40 +3,21 @@
class WikiGraphvizControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_routing
- if (Redmine::VERSION.to_a <=> [0, 9, 0]) >= 0
- assert_recognizes(
- {
- :controller => 'wiki_graphviz',
- :action => 'graphviz',
- :id => 'sample',
- :page => 'WikiPage'
- },
- 'projects/sample/wiki/WikiPage/graphviz'
- )
- assert_routing(
- 'projects/sample/wiki/WikiPage/graphviz',
+ assert_recognizes(
+ {
:controller => 'wiki_graphviz',
:action => 'graphviz',
- :id => 'sample',
- :page => 'WikiPage'
- )
- else
- assert_recognizes(
- {
- :controller => 'wiki_graphviz',
- :action => 'graphviz',
- :id => 'sample',
- :page => 'WikiPage'
- },
- 'wiki/sample/WikiPage/graphviz'
- )
- assert_routing(
- 'wiki/sample/WikiPage/graphviz',
- :controller => 'wiki_graphviz',
- :action => 'graphviz',
- :id => 'sample',
- :page => 'WikiPage'
- )
- end
+ :project_id => 'sample',
+ :id => 'WikiPage'
+ },
+ 'projects/sample/wiki/WikiPage/graphviz'
+ )
+ assert_routing(
+ 'projects/sample/wiki/WikiPage/graphviz',
+ :controller => 'wiki_graphviz',
+ :action => 'graphviz',
+ :project_id => 'sample',
+ :id => 'WikiPage'
+ )
end
end

0 comments on commit ef277b2

Please sign in to comment.