@@ -234,7 +234,7 module ApplicationHelper | |||
|
234 | 234 | content << "<ul class=\"pages-hierarchy\">\n" |
|
235 | 235 | pages[node].each do |page| |
|
236 | 236 | content << "<li>" |
|
237 | content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :id => page.title}, | |
|
237 | content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :id => page.title, :version => nil}, | |
|
238 | 238 | :title => (options[:timestamp] && page.updated_on ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil)) |
|
239 | 239 | content << "\n" + render_page_hierarchy(pages, page.id, options) if pages[page.id] |
|
240 | 240 | content << "</li>\n" |
@@ -644,7 +644,7 module ApplicationHelper | |||
|
644 | 644 | wiki_page_id = page.present? ? Wiki.titleize(page) : nil |
|
645 | 645 | parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil |
|
646 | 646 | url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, |
|
647 | :id => wiki_page_id, :anchor => anchor, :parent => parent) | |
|
647 | :id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent) | |
|
648 | 648 | end |
|
649 | 649 | end |
|
650 | 650 | link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new'))) |
@@ -37,7 +37,7 module WikiHelper | |||
|
37 | 37 | |
|
38 | 38 | def wiki_page_breadcrumb(page) |
|
39 | 39 | breadcrumb(page.ancestors.reverse.collect {|parent| |
|
40 | link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project}) | |
|
40 | link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil}) | |
|
41 | 41 | }) |
|
42 | 42 | end |
|
43 | 43 | end |
@@ -28,7 +28,7 | |||
|
28 | 28 | <%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show', |
|
29 | 29 | :id => @page.title, :project_id => @page.project, |
|
30 | 30 | :version => @content.next.version) + " - " if @content.next %> |
|
31 | <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %> | |
|
31 | <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => nil) %> | |
|
32 | 32 | <br /> |
|
33 | 33 | <em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous) |
|
34 | 34 | %>, <%= format_time(@content.updated_on) %> </em><br /> |
@@ -143,8 +143,6 RedmineApp::Application.routes.draw do | |||
|
143 | 143 | end |
|
144 | 144 | |
|
145 | 145 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get |
|
146 | match 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' | |
|
147 | match 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff' | |
|
148 | 146 | resources :wiki, :except => [:index, :new, :create] do |
|
149 | 147 | member do |
|
150 | 148 | get 'rename' |
@@ -161,7 +159,9 RedmineApp::Application.routes.draw do | |||
|
161 | 159 | end |
|
162 | 160 | end |
|
163 | 161 | match 'wiki', :controller => 'wiki', :action => 'show', :via => :get |
|
164 | match 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' | |
|
162 | get 'wiki/:id/:version', :to => 'wiki#show' | |
|
163 | get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' | |
|
164 | get 'wiki/:id/:version/diff', :to => 'wiki#diff' | |
|
165 | 165 | end |
|
166 | 166 | |
|
167 | 167 | resources :issues do |
@@ -64,6 +64,28 class WikiControllerTest < ActionController::TestCase | |||
|
64 | 64 | :alt => 'This is a logo' } |
|
65 | 65 | end |
|
66 | 66 | |
|
67 | def test_show_old_version | |
|
68 | get :show, :project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2' | |
|
69 | assert_response :success | |
|
70 | assert_template 'show' | |
|
71 | ||
|
72 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/1', :text => /Previous/ | |
|
73 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/diff', :text => /diff/ | |
|
74 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/3', :text => /Next/ | |
|
75 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/ | |
|
76 | end | |
|
77 | ||
|
78 | def test_show_first_version | |
|
79 | get :show, :project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '1' | |
|
80 | assert_response :success | |
|
81 | assert_template 'show' | |
|
82 | ||
|
83 | assert_select 'a', :text => /Previous/, :count => 0 | |
|
84 | assert_select 'a', :text => /diff/, :count => 0 | |
|
85 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2', :text => /Next/ | |
|
86 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/ | |
|
87 | end | |
|
88 | ||
|
67 | 89 | def test_show_redirected_page |
|
68 | 90 | WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page') |
|
69 | 91 | |
@@ -477,12 +499,17 class WikiControllerTest < ActionController::TestCase | |||
|
477 | 499 | end |
|
478 | 500 | |
|
479 | 501 | def test_history |
|
480 |
get :history, :project_id => |
|
|
502 | get :history, :project_id => 'ecookbook', :id => 'CookBook_documentation' | |
|
481 | 503 | assert_response :success |
|
482 | 504 | assert_template 'history' |
|
483 | 505 | assert_not_nil assigns(:versions) |
|
484 | 506 | assert_equal 3, assigns(:versions).size |
|
507 | ||
|
485 | 508 | assert_select "input[type=submit][name=commit]" |
|
509 | assert_select 'td' do | |
|
510 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2', :text => '2' | |
|
511 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/annotate' | |
|
512 | end | |
|
486 | 513 | end |
|
487 | 514 | |
|
488 | 515 | def test_history_with_one_version |
@@ -39,17 +39,12 class RoutingWikiTest < ActionController::IntegrationTest | |||
|
39 | 39 | :id => 'CookBook_documentation' } |
|
40 | 40 | ) |
|
41 | 41 | assert_routing( |
|
42 |
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff |
|
|
42 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/diff" }, | |
|
43 | 43 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
44 | 44 | :id => 'CookBook_documentation', :version => '2' } |
|
45 | 45 | ) |
|
46 | 46 | assert_routing( |
|
47 |
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/ |
|
|
48 | { :controller => 'wiki', :action => 'diff', :project_id => '1', | |
|
49 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } | |
|
50 | ) | |
|
51 | assert_routing( | |
|
52 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, | |
|
47 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/annotate" }, | |
|
53 | 48 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', |
|
54 | 49 | :id => 'CookBook_documentation', :version => '2' } |
|
55 | 50 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now