Wiki page versions routes cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10687 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
9ec142713d
commit
d66b3452db
|
@ -234,7 +234,7 @@ module ApplicationHelper
|
||||||
content << "<ul class=\"pages-hierarchy\">\n"
|
content << "<ul class=\"pages-hierarchy\">\n"
|
||||||
pages[node].each do |page|
|
pages[node].each do |page|
|
||||||
content << "<li>"
|
content << "<li>"
|
||||||
content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :id => page.title},
|
content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :id => page.title, :version => nil},
|
||||||
:title => (options[:timestamp] && page.updated_on ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil))
|
:title => (options[:timestamp] && page.updated_on ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil))
|
||||||
content << "\n" + render_page_hierarchy(pages, page.id, options) if pages[page.id]
|
content << "\n" + render_page_hierarchy(pages, page.id, options) if pages[page.id]
|
||||||
content << "</li>\n"
|
content << "</li>\n"
|
||||||
|
@ -644,7 +644,7 @@ module ApplicationHelper
|
||||||
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
||||||
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
|
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
|
||||||
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
|
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
|
||||||
:id => wiki_page_id, :anchor => anchor, :parent => parent)
|
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
|
link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
|
||||||
|
|
|
@ -37,7 +37,7 @@ module WikiHelper
|
||||||
|
|
||||||
def wiki_page_breadcrumb(page)
|
def wiki_page_breadcrumb(page)
|
||||||
breadcrumb(page.ancestors.reverse.collect {|parent|
|
breadcrumb(page.ancestors.reverse.collect {|parent|
|
||||||
link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project})
|
link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil})
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show',
|
<%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show',
|
||||||
:id => @page.title, :project_id => @page.project,
|
:id => @page.title, :project_id => @page.project,
|
||||||
:version => @content.next.version) + " - " if @content.next %>
|
:version => @content.next.version) + " - " if @content.next %>
|
||||||
<%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %>
|
<%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => nil) %>
|
||||||
<br />
|
<br />
|
||||||
<em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)
|
<em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)
|
||||||
%>, <%= format_time(@content.updated_on) %> </em><br />
|
%>, <%= format_time(@content.updated_on) %> </em><br />
|
||||||
|
|
|
@ -143,8 +143,6 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
|
match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
|
||||||
match 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
|
|
||||||
match 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff'
|
|
||||||
resources :wiki, :except => [:index, :new, :create] do
|
resources :wiki, :except => [:index, :new, :create] do
|
||||||
member do
|
member do
|
||||||
get 'rename'
|
get 'rename'
|
||||||
|
@ -161,7 +159,9 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
|
match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
|
||||||
match 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
|
get 'wiki/:id/:version', :to => 'wiki#show'
|
||||||
|
get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
|
||||||
|
get 'wiki/:id/:version/diff', :to => 'wiki#diff'
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :issues do
|
resources :issues do
|
||||||
|
|
|
@ -64,6 +64,28 @@ class WikiControllerTest < ActionController::TestCase
|
||||||
:alt => 'This is a logo' }
|
:alt => 'This is a logo' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_show_old_version
|
||||||
|
get :show, :project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'show'
|
||||||
|
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/1', :text => /Previous/
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/diff', :text => /diff/
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/3', :text => /Next/
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_show_first_version
|
||||||
|
get :show, :project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '1'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'show'
|
||||||
|
|
||||||
|
assert_select 'a', :text => /Previous/, :count => 0
|
||||||
|
assert_select 'a', :text => /diff/, :count => 0
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2', :text => /Next/
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/
|
||||||
|
end
|
||||||
|
|
||||||
def test_show_redirected_page
|
def test_show_redirected_page
|
||||||
WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page')
|
WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page')
|
||||||
|
|
||||||
|
@ -477,12 +499,17 @@ class WikiControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_history
|
def test_history
|
||||||
get :history, :project_id => 1, :id => 'CookBook_documentation'
|
get :history, :project_id => 'ecookbook', :id => 'CookBook_documentation'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'history'
|
assert_template 'history'
|
||||||
assert_not_nil assigns(:versions)
|
assert_not_nil assigns(:versions)
|
||||||
assert_equal 3, assigns(:versions).size
|
assert_equal 3, assigns(:versions).size
|
||||||
|
|
||||||
assert_select "input[type=submit][name=commit]"
|
assert_select "input[type=submit][name=commit]"
|
||||||
|
assert_select 'td' do
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2', :text => '2'
|
||||||
|
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/annotate'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_history_with_one_version
|
def test_history_with_one_version
|
||||||
|
|
|
@ -39,17 +39,12 @@ class RoutingWikiTest < ActionController::IntegrationTest
|
||||||
:id => 'CookBook_documentation' }
|
:id => 'CookBook_documentation' }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
|
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/diff" },
|
||||||
{ :controller => 'wiki', :action => 'diff', :project_id => '1',
|
{ :controller => 'wiki', :action => 'diff', :project_id => '1',
|
||||||
:id => 'CookBook_documentation', :version => '2' }
|
:id => 'CookBook_documentation', :version => '2' }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
|
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/annotate" },
|
||||||
{ :controller => 'wiki', :action => 'diff', :project_id => '1',
|
|
||||||
:id => 'CookBook_documentation', :version => '2', :version_from => '1' }
|
|
||||||
)
|
|
||||||
assert_routing(
|
|
||||||
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
|
|
||||||
{ :controller => 'wiki', :action => 'annotate', :project_id => '1',
|
{ :controller => 'wiki', :action => 'annotate', :project_id => '1',
|
||||||
:id => 'CookBook_documentation', :version => '2' }
|
:id => 'CookBook_documentation', :version => '2' }
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue