##// END OF EJS Templates
Refactor: extract method from WikiController#special...
Eric Davis -
r4147:c06c22cf2e29
parent child
Show More
@@ -173,9 +173,6 class WikiController < ApplicationController
173 def special
173 def special
174 page_title = params[:page].downcase
174 page_title = params[:page].downcase
175 case page_title
175 case page_title
176 # show pages index, sorted by title
177 when 'date_index'
178 load_pages_grouped_by_date_without_content
179 when 'export'
176 when 'export'
180 redirect_to :action => 'export', :id => @project # Compatibility stub while refactoring
177 redirect_to :action => 'export', :id => @project # Compatibility stub while refactoring
181 return
178 return
@@ -201,6 +198,10 class WikiController < ApplicationController
201 def page_index
198 def page_index
202 load_pages_grouped_by_date_without_content
199 load_pages_grouped_by_date_without_content
203 end
200 end
201
202 def date_index
203 load_pages_grouped_by_date_without_content
204 end
204
205
205 def preview
206 def preview
206 page = @wiki.find_page(params[:page])
207 page = @wiki.find_page(params[:page])
@@ -6,4 +6,4
6
6
7 <%= link_to l(:field_start_page), {:action => 'index', :page => nil} %><br />
7 <%= link_to l(:field_start_page), {:action => 'index', :page => nil} %><br />
8 <%= link_to l(:label_index_by_title), {:action => 'page_index'} %><br />
8 <%= link_to l(:label_index_by_title), {:action => 'page_index'} %><br />
9 <%= link_to l(:label_index_by_date), {:action => 'special', :page => 'Date_index'} %><br />
9 <%= link_to l(:label_index_by_date), {:action => 'date_index'} %><br />
1 NO CONTENT: file renamed from app/views/wiki/special_date_index.rhtml to app/views/wiki/date_index.html.erb
NO CONTENT: file renamed from app/views/wiki/special_date_index.rhtml to app/views/wiki/date_index.html.erb
@@ -31,7 +31,7 ActionController::Routing::Routes.draw do |map|
31 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
31 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
32 wiki_views.connect 'projects/:id/wiki/export', :action => 'export'
32 wiki_views.connect 'projects/:id/wiki/export', :action => 'export'
33 wiki_views.connect 'projects/:id/wiki/page_index', :action => 'page_index'
33 wiki_views.connect 'projects/:id/wiki/page_index', :action => 'page_index'
34 wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /date_index/i
34 wiki_views.connect 'projects/:id/wiki/date_index', :action => 'date_index'
35 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
35 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
36 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
36 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
37 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
37 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
@@ -111,7 +111,7 Redmine::AccessControl.map do |map|
111 map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member
111 map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member
112 map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member
112 map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member
113 map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
113 map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
114 map.permission :view_wiki_pages, :wiki => [:index, :special, :page_index]
114 map.permission :view_wiki_pages, :wiki => [:index, :special, :page_index, :date_index]
115 map.permission :export_wiki_pages, :wiki => [:export]
115 map.permission :export_wiki_pages, :wiki => [:export]
116 map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
116 map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
117 map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment]
117 map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment]
@@ -284,6 +284,18 class WikiControllerTest < ActionController::TestCase
284 end
284 end
285 end
285 end
286 end
286 end
287
288 context "GET :date_index" do
289 setup do
290 get :date_index, :id => 'ecookbook'
291 end
292
293 should_respond_with :success
294 should_assign_to :pages
295 should_assign_to :pages_by_date
296 should_render_template 'wiki/date_index'
297
298 end
287
299
288 def test_not_found
300 def test_not_found
289 get :index, :id => 999
301 get :index, :id => 999
@@ -319,7 +319,7 class RoutingTest < ActionController::IntegrationTest
319 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
319 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
320 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
320 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
321 should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'page_index', :id => '567'
321 should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'page_index', :id => '567'
322 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
322 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :id => '567'
323 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :id => '567'
323 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :id => '567'
324
324
325 should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
325 should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
General Comments 0
You need to be logged in to leave comments. Login now