##// END OF EJS Templates
Refactor: convert News to a REST resource...
Eric Davis -
r4100:79e30e7087d7
parent child
Show More
@@ -1,6 +1,6
1 <p><%= link_to_project(news.project) + ': ' unless @project %>
1 <p><%= link_to_project(news.project) + ': ' unless @project %>
2 <%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %>
2 <%= link_to h(news.title), news_path(news) %>
3 <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %>
3 <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %>
4 <br />
4 <br />
5 <% unless news.summary.blank? %><span class="summary"><%=h news.summary %></span><br /><% end %>
5 <% unless news.summary.blank? %><span class="summary"><%=h news.summary %></span><br /><% end %>
6 <span class="author"><%= authoring news.created_on, news.author %></span></p>
6 <span class="author"><%= authoring news.created_on, news.author %></span></p>
@@ -1,18 +1,18
1 <h2><%=l(:label_news)%></h2>
1 <h2><%=l(:label_news)%></h2>
2
2
3 <% labelled_tabular_form_for :news, @news, :url => { :action => "update" },
3 <% labelled_tabular_form_for :news, @news, :url => news_path(@news),
4 :html => { :id => 'news-form', :method => :put } do |f| %>
4 :html => { :id => 'news-form', :method => :put } do |f| %>
5 <%= render :partial => 'form', :locals => { :f => f } %>
5 <%= render :partial => 'form', :locals => { :f => f } %>
6 <%= submit_tag l(:button_save) %>
6 <%= submit_tag l(:button_save) %>
7 <%= link_to_remote l(:label_preview),
7 <%= link_to_remote l(:label_preview),
8 { :url => { :controller => 'previews', :action => 'news', :project_id => @project },
8 { :url => preview_news_path(:project_id => @project),
9 :method => 'get',
9 :method => 'get',
10 :update => 'preview',
10 :update => 'preview',
11 :with => "Form.serialize('news-form')"
11 :with => "Form.serialize('news-form')"
12 }, :accesskey => accesskey(:preview) %>
12 }, :accesskey => accesskey(:preview) %>
13 <% end %>
13 <% end %>
14 <div id="preview" class="wiki"></div>
14 <div id="preview" class="wiki"></div>
15
15
16 <% content_for :header_tags do %>
16 <% content_for :header_tags do %>
17 <%= stylesheet_link_tag 'scm' %>
17 <%= stylesheet_link_tag 'scm' %>
18 <% end %>
18 <% end %>
@@ -1,51 +1,51
1 <div class="contextual">
1 <div class="contextual">
2 <%= link_to_if_authorized(l(:label_news_new),
2 <%= link_to_if_authorized(l(:label_news_new),
3 {:controller => 'news', :action => 'new', :project_id => @project},
3 new_project_news_path(@project),
4 :class => 'icon icon-add',
4 :class => 'icon icon-add',
5 :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project %>
5 :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project %>
6 </div>
6 </div>
7
7
8 <div id="add-news" style="display:none;">
8 <div id="add-news" style="display:none;">
9 <h2><%=l(:label_news_new)%></h2>
9 <h2><%=l(:label_news_new)%></h2>
10 <% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'create', :project_id => @project },
10 <% labelled_tabular_form_for :news, @news, :url => project_news_index_path(@project),
11 :html => { :id => 'news-form' } do |f| %>
11 :html => { :id => 'news-form' } do |f| %>
12 <%= render :partial => 'news/form', :locals => { :f => f } %>
12 <%= render :partial => 'news/form', :locals => { :f => f } %>
13 <%= submit_tag l(:button_create) %>
13 <%= submit_tag l(:button_create) %>
14 <%= link_to_remote l(:label_preview),
14 <%= link_to_remote l(:label_preview),
15 { :url => { :controller => 'previews', :action => 'news', :project_id => @project },
15 { :url => preview_news_path(:project_id => @project),
16 :method => 'get',
16 :method => 'get',
17 :update => 'preview',
17 :update => 'preview',
18 :with => "Form.serialize('news-form')"
18 :with => "Form.serialize('news-form')"
19 }, :accesskey => accesskey(:preview) %> |
19 }, :accesskey => accesskey(:preview) %> |
20 <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %>
20 <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %>
21 <% end if @project %>
21 <% end if @project %>
22 <div id="preview" class="wiki"></div>
22 <div id="preview" class="wiki"></div>
23 </div>
23 </div>
24
24
25 <h2><%=l(:label_news_plural)%></h2>
25 <h2><%=l(:label_news_plural)%></h2>
26
26
27 <% if @newss.empty? %>
27 <% if @newss.empty? %>
28 <p class="nodata"><%= l(:label_no_data) %></p>
28 <p class="nodata"><%= l(:label_no_data) %></p>
29 <% else %>
29 <% else %>
30 <% @newss.each do |news| %>
30 <% @newss.each do |news| %>
31 <h3><%= link_to_project(news.project) + ': ' unless news.project == @project %>
31 <h3><%= link_to_project(news.project) + ': ' unless news.project == @project %>
32 <%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %>
32 <%= link_to h(news.title), news_path(news) %>
33 <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3>
33 <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3>
34 <p class="author"><%= authoring news.created_on, news.author %></p>
34 <p class="author"><%= authoring news.created_on, news.author %></p>
35 <div class="wiki">
35 <div class="wiki">
36 <%= textilizable(news.description) %>
36 <%= textilizable(news.description) %>
37 </div>
37 </div>
38 <% end %>
38 <% end %>
39 <% end %>
39 <% end %>
40 <p class="pagination"><%= pagination_links_full @news_pages %></p>
40 <p class="pagination"><%= pagination_links_full @news_pages %></p>
41
41
42 <% other_formats_links do |f| %>
42 <% other_formats_links do |f| %>
43 <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
43 <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
44 <% end %>
44 <% end %>
45
45
46 <% content_for :header_tags do %>
46 <% content_for :header_tags do %>
47 <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
47 <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
48 <%= stylesheet_link_tag 'scm' %>
48 <%= stylesheet_link_tag 'scm' %>
49 <% end %>
49 <% end %>
50
50
51 <% html_title(l(:label_news_plural)) -%>
51 <% html_title(l(:label_news_plural)) -%>
@@ -1,14 +1,14
1 <h2><%=l(:label_news_new)%></h2>
1 <h2><%=l(:label_news_new)%></h2>
2
2
3 <% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'create', :project_id => @project },
3 <% labelled_tabular_form_for :news, @news, :url => project_news_index_path(@project),
4 :html => { :id => 'news-form' } do |f| %>
4 :html => { :id => 'news-form' } do |f| %>
5 <%= render :partial => 'news/form', :locals => { :f => f } %>
5 <%= render :partial => 'news/form', :locals => { :f => f } %>
6 <%= submit_tag l(:button_create) %>
6 <%= submit_tag l(:button_create) %>
7 <%= link_to_remote l(:label_preview),
7 <%= link_to_remote l(:label_preview),
8 { :url => { :controller => 'previews', :action => 'news', :project_id => @project },
8 { :url => preview_news_path(:project_id => @project),
9 :method => 'get',
9 :method => 'get',
10 :update => 'preview',
10 :update => 'preview',
11 :with => "Form.serialize('news-form')"
11 :with => "Form.serialize('news-form')"
12 }, :accesskey => accesskey(:preview) %>
12 }, :accesskey => accesskey(:preview) %>
13 <% end %>
13 <% end %>
14 <div id="preview" class="wiki"></div>
14 <div id="preview" class="wiki"></div>
@@ -1,65 +1,65
1 <div class="contextual">
1 <div class="contextual">
2 <%= link_to_if_authorized l(:button_edit),
2 <%= link_to_if_authorized l(:button_edit),
3 {:controller => 'news', :action => 'edit', :id => @news},
3 edit_news_path(@news),
4 :class => 'icon icon-edit',
4 :class => 'icon icon-edit',
5 :accesskey => accesskey(:edit),
5 :accesskey => accesskey(:edit),
6 :onclick => 'Element.show("edit-news"); return false;' %>
6 :onclick => 'Element.show("edit-news"); return false;' %>
7 <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
7 <%= link_to_if_authorized l(:button_delete), news_path(@news), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
8 </div>
8 </div>
9
9
10 <h2><%= avatar(@news.author, :size => "24") %><%=h @news.title %></h2>
10 <h2><%= avatar(@news.author, :size => "24") %><%=h @news.title %></h2>
11
11
12 <% if authorize_for('news', 'edit') %>
12 <% if authorize_for('news', 'edit') %>
13 <div id="edit-news" style="display:none;">
13 <div id="edit-news" style="display:none;">
14 <% labelled_tabular_form_for :news, @news, :url => { :action => "update", :id => @news },
14 <% labelled_tabular_form_for :news, @news, :url => news_path(@news),
15 :html => { :id => 'news-form', :method => :put } do |f| %>
15 :html => { :id => 'news-form', :method => :put } do |f| %>
16 <%= render :partial => 'form', :locals => { :f => f } %>
16 <%= render :partial => 'form', :locals => { :f => f } %>
17 <%= submit_tag l(:button_save) %>
17 <%= submit_tag l(:button_save) %>
18 <%= link_to_remote l(:label_preview),
18 <%= link_to_remote l(:label_preview),
19 { :url => { :controller => 'previews', :action => 'news', :project_id => @project },
19 { :url => preview_news_path(:project_id => @project),
20 :method => 'get',
20 :method => 'get',
21 :update => 'preview',
21 :update => 'preview',
22 :with => "Form.serialize('news-form')"
22 :with => "Form.serialize('news-form')"
23 }, :accesskey => accesskey(:preview) %> |
23 }, :accesskey => accesskey(:preview) %> |
24 <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news"); return false;' %>
24 <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news"); return false;' %>
25 <% end %>
25 <% end %>
26 <div id="preview" class="wiki"></div>
26 <div id="preview" class="wiki"></div>
27 </div>
27 </div>
28 <% end %>
28 <% end %>
29
29
30 <p><% unless @news.summary.blank? %><em><%=h @news.summary %></em><br /><% end %>
30 <p><% unless @news.summary.blank? %><em><%=h @news.summary %></em><br /><% end %>
31 <span class="author"><%= authoring @news.created_on, @news.author %></span></p>
31 <span class="author"><%= authoring @news.created_on, @news.author %></span></p>
32 <div class="wiki">
32 <div class="wiki">
33 <%= textilizable(@news.description) %>
33 <%= textilizable(@news.description) %>
34 </div>
34 </div>
35 <br />
35 <br />
36
36
37 <div id="comments" style="margin-bottom:16px;">
37 <div id="comments" style="margin-bottom:16px;">
38 <h3 class="comments"><%= l(:label_comment_plural) %></h3>
38 <h3 class="comments"><%= l(:label_comment_plural) %></h3>
39 <% @comments.each do |comment| %>
39 <% @comments.each do |comment| %>
40 <% next if comment.new_record? %>
40 <% next if comment.new_record? %>
41 <div class="contextual">
41 <div class="contextual">
42 <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
42 <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
43 :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %>
43 :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %>
44 </div>
44 </div>
45 <h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
45 <h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
46 <%= textilizable(comment.comments) %>
46 <%= textilizable(comment.comments) %>
47 <% end if @comments.any? %>
47 <% end if @comments.any? %>
48 </div>
48 </div>
49
49
50 <% if authorize_for 'comments', 'create' %>
50 <% if authorize_for 'comments', 'create' %>
51 <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p>
51 <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p>
52 <% form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
52 <% form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
53 <div class="box">
53 <div class="box">
54 <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
54 <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
55 <%= wikitoolbar_for 'comment_comments' %>
55 <%= wikitoolbar_for 'comment_comments' %>
56 </div>
56 </div>
57 <p><%= submit_tag l(:button_add) %></p>
57 <p><%= submit_tag l(:button_add) %></p>
58 <% end %>
58 <% end %>
59 <% end %>
59 <% end %>
60
60
61 <% html_title @news.title -%>
61 <% html_title @news.title -%>
62
62
63 <% content_for :header_tags do %>
63 <% content_for :header_tags do %>
64 <%= stylesheet_link_tag 'scm' %>
64 <%= stylesheet_link_tag 'scm' %>
65 <% end %>
65 <% end %>
@@ -1,275 +1,259
1 ActionController::Routing::Routes.draw do |map|
1 ActionController::Routing::Routes.draw do |map|
2 # Add your own custom routes here.
2 # Add your own custom routes here.
3 # The priority is based upon order of creation: first created -> highest priority.
3 # The priority is based upon order of creation: first created -> highest priority.
4
4
5 # Here's a sample route:
5 # Here's a sample route:
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 # Keep in mind you can assign values other than :controller and :action
7 # Keep in mind you can assign values other than :controller and :action
8
8
9 map.home '', :controller => 'welcome'
9 map.home '', :controller => 'welcome'
10
10
11 map.signin 'login', :controller => 'account', :action => 'login'
11 map.signin 'login', :controller => 'account', :action => 'login'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
13
13
14 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
14 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
16
16
17 map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
17 map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
18 map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog'
18 map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog'
19 map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
19 map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
20
20
21 map.with_options :controller => 'timelog' do |timelog|
21 map.with_options :controller => 'timelog' do |timelog|
22 timelog.connect 'projects/:project_id/time_entries', :action => 'details'
22 timelog.connect 'projects/:project_id/time_entries', :action => 'details'
23
23
24 timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
24 timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
25 time_details.connect 'time_entries'
25 time_details.connect 'time_entries'
26 time_details.connect 'time_entries.:format'
26 time_details.connect 'time_entries.:format'
27 time_details.connect 'issues/:issue_id/time_entries'
27 time_details.connect 'issues/:issue_id/time_entries'
28 time_details.connect 'issues/:issue_id/time_entries.:format'
28 time_details.connect 'issues/:issue_id/time_entries.:format'
29 time_details.connect 'projects/:project_id/time_entries.:format'
29 time_details.connect 'projects/:project_id/time_entries.:format'
30 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries'
30 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries'
31 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
31 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
32 end
32 end
33 timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
33 timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
34 timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
34 timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
35 time_report.connect 'time_entries/report'
35 time_report.connect 'time_entries/report'
36 time_report.connect 'time_entries/report.:format'
36 time_report.connect 'time_entries/report.:format'
37 time_report.connect 'projects/:project_id/time_entries/report.:format'
37 time_report.connect 'projects/:project_id/time_entries/report.:format'
38 end
38 end
39
39
40 timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
40 timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
41 time_edit.connect 'issues/:issue_id/time_entries/new'
41 time_edit.connect 'issues/:issue_id/time_entries/new'
42 end
42 end
43
43
44 timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
44 timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
45 end
45 end
46
46
47 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
47 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
48 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
48 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
49 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
49 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
50 map.with_options :controller => 'wiki' do |wiki_routes|
50 map.with_options :controller => 'wiki' do |wiki_routes|
51 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
51 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
52 wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i
52 wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i
53 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
53 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
54 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
54 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
55 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
55 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
56 wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
56 wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
57 wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff'
57 wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff'
58 wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
58 wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
59 end
59 end
60
60
61 wiki_routes.connect 'projects/:id/wiki/:page/:action',
61 wiki_routes.connect 'projects/:id/wiki/:page/:action',
62 :action => /edit|rename|destroy|preview|protect/,
62 :action => /edit|rename|destroy|preview|protect/,
63 :conditions => {:method => :post}
63 :conditions => {:method => :post}
64 end
64 end
65
65
66 map.with_options :controller => 'messages' do |messages_routes|
66 map.with_options :controller => 'messages' do |messages_routes|
67 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
67 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
68 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
68 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
69 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
69 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
70 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
70 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
71 end
71 end
72 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
72 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
73 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
73 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
74 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
74 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
75 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
75 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
76 end
76 end
77 end
77 end
78
78
79 map.with_options :controller => 'boards' do |board_routes|
79 map.with_options :controller => 'boards' do |board_routes|
80 board_routes.with_options :conditions => {:method => :get} do |board_views|
80 board_routes.with_options :conditions => {:method => :get} do |board_views|
81 board_views.connect 'projects/:project_id/boards', :action => 'index'
81 board_views.connect 'projects/:project_id/boards', :action => 'index'
82 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
82 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
83 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
83 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
84 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
84 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
85 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
85 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
86 end
86 end
87 board_routes.with_options :conditions => {:method => :post} do |board_actions|
87 board_routes.with_options :conditions => {:method => :post} do |board_actions|
88 board_actions.connect 'projects/:project_id/boards', :action => 'new'
88 board_actions.connect 'projects/:project_id/boards', :action => 'new'
89 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
89 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
90 end
90 end
91 end
91 end
92
92
93 map.with_options :controller => 'documents' do |document_routes|
93 map.with_options :controller => 'documents' do |document_routes|
94 document_routes.with_options :conditions => {:method => :get} do |document_views|
94 document_routes.with_options :conditions => {:method => :get} do |document_views|
95 document_views.connect 'projects/:project_id/documents', :action => 'index'
95 document_views.connect 'projects/:project_id/documents', :action => 'index'
96 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
96 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
97 document_views.connect 'documents/:id', :action => 'show'
97 document_views.connect 'documents/:id', :action => 'show'
98 document_views.connect 'documents/:id/edit', :action => 'edit'
98 document_views.connect 'documents/:id/edit', :action => 'edit'
99 end
99 end
100 document_routes.with_options :conditions => {:method => :post} do |document_actions|
100 document_routes.with_options :conditions => {:method => :post} do |document_actions|
101 document_actions.connect 'projects/:project_id/documents', :action => 'new'
101 document_actions.connect 'projects/:project_id/documents', :action => 'new'
102 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
102 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
103 end
103 end
104 end
104 end
105
105
106 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
106 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
107
107
108 # Misc issue routes. TODO: move into resources
108 # Misc issue routes. TODO: move into resources
109 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
109 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
110 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
110 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
111 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
111 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
112 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
112 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
113 map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
113 map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
114 map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
114 map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
115 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
115 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
116 map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
116 map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
117
117
118 map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update]
118 map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update]
119 map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update]
119 map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update]
120 map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]
120 map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]
121 map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update]
121 map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update]
122
122
123 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
123 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
124 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
124 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
125 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
125 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
126 end
126 end
127
127
128 # Following two routes conflict with the resources because #index allows POST
128 # Following two routes conflict with the resources because #index allows POST
129 map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
129 map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
130 map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
130 map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
131
131
132 map.resources :issues, :member => { :edit => :post }, :collection => {}
132 map.resources :issues, :member => { :edit => :post }, :collection => {}
133 map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post }
133 map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post }
134
134
135 map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
135 map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
136 relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
136 relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
137 relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
137 relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
138 end
138 end
139
139
140 map.with_options :controller => 'news' do |news_routes|
141 news_routes.connect 'news/:id/preview', :controller => 'previews', :action => 'news'
142 news_routes.connect 'news/preview', :controller => 'previews', :action => 'news'
143
144 news_routes.with_options :conditions => {:method => :get} do |news_views|
145 news_views.connect 'news', :action => 'index'
146 news_views.connect 'projects/:project_id/news', :action => 'index'
147 news_views.connect 'projects/:project_id/news.:format', :action => 'index'
148 news_views.connect 'news.:format', :action => 'index'
149 news_views.connect 'projects/:project_id/news/new', :action => 'new'
150 news_views.connect 'news/:id', :action => 'show'
151 news_views.connect 'news/:id/edit', :action => 'edit'
152 end
153 news_routes.with_options do |news_actions|
154 news_actions.connect 'projects/:project_id/news', :action => 'create', :conditions => {:method => :post}
155 news_actions.connect 'news/:id/destroy', :action => 'destroy'
156 end
157 news_routes.connect 'news/:id/edit', :action => 'update', :conditions => {:method => :put}
158
159 news_routes.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
160 news_routes.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
161 end
162
163 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
140 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
164
141
165 map.with_options :controller => 'users' do |users|
142 map.with_options :controller => 'users' do |users|
166 users.with_options :conditions => {:method => :get} do |user_views|
143 users.with_options :conditions => {:method => :get} do |user_views|
167 user_views.connect 'users', :action => 'index'
144 user_views.connect 'users', :action => 'index'
168 user_views.connect 'users/:id', :action => 'show', :id => /\d+/
145 user_views.connect 'users/:id', :action => 'show', :id => /\d+/
169 user_views.connect 'users/new', :action => 'add'
146 user_views.connect 'users/new', :action => 'add'
170 user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
147 user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
171 end
148 end
172 users.with_options :conditions => {:method => :post} do |user_actions|
149 users.with_options :conditions => {:method => :post} do |user_actions|
173 user_actions.connect 'users', :action => 'add'
150 user_actions.connect 'users', :action => 'add'
174 user_actions.connect 'users/new', :action => 'add'
151 user_actions.connect 'users/new', :action => 'add'
175 user_actions.connect 'users/:id/edit', :action => 'edit'
152 user_actions.connect 'users/:id/edit', :action => 'edit'
176 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
153 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
177 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
154 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
178 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
155 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
179 end
156 end
180 end
157 end
181
158
182 # For nice "roadmap" in the url for the index action
159 # For nice "roadmap" in the url for the index action
183 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
160 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
184
161
162 map.all_news 'news', :controller => 'news', :action => 'index'
163 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
164 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
165 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
166 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
167
185 map.resources :projects, :member => {
168 map.resources :projects, :member => {
186 :copy => [:get, :post],
169 :copy => [:get, :post],
187 :settings => :get,
170 :settings => :get,
188 :modules => :post,
171 :modules => :post,
189 :archive => :post,
172 :archive => :post,
190 :unarchive => :post
173 :unarchive => :post
191 } do |project|
174 } do |project|
192 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
175 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
193 project.resources :files, :only => [:index, :new, :create]
176 project.resources :files, :only => [:index, :new, :create]
194 project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post}
177 project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post}
178 project.resources :news, :shallow => true
195 end
179 end
196
180
197 # Destroy uses a get request to prompt the user before the actual DELETE request
181 # Destroy uses a get request to prompt the user before the actual DELETE request
198 map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get}
182 map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get}
199
183
200 # TODO: port to be part of the resources route(s)
184 # TODO: port to be part of the resources route(s)
201 map.with_options :controller => 'projects' do |project_mapper|
185 map.with_options :controller => 'projects' do |project_mapper|
202 project_mapper.with_options :conditions => {:method => :get} do |project_views|
186 project_mapper.with_options :conditions => {:method => :get} do |project_views|
203 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
187 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
204 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
188 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
205 end
189 end
206 end
190 end
207
191
208 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
192 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
209 activity.connect 'projects/:id/activity'
193 activity.connect 'projects/:id/activity'
210 activity.connect 'projects/:id/activity.:format'
194 activity.connect 'projects/:id/activity.:format'
211 activity.connect 'activity', :id => nil
195 activity.connect 'activity', :id => nil
212 activity.connect 'activity.:format', :id => nil
196 activity.connect 'activity.:format', :id => nil
213 end
197 end
214
198
215
199
216 map.with_options :controller => 'issue_categories' do |categories|
200 map.with_options :controller => 'issue_categories' do |categories|
217 categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
201 categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
218 end
202 end
219
203
220 map.with_options :controller => 'repositories' do |repositories|
204 map.with_options :controller => 'repositories' do |repositories|
221 repositories.with_options :conditions => {:method => :get} do |repository_views|
205 repositories.with_options :conditions => {:method => :get} do |repository_views|
222 repository_views.connect 'projects/:id/repository', :action => 'show'
206 repository_views.connect 'projects/:id/repository', :action => 'show'
223 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
207 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
224 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
208 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
225 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
209 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
226 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
210 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
227 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
211 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
228 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
212 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
229 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
213 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
230 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
214 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
231 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
215 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
232 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
216 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
233 # TODO: why the following route is required?
217 # TODO: why the following route is required?
234 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
218 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
235 repository_views.connect 'projects/:id/repository/:action/*path'
219 repository_views.connect 'projects/:id/repository/:action/*path'
236 end
220 end
237
221
238 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
222 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
239 end
223 end
240
224
241 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
225 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
242 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
226 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
243 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
227 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
244
228
245 map.resources :groups
229 map.resources :groups
246
230
247 #left old routes at the bottom for backwards compat
231 #left old routes at the bottom for backwards compat
248 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
232 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
249 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
233 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
250 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
234 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
251 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
235 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
252 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
236 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
253 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
237 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
254 map.connect 'projects/:project_id/news/:action', :controller => 'news'
238 map.connect 'projects/:project_id/news/:action', :controller => 'news'
255 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
239 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
256 map.with_options :controller => 'repositories' do |omap|
240 map.with_options :controller => 'repositories' do |omap|
257 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
241 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
258 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
242 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
259 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
243 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
260 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
244 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
261 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
245 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
262 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
246 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
263 end
247 end
264
248
265 map.with_options :controller => 'sys' do |sys|
249 map.with_options :controller => 'sys' do |sys|
266 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
250 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
267 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
251 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
268 end
252 end
269
253
270 # Install the default route as the lowest priority.
254 # Install the default route as the lowest priority.
271 map.connect ':controller/:action/:id'
255 map.connect ':controller/:action/:id'
272 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
256 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
273 # Used for OpenID
257 # Used for OpenID
274 map.root :controller => 'account', :action => 'login'
258 map.root :controller => 'account', :action => 'login'
275 end
259 end
@@ -1,120 +1,120
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.dirname(__FILE__) + '/../test_helper'
18 require File.dirname(__FILE__) + '/../test_helper'
19 require 'news_controller'
19 require 'news_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class NewsController; def rescue_action(e) raise e end; end
22 class NewsController; def rescue_action(e) raise e end; end
23
23
24 class NewsControllerTest < ActionController::TestCase
24 class NewsControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments
25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments
26
26
27 def setup
27 def setup
28 @controller = NewsController.new
28 @controller = NewsController.new
29 @request = ActionController::TestRequest.new
29 @request = ActionController::TestRequest.new
30 @response = ActionController::TestResponse.new
30 @response = ActionController::TestResponse.new
31 User.current = nil
31 User.current = nil
32 end
32 end
33
33
34 def test_index
34 def test_index
35 get :index
35 get :index
36 assert_response :success
36 assert_response :success
37 assert_template 'index'
37 assert_template 'index'
38 assert_not_nil assigns(:newss)
38 assert_not_nil assigns(:newss)
39 assert_nil assigns(:project)
39 assert_nil assigns(:project)
40 end
40 end
41
41
42 def test_index_with_project
42 def test_index_with_project
43 get :index, :project_id => 1
43 get :index, :project_id => 1
44 assert_response :success
44 assert_response :success
45 assert_template 'index'
45 assert_template 'index'
46 assert_not_nil assigns(:newss)
46 assert_not_nil assigns(:newss)
47 end
47 end
48
48
49 def test_show
49 def test_show
50 get :show, :id => 1
50 get :show, :id => 1
51 assert_response :success
51 assert_response :success
52 assert_template 'show'
52 assert_template 'show'
53 assert_tag :tag => 'h2', :content => /eCookbook first release/
53 assert_tag :tag => 'h2', :content => /eCookbook first release/
54 end
54 end
55
55
56 def test_show_not_found
56 def test_show_not_found
57 get :show, :id => 999
57 get :show, :id => 999
58 assert_response 404
58 assert_response 404
59 end
59 end
60
60
61 def test_get_new
61 def test_get_new
62 @request.session[:user_id] = 2
62 @request.session[:user_id] = 2
63 get :new, :project_id => 1
63 get :new, :project_id => 1
64 assert_response :success
64 assert_response :success
65 assert_template 'new'
65 assert_template 'new'
66 end
66 end
67
67
68 def test_post_create
68 def test_post_create
69 ActionMailer::Base.deliveries.clear
69 ActionMailer::Base.deliveries.clear
70 Setting.notified_events << 'news_added'
70 Setting.notified_events << 'news_added'
71
71
72 @request.session[:user_id] = 2
72 @request.session[:user_id] = 2
73 post :create, :project_id => 1, :news => { :title => 'NewsControllerTest',
73 post :create, :project_id => 1, :news => { :title => 'NewsControllerTest',
74 :description => 'This is the description',
74 :description => 'This is the description',
75 :summary => '' }
75 :summary => '' }
76 assert_redirected_to 'projects/ecookbook/news'
76 assert_redirected_to 'projects/ecookbook/news'
77
77
78 news = News.find_by_title('NewsControllerTest')
78 news = News.find_by_title('NewsControllerTest')
79 assert_not_nil news
79 assert_not_nil news
80 assert_equal 'This is the description', news.description
80 assert_equal 'This is the description', news.description
81 assert_equal User.find(2), news.author
81 assert_equal User.find(2), news.author
82 assert_equal Project.find(1), news.project
82 assert_equal Project.find(1), news.project
83 assert_equal 1, ActionMailer::Base.deliveries.size
83 assert_equal 1, ActionMailer::Base.deliveries.size
84 end
84 end
85
85
86 def test_get_edit
86 def test_get_edit
87 @request.session[:user_id] = 2
87 @request.session[:user_id] = 2
88 get :edit, :id => 1
88 get :edit, :id => 1
89 assert_response :success
89 assert_response :success
90 assert_template 'edit'
90 assert_template 'edit'
91 end
91 end
92
92
93 def test_put_update
93 def test_put_update
94 @request.session[:user_id] = 2
94 @request.session[:user_id] = 2
95 put :update, :id => 1, :news => { :description => 'Description changed by test_post_edit' }
95 put :update, :id => 1, :news => { :description => 'Description changed by test_post_edit' }
96 assert_redirected_to 'news/1'
96 assert_redirected_to 'news/1'
97 news = News.find(1)
97 news = News.find(1)
98 assert_equal 'Description changed by test_post_edit', news.description
98 assert_equal 'Description changed by test_post_edit', news.description
99 end
99 end
100
100
101 def test_post_create_with_validation_failure
101 def test_post_create_with_validation_failure
102 @request.session[:user_id] = 2
102 @request.session[:user_id] = 2
103 post :create, :project_id => 1, :news => { :title => '',
103 post :create, :project_id => 1, :news => { :title => '',
104 :description => 'This is the description',
104 :description => 'This is the description',
105 :summary => '' }
105 :summary => '' }
106 assert_response :success
106 assert_response :success
107 assert_template 'new'
107 assert_template 'new'
108 assert_not_nil assigns(:news)
108 assert_not_nil assigns(:news)
109 assert assigns(:news).new_record?
109 assert assigns(:news).new_record?
110 assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' },
110 assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' },
111 :content => /1 error/
111 :content => /1 error/
112 end
112 end
113
113
114 def test_destroy
114 def test_destroy
115 @request.session[:user_id] = 2
115 @request.session[:user_id] = 2
116 post :destroy, :id => 1
116 delete :destroy, :id => 1
117 assert_redirected_to 'projects/ecookbook/news'
117 assert_redirected_to 'projects/ecookbook/news'
118 assert_nil News.find_by_id(1)
118 assert_nil News.find_by_id(1)
119 end
119 end
120 end
120 end
@@ -1,305 +1,302
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2010 Jean-Philippe Lang
2 # Copyright (C) 2006-2010 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require "#{File.dirname(__FILE__)}/../test_helper"
18 require "#{File.dirname(__FILE__)}/../test_helper"
19
19
20 class RoutingTest < ActionController::IntegrationTest
20 class RoutingTest < ActionController::IntegrationTest
21 context "activities" do
21 context "activities" do
22 should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil
22 should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil
23 should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom'
23 should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom'
24 end
24 end
25
25
26 context "attachments" do
26 context "attachments" do
27 should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1'
27 should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1'
28 should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
28 should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
29 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
29 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
30 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
30 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
31 end
31 end
32
32
33 context "boards" do
33 context "boards" do
34 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
34 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
35 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
35 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
36 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
36 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
37 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
37 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
38 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
38 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
39
39
40 should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
40 should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
41 should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
41 should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
42 should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
42 should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
43
43
44 end
44 end
45
45
46 context "documents" do
46 context "documents" do
47 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
47 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
48 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
48 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
49 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
49 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
50 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
50 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
51
51
52 should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
52 should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
53 should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567'
53 should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567'
54 should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567'
54 should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567'
55 end
55 end
56
56
57 context "issues" do
57 context "issues" do
58 # REST actions
58 # REST actions
59 should_route :get, "/issues", :controller => 'issues', :action => 'index'
59 should_route :get, "/issues", :controller => 'issues', :action => 'index'
60 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
60 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
61 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
61 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
62 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
62 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
63 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
63 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
64 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
64 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
65 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
65 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
66 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
66 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
67 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
67 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
68 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
68 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
69 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
69 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
70 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
70 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
71
71
72 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
72 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
73 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
73 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
74 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
74 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
75
75
76 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
76 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
77 # TODO: Should use PUT
77 # TODO: Should use PUT
78 should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
78 should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
79 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
79 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
80
80
81 # TODO: Should use DELETE
81 # TODO: Should use DELETE
82 should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64'
82 should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64'
83 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
83 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
84
84
85 # Extra actions
85 # Extra actions
86 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
86 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
87
87
88 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
88 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
89 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
89 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
90
90
91 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
91 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
92
92
93 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
93 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
94 should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update'
94 should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update'
95 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
95 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
96 should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name'
96 should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name'
97
97
98 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
98 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
99 should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update'
99 should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update'
100 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
100 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
101 should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name'
101 should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name'
102
102
103 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
103 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
104
104
105 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
105 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
106 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
106 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
107 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
107 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
108 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
108 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
109
109
110 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
110 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
111
111
112 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
112 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
113 should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update'
113 should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update'
114 end
114 end
115
115
116 context "issue categories" do
116 context "issue categories" do
117 should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
117 should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
118
118
119 should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
119 should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
120 end
120 end
121
121
122 context "issue relations" do
122 context "issue relations" do
123 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1'
123 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1'
124 should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23'
124 should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23'
125 end
125 end
126
126
127 context "issue reports" do
127 context "issue reports" do
128 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
128 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
129 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
129 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
130 end
130 end
131
131
132 context "members" do
132 context "members" do
133 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
133 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
134 end
134 end
135
135
136 context "messages" do
136 context "messages" do
137 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
137 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
138 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
138 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
139 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
139 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
140
140
141 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
141 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
142 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
142 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
143 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
143 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
144 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
144 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
145 end
145 end
146
146
147 context "news" do
147 context "news" do
148 should_route :get, "/news", :controller => 'news', :action => 'index'
148 should_route :get, "/news", :controller => 'news', :action => 'index'
149 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
149 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
150 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
150 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
151 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
151 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
152 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
152 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
153 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
153 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
154 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
154 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
155 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
155 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
156 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
156 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
157 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
157 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
158 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
158 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
159 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
159 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
160 should_route :get, "/news/123/preview", :controller => 'previews', :action => 'news', :id => '123'
161 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
160 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
162
161
163 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
162 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
164 should_route :post, "/news/567/destroy", :controller => 'news', :action => 'destroy', :id => '567'
165 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
163 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
166
164
167 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
165 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
168
169 should_route :put, "/news/567/edit", :controller => 'news', :action => 'update', :id => '567'
170
166
167 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
171 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
168 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
172 end
169 end
173
170
174 context "projects" do
171 context "projects" do
175 should_route :get, "/projects", :controller => 'projects', :action => 'index'
172 should_route :get, "/projects", :controller => 'projects', :action => 'index'
176 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
173 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
177 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
174 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
178 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
175 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
179 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
176 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
180 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
177 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
181 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
178 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
182 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
179 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
183 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
180 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
184 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
181 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
185 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
182 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
186 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
183 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
187 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
184 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
188
185
189 should_route :post, "/projects", :controller => 'projects', :action => 'create'
186 should_route :post, "/projects", :controller => 'projects', :action => 'create'
190 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
187 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
191 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
188 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
192 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
189 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
193 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
190 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
194
191
195 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
192 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
196 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
193 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
197 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
194 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
198
195
199 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
196 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
200 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
197 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
201 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
198 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
202 end
199 end
203
200
204 context "repositories" do
201 context "repositories" do
205 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
202 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
206 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
203 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
207 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
204 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
208 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
205 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
209 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
206 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
210 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
207 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
211 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
208 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
212 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
209 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
213 should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
210 should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
214 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
211 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
215 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
212 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
216 should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
213 should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
217 should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw'
214 should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw'
218 should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw'
215 should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw'
219 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
216 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
220 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
217 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
221 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
218 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
222
219
223
220
224 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
221 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
225 end
222 end
226
223
227 context "timelogs" do
224 context "timelogs" do
228 should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567'
225 should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567'
229 should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook'
226 should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook'
230 should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567'
227 should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567'
231 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
228 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
232 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
229 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
233 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
230 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
234 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
231 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
235 should_route :get, "/time_entries", :controller => 'timelog', :action => 'details'
232 should_route :get, "/time_entries", :controller => 'timelog', :action => 'details'
236 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv'
233 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv'
237 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom'
234 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom'
238 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567'
235 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567'
239 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv'
236 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv'
240 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom'
237 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom'
241 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234'
238 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234'
242 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv'
239 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv'
243 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom'
240 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom'
244 should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123'
241 should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123'
245
242
246 should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55'
243 should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55'
247 end
244 end
248
245
249 context "users" do
246 context "users" do
250 should_route :get, "/users", :controller => 'users', :action => 'index'
247 should_route :get, "/users", :controller => 'users', :action => 'index'
251 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
248 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
252 should_route :get, "/users/new", :controller => 'users', :action => 'add'
249 should_route :get, "/users/new", :controller => 'users', :action => 'add'
253 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
250 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
254 should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
251 should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
255
252
256 should_route :post, "/users/new", :controller => 'users', :action => 'add'
253 should_route :post, "/users/new", :controller => 'users', :action => 'add'
257 should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
254 should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
258 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
255 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
259 should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
256 should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
260 should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
257 should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
261 end
258 end
262
259
263 # TODO: should they all be scoped under /projects/:project_id ?
260 # TODO: should they all be scoped under /projects/:project_id ?
264 context "versions" do
261 context "versions" do
265 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
262 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
266 should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1'
263 should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1'
267 should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1'
264 should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1'
268
265
269 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
266 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
270 should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1'
267 should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1'
271
268
272 should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1'
269 should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1'
273 end
270 end
274
271
275 context "wiki (singular, project's pages)" do
272 context "wiki (singular, project's pages)" do
276 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567'
273 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567'
277 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala'
274 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala'
278 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
275 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
279 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation'
276 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation'
280 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1'
277 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1'
281 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
278 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
282 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
279 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
283 should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index'
280 should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index'
284 should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index'
281 should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index'
285 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
282 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
286 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export'
283 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export'
287
284
288 should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
285 should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
289 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation'
286 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation'
290 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
287 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
291 should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida'
288 should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida'
292 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida'
289 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida'
293 end
290 end
294
291
295 context "wikis (plural, admin setup)" do
292 context "wikis (plural, admin setup)" do
296 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
293 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
297
294
298 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
295 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
299 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
296 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
300 end
297 end
301
298
302 context "administration panel" do
299 context "administration panel" do
303 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
300 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
304 end
301 end
305 end
302 end
General Comments 0
You need to be logged in to leave comments. Login now