diff options
-rw-r--r-- | app/controllers/wiki_controller.rb | 18 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 4 | ||||
-rw-r--r-- | app/views/wiki/_sidebar.rhtml | 2 | ||||
-rw-r--r-- | app/views/wiki/annotate.rhtml | 4 | ||||
-rw-r--r-- | app/views/wiki/date_index.html.erb | 6 | ||||
-rw-r--r-- | app/views/wiki/destroy.rhtml | 2 | ||||
-rw-r--r-- | app/views/wiki/diff.rhtml | 4 | ||||
-rw-r--r-- | app/views/wiki/history.rhtml | 2 | ||||
-rw-r--r-- | app/views/wiki/page_index.html.erb | 4 | ||||
-rw-r--r-- | app/views/wiki/show.rhtml | 6 | ||||
-rw-r--r-- | config/routes.rb | 2 | ||||
-rw-r--r-- | lib/redmine.rb | 4 | ||||
-rw-r--r-- | test/functional/wiki_controller_test.rb | 28 | ||||
-rw-r--r-- | test/integration/routing_test.rb | 4 |
14 files changed, 45 insertions, 45 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 75902d542..95e1943e9 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -22,14 +22,14 @@ class WikiController < ApplicationController before_filter :find_wiki, :authorize before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy] - verify :method => :post, :only => [:destroy, :protect], :redirect_to => { :action => :index } + verify :method => :post, :only => [:destroy, :protect], :redirect_to => { :action => :show } helper :attachments include AttachmentsHelper helper :watchers - + # display a page (in editing mode if it doesn't exist) - def index + def show page_title = params[:page] @page = @wiki.find_or_new_page(page_title) if @page.new_record? @@ -79,7 +79,7 @@ class WikiController < ApplicationController attachments = Attachment.attach_files(@page, params[:attachments]) render_attachment_warning_if_needed(@page) # don't save if text wasn't changed - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title return end #@content.text = params[:content][:text] @@ -91,7 +91,7 @@ class WikiController < ApplicationController attachments = Attachment.attach_files(@page, params[:attachments]) render_attachment_warning_if_needed(@page) call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page}) - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title end end rescue ActiveRecord::StaleObjectError @@ -107,13 +107,13 @@ class WikiController < ApplicationController @original_title = @page.pretty_title if request.post? && @page.update_attributes(params[:wiki_page]) flash[:notice] = l(:notice_successful_update) - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title end end def protect @page.update_attribute :protected, params[:protected] - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title end # show page history @@ -176,7 +176,7 @@ class WikiController < ApplicationController export = render_to_string :action => 'export_multiple', :layout => false send_data(export, :type => 'text/html', :filename => "wiki.html") else - redirect_to :action => 'index', :project_id => @project, :page => nil + redirect_to :action => 'show', :project_id => @project, :page => nil end end @@ -204,7 +204,7 @@ class WikiController < ApplicationController return render_403 unless editable? attachments = Attachment.attach_files(@page, params[:attachments]) render_attachment_warning_if_needed(@page) - redirect_to :action => 'index', :page => @page.title + redirect_to :action => 'show', :page => @page.title end private diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2ac301d53..fb4b84d7c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -182,7 +182,7 @@ module ApplicationHelper content << "<ul class=\"pages-hierarchy\">\n" pages[node].each do |page| content << "<li>" - content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'index', :project_id => page.project, :page => page.title}, + content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :page => page.title}, :title => (page.respond_to?(: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) if pages[page.id] content << "</li>\n" @@ -551,7 +551,7 @@ module ApplicationHelper when :local; "#{title}.html" when :anchor; "##{title}" # used for single-file wiki export else - url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :project_id => link_project, :page => Wiki.titleize(page), :anchor => anchor) + url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, :page => Wiki.titleize(page), :anchor => anchor) end link_to((title || page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new'))) else diff --git a/app/views/wiki/_sidebar.rhtml b/app/views/wiki/_sidebar.rhtml index c6e5e6ab8..efb24af06 100644 --- a/app/views/wiki/_sidebar.rhtml +++ b/app/views/wiki/_sidebar.rhtml @@ -4,6 +4,6 @@ <h3><%= l(:label_wiki) %></h3> -<%= link_to l(:field_start_page), {:action => 'index', :page => nil} %><br /> +<%= link_to l(:field_start_page), {:action => 'show', :page => nil} %><br /> <%= link_to l(:label_index_by_title), {:action => 'page_index'} %><br /> <%= link_to l(:label_index_by_date), {:action => 'date_index'} %><br /> diff --git a/app/views/wiki/annotate.rhtml b/app/views/wiki/annotate.rhtml index 9d3b32827..1e664fb84 100644 --- a/app/views/wiki/annotate.rhtml +++ b/app/views/wiki/annotate.rhtml @@ -6,7 +6,7 @@ <h2><%= @page.pretty_title %></h2> <p> -<%= l(:label_version) %> <%= link_to @annotate.content.version, :action => 'index', :page => @page.title, :version => @annotate.content.version %> +<%= l(:label_version) %> <%= link_to @annotate.content.version, :action => 'show', :page => @page.title, :version => @annotate.content.version %> <em>(<%= @annotate.content.author ? @annotate.content.author.name : "anonyme" %>, <%= format_time(@annotate.content.updated_on) %>)</em> </p> @@ -18,7 +18,7 @@ <% @annotate.lines.each do |line| -%> <tr class="bloc-<%= colors[line[0]] %>"> <th class="line-num"><%= line_num %></th> - <td class="revision"><%= link_to line[0], :controller => 'wiki', :action => 'index', :project_id => @project, :page => @page.title, :version => line[0] %></td> + <td class="revision"><%= link_to line[0], :controller => 'wiki', :action => 'show', :project_id => @project, :page => @page.title, :version => line[0] %></td> <td class="author"><%= h(line[1]) %></td> <td class="line-code"><pre><%=h line[2] %></pre></td> </tr> diff --git a/app/views/wiki/date_index.html.erb b/app/views/wiki/date_index.html.erb index 957c15967..086d8f632 100644 --- a/app/views/wiki/date_index.html.erb +++ b/app/views/wiki/date_index.html.erb @@ -12,7 +12,7 @@ <h3><%= format_date(date) %></h3> <ul> <% @pages_by_date[date].each do |page| %> - <li><%= link_to page.pretty_title, :action => 'index', :page => page.title %></li> + <li><%= link_to page.pretty_title, :action => 'show', :page => page.title %></li> <% end %> </ul> <% end %> @@ -23,11 +23,11 @@ <% unless @pages.empty? %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %> <%= f.link_to('HTML', :url => {:action => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %> <% end %> <% end %> <% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %> +<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %> <% end %> diff --git a/app/views/wiki/destroy.rhtml b/app/views/wiki/destroy.rhtml index 77f20ef5e..83c81fd5c 100644 --- a/app/views/wiki/destroy.rhtml +++ b/app/views/wiki/destroy.rhtml @@ -15,5 +15,5 @@ </div> <%= submit_tag l(:button_apply) %> -<%= link_to l(:button_cancel), :controller => 'wiki', :action => 'index', :project_id => @project, :page => @page.title %> +<%= link_to l(:button_cancel), :controller => 'wiki', :action => 'show', :project_id => @project, :page => @page.title %> <% end %> diff --git a/app/views/wiki/diff.rhtml b/app/views/wiki/diff.rhtml index 9095be560..a9eebdb9a 100644 --- a/app/views/wiki/diff.rhtml +++ b/app/views/wiki/diff.rhtml @@ -5,10 +5,10 @@ <h2><%= @page.pretty_title %></h2> <p> -<%= l(:label_version) %> <%= link_to @diff.content_from.version, :action => 'index', :page => @page.title, :version => @diff.content_from.version %> +<%= l(:label_version) %> <%= link_to @diff.content_from.version, :action => 'show', :page => @page.title, :version => @diff.content_from.version %> <em>(<%= @diff.content_from.author ? @diff.content_from.author.name : "anonyme" %>, <%= format_time(@diff.content_from.updated_on) %>)</em> → -<%= l(:label_version) %> <%= link_to @diff.content_to.version, :action => 'index', :page => @page.title, :version => @diff.content_to.version %>/<%= @page.content.version %> +<%= l(:label_version) %> <%= link_to @diff.content_to.version, :action => 'show', :page => @page.title, :version => @diff.content_to.version %>/<%= @page.content.version %> <em>(<%= @diff.content_to.author ? @diff.content_to.author.name : "anonyme" %>, <%= format_time(@diff.content_to.updated_on) %>)</em> </p> diff --git a/app/views/wiki/history.rhtml b/app/views/wiki/history.rhtml index 3f07d55e6..1f73fd173 100644 --- a/app/views/wiki/history.rhtml +++ b/app/views/wiki/history.rhtml @@ -19,7 +19,7 @@ <% line_num = 1 %> <% @versions.each do |ver| %> <tr class="<%= cycle("odd", "even") %>"> - <td class="id"><%= link_to ver.version, :action => 'index', :page => @page.title, :version => ver.version %></td> + <td class="id"><%= link_to ver.version, :action => 'show', :page => @page.title, :version => ver.version %></td> <td class="checkbox"><%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < @versions.size) %></td> <td class="checkbox"><%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %></td> <td align="center"><%= format_time(ver.updated_on) %></td> diff --git a/app/views/wiki/page_index.html.erb b/app/views/wiki/page_index.html.erb index e85f83b91..7e7155fda 100644 --- a/app/views/wiki/page_index.html.erb +++ b/app/views/wiki/page_index.html.erb @@ -16,11 +16,11 @@ <% unless @pages.empty? %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %> <%= f.link_to('HTML', :url => {:action => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %> <% end %> <% end %> <% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %> +<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %> <% end %> diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index 690e9102b..00feab8b9 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -15,11 +15,11 @@ <% if @content.version != @page.content.version %> <p> - <%= link_to(('« ' + l(:label_previous)), :action => 'index', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %> + <%= link_to(('« ' + l(:label_previous)), :action => 'show', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %> <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :page => @page.title, :version => @content.version) + ')' if @content.version > 1 %> - - <%= link_to((l(:label_next) + ' »'), :action => 'index', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> - <%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %> + <%= link_to((l(:label_next) + ' »'), :action => 'show', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> + <%= link_to(l(:label_current_version), :action => 'show', :page => @page.title) %> <br /> <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br /> <%=h @content.comments %> diff --git a/config/routes.rb b/config/routes.rb index 764d540c8..84d00c687 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,7 +32,7 @@ ActionController::Routing::Routes.draw do |map| wiki_views.connect 'projects/:project_id/wiki/export', :action => 'export' wiki_views.connect 'projects/:project_id/wiki/page_index', :action => 'page_index' wiki_views.connect 'projects/:project_id/wiki/date_index', :action => 'date_index' - wiki_views.connect 'projects/:project_id/wiki/:page', :action => 'index', :page => nil + wiki_views.connect 'projects/:project_id/wiki/:page', :action => 'show', :page => nil wiki_views.connect 'projects/:project_id/wiki/:page/edit', :action => 'edit' wiki_views.connect 'projects/:project_id/wiki/:page/rename', :action => 'rename' wiki_views.connect 'projects/:project_id/wiki/:page/history', :action => 'history' diff --git a/lib/redmine.rb b/lib/redmine.rb index 7fe090826..d5825e00f 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -111,7 +111,7 @@ Redmine::AccessControl.map do |map| map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member - map.permission :view_wiki_pages, :wiki => [:index, :special, :page_index, :date_index] + map.permission :view_wiki_pages, :wiki => [:show, :special, :page_index, :date_index] map.permission :export_wiki_pages, :wiki => [:export] map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] @@ -195,7 +195,7 @@ Redmine::MenuManager.map :project_menu do |menu| menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural - menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, :param => :project_id, + menu.push :wiki, { :controller => 'wiki', :action => 'show', :page => nil }, :param => :project_id, :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 4eb33ca37..cd8c3448d 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -32,7 +32,7 @@ class WikiControllerTest < ActionController::TestCase end def test_show_start_page - get :index, :project_id => 'ecookbook' + get :show, :project_id => 'ecookbook' assert_response :success assert_template 'show' assert_tag :tag => 'h1', :content => /CookBook documentation/ @@ -45,7 +45,7 @@ class WikiControllerTest < ActionController::TestCase end def test_show_page_with_name - get :index, :project_id => 1, :page => 'Another_page' + get :show, :project_id => 1, :page => 'Another_page' assert_response :success assert_template 'show' assert_tag :tag => 'h1', :content => /Another page/ @@ -60,20 +60,20 @@ class WikiControllerTest < ActionController::TestCase page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') page.save! - get :index, :project_id => 1, :page => 'Another_page' + get :show, :project_id => 1, :page => 'Another_page' assert_response :success assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, :content => /Side bar content for test_show_with_sidebar/ end def test_show_unexistent_page_without_edit_right - get :index, :project_id => 1, :page => 'Unexistent page' + get :show, :project_id => 1, :page => 'Unexistent page' assert_response 404 end def test_show_unexistent_page_with_edit_right @request.session[:user_id] = 2 - get :index, :project_id => 1, :page => 'Unexistent page' + get :show, :project_id => 1, :page => 'Unexistent page' assert_response :success assert_template 'edit' end @@ -85,7 +85,7 @@ class WikiControllerTest < ActionController::TestCase :content => {:comments => 'Created the page', :text => "h1. New page\n\nThis is a new page", :version => 0} - assert_redirected_to :action => 'index', :project_id => 'ecookbook', :page => 'New_page' + assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'New_page' page = Project.find(1).wiki.find_page('New page') assert !page.new_record? assert_not_nil page.content @@ -176,7 +176,7 @@ class WikiControllerTest < ActionController::TestCase post :rename, :project_id => 1, :page => 'Another_page', :wiki_page => { :title => 'Another renamed page', :redirect_existing_links => 1 } - assert_redirected_to :action => 'index', :project_id => 'ecookbook', :page => 'Another_renamed_page' + assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_renamed_page' wiki = Project.find(1).wiki # Check redirects assert_not_nil wiki.find_page('Another page') @@ -188,7 +188,7 @@ class WikiControllerTest < ActionController::TestCase post :rename, :project_id => 1, :page => 'Another_page', :wiki_page => { :title => 'Another renamed page', :redirect_existing_links => "0" } - assert_redirected_to :action => 'index', :project_id => 'ecookbook', :page => 'Another_renamed_page' + assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_renamed_page' wiki = Project.find(1).wiki # Check that there's no redirects assert_nil wiki.find_page('Another page') @@ -280,7 +280,7 @@ class WikiControllerTest < ActionController::TestCase get :export, :project_id => 'ecookbook' should_respond_with :redirect - should_redirect_to('wiki index') { {:action => 'index', :project_id => @project, :page => nil} } + should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :page => nil} } end end end @@ -298,7 +298,7 @@ class WikiControllerTest < ActionController::TestCase end def test_not_found - get :index, :project_id => 999 + get :show, :project_id => 999 assert_response 404 end @@ -307,7 +307,7 @@ class WikiControllerTest < ActionController::TestCase assert !page.protected? @request.session[:user_id] = 2 post :protect, :project_id => 1, :page => page.title, :protected => '1' - assert_redirected_to :action => 'index', :project_id => 'ecookbook', :page => 'Another_page' + assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_page' assert page.reload.protected? end @@ -316,13 +316,13 @@ class WikiControllerTest < ActionController::TestCase assert page.protected? @request.session[:user_id] = 2 post :protect, :project_id => 1, :page => page.title, :protected => '0' - assert_redirected_to :action => 'index', :project_id => 'ecookbook', :page => 'CookBook_documentation' + assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'CookBook_documentation' assert !page.reload.protected? end def test_show_page_with_edit_link @request.session[:user_id] = 2 - get :index, :project_id => 1 + get :show, :project_id => 1 assert_response :success assert_template 'show' assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } @@ -330,7 +330,7 @@ class WikiControllerTest < ActionController::TestCase def test_show_page_without_edit_link @request.session[:user_id] = 4 - get :index, :project_id => 1 + get :show, :project_id => 1 assert_response :success assert_template 'show' assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 00ab7b38f..f44d3c94e 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -311,8 +311,8 @@ class RoutingTest < ActionController::IntegrationTest end context "wiki (singular, project's pages)" do - should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :project_id => '567' - should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :project_id => '567', :page => 'lalala' + should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' + should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :page => 'lalala' should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :page => 'my_page' should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :page => 'CookBook_documentation' should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1' |