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