##// END OF EJS Templates
Resourcified enumerations....
Jean-Philippe Lang -
r8069:0471de41ff48
parent child
Show More
@@ -1,85 +1,86
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 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 class EnumerationsController < ApplicationController
18 class EnumerationsController < ApplicationController
19 layout 'admin'
19 layout 'admin'
20
20
21 before_filter :require_admin
21 before_filter :require_admin
22 before_filter :build_new_enumeration, :only => [:new, :create]
23 before_filter :find_enumeration, :only => [:edit, :update, :destroy]
22
24
23 helper :custom_fields
25 helper :custom_fields
24 include CustomFieldsHelper
25
26
26 def index
27 def index
27 end
28 end
28
29
29 verify :method => :post, :only => [ :destroy, :create, :update ],
30 :redirect_to => { :action => :index }
31
32 def new
30 def new
33 begin
34 @enumeration = params[:type].constantize.new
35 rescue NameError
36 @enumeration = Enumeration.new
37 end
38 end
31 end
39
32
40 def create
33 def create
41 @enumeration = Enumeration.new(params[:enumeration])
34 if request.post? && @enumeration.save
42 @enumeration.type = params[:enumeration][:type]
43 if @enumeration.save
44 flash[:notice] = l(:notice_successful_create)
35 flash[:notice] = l(:notice_successful_create)
45 redirect_to :action => 'index', :type => @enumeration.type
36 redirect_to :action => 'index', :type => @enumeration.type
46 else
37 else
47 render :action => 'new'
38 render :action => 'new'
48 end
39 end
49 end
40 end
50
41
51 def edit
42 def edit
52 @enumeration = Enumeration.find(params[:id])
53 end
43 end
54
44
55 def update
45 def update
56 @enumeration = Enumeration.find(params[:id])
46 if request.put? && @enumeration.update_attributes(params[:enumeration])
57 @enumeration.type = params[:enumeration][:type] if params[:enumeration][:type]
58 if @enumeration.update_attributes(params[:enumeration])
59 flash[:notice] = l(:notice_successful_update)
47 flash[:notice] = l(:notice_successful_update)
60 redirect_to :action => 'index', :type => @enumeration.type
48 redirect_to :action => 'index', :type => @enumeration.type
61 else
49 else
62 render :action => 'edit'
50 render :action => 'edit'
63 end
51 end
64 end
52 end
65
53
54 verify :method => :delete, :only => :destroy, :render => { :nothing => true, :status => :method_not_allowed }
66 def destroy
55 def destroy
67 @enumeration = Enumeration.find(params[:id])
68 if !@enumeration.in_use?
56 if !@enumeration.in_use?
69 # No associated objects
57 # No associated objects
70 @enumeration.destroy
58 @enumeration.destroy
71 redirect_to :action => 'index'
59 redirect_to :action => 'index'
72 return
60 return
73 elsif params[:reassign_to_id]
61 elsif params[:reassign_to_id]
74 if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id])
62 if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id])
75 @enumeration.destroy(reassign_to)
63 @enumeration.destroy(reassign_to)
76 redirect_to :action => 'index'
64 redirect_to :action => 'index'
77 return
65 return
78 end
66 end
79 end
67 end
80 @enumerations = @enumeration.class.find(:all) - [@enumeration]
68 @enumerations = @enumeration.class.all - [@enumeration]
81 #rescue
69 end
82 # flash[:error] = 'Unable to delete enumeration'
70
83 # redirect_to :action => 'index'
71 private
72
73 def build_new_enumeration
74 class_name = params[:enumeration] && params[:enumeration][:type] || params[:type]
75 @enumeration = Enumeration.new_subclass_instance(class_name, params[:enumeration])
76 if @enumeration.nil?
77 render_404
78 end
79 end
80
81 def find_enumeration
82 @enumeration = Enumeration.find(params[:id])
83 rescue ActiveRecord::RecordNotFound
84 render_404
84 end
85 end
85 end
86 end
@@ -1,136 +1,140
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 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 class Enumeration < ActiveRecord::Base
18 class Enumeration < ActiveRecord::Base
19 include Redmine::SubclassFactory
20
19 default_scope :order => "#{Enumeration.table_name}.position ASC"
21 default_scope :order => "#{Enumeration.table_name}.position ASC"
20
22
21 belongs_to :project
23 belongs_to :project
22
24
23 acts_as_list :scope => 'type = \'#{type}\''
25 acts_as_list :scope => 'type = \'#{type}\''
24 acts_as_customizable
26 acts_as_customizable
25 acts_as_tree :order => 'position ASC'
27 acts_as_tree :order => 'position ASC'
26
28
27 before_destroy :check_integrity
29 before_destroy :check_integrity
28 before_save :check_default
30 before_save :check_default
29
31
32 attr_protected :type
33
30 validates_presence_of :name
34 validates_presence_of :name
31 validates_uniqueness_of :name, :scope => [:type, :project_id]
35 validates_uniqueness_of :name, :scope => [:type, :project_id]
32 validates_length_of :name, :maximum => 30
36 validates_length_of :name, :maximum => 30
33
37
34 named_scope :shared, :conditions => { :project_id => nil }
38 named_scope :shared, :conditions => { :project_id => nil }
35 named_scope :active, :conditions => { :active => true }
39 named_scope :active, :conditions => { :active => true }
36 named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
40 named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
37
41
38 def self.default
42 def self.default
39 # Creates a fake default scope so Enumeration.default will check
43 # Creates a fake default scope so Enumeration.default will check
40 # it's type. STI subclasses will automatically add their own
44 # it's type. STI subclasses will automatically add their own
41 # types to the finder.
45 # types to the finder.
42 if self.descends_from_active_record?
46 if self.descends_from_active_record?
43 find(:first, :conditions => { :is_default => true, :type => 'Enumeration' })
47 find(:first, :conditions => { :is_default => true, :type => 'Enumeration' })
44 else
48 else
45 # STI classes are
49 # STI classes are
46 find(:first, :conditions => { :is_default => true })
50 find(:first, :conditions => { :is_default => true })
47 end
51 end
48 end
52 end
49
53
50 # Overloaded on concrete classes
54 # Overloaded on concrete classes
51 def option_name
55 def option_name
52 nil
56 nil
53 end
57 end
54
58
55 def check_default
59 def check_default
56 if is_default? && is_default_changed?
60 if is_default? && is_default_changed?
57 Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
61 Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
58 end
62 end
59 end
63 end
60
64
61 # Overloaded on concrete classes
65 # Overloaded on concrete classes
62 def objects_count
66 def objects_count
63 0
67 0
64 end
68 end
65
69
66 def in_use?
70 def in_use?
67 self.objects_count != 0
71 self.objects_count != 0
68 end
72 end
69
73
70 # Is this enumeration overiding a system level enumeration?
74 # Is this enumeration overiding a system level enumeration?
71 def is_override?
75 def is_override?
72 !self.parent.nil?
76 !self.parent.nil?
73 end
77 end
74
78
75 alias :destroy_without_reassign :destroy
79 alias :destroy_without_reassign :destroy
76
80
77 # Destroy the enumeration
81 # Destroy the enumeration
78 # If a enumeration is specified, objects are reassigned
82 # If a enumeration is specified, objects are reassigned
79 def destroy(reassign_to = nil)
83 def destroy(reassign_to = nil)
80 if reassign_to && reassign_to.is_a?(Enumeration)
84 if reassign_to && reassign_to.is_a?(Enumeration)
81 self.transfer_relations(reassign_to)
85 self.transfer_relations(reassign_to)
82 end
86 end
83 destroy_without_reassign
87 destroy_without_reassign
84 end
88 end
85
89
86 def <=>(enumeration)
90 def <=>(enumeration)
87 position <=> enumeration.position
91 position <=> enumeration.position
88 end
92 end
89
93
90 def to_s; name end
94 def to_s; name end
91
95
92 # Returns the Subclasses of Enumeration. Each Subclass needs to be
96 # Returns the Subclasses of Enumeration. Each Subclass needs to be
93 # required in development mode.
97 # required in development mode.
94 #
98 #
95 # Note: subclasses is protected in ActiveRecord
99 # Note: subclasses is protected in ActiveRecord
96 def self.get_subclasses
100 def self.get_subclasses
97 @@subclasses[Enumeration]
101 @@subclasses[Enumeration]
98 end
102 end
99
103
100 # Does the +new+ Hash override the previous Enumeration?
104 # Does the +new+ Hash override the previous Enumeration?
101 def self.overridding_change?(new, previous)
105 def self.overridding_change?(new, previous)
102 if (same_active_state?(new['active'], previous.active)) && same_custom_values?(new,previous)
106 if (same_active_state?(new['active'], previous.active)) && same_custom_values?(new,previous)
103 return false
107 return false
104 else
108 else
105 return true
109 return true
106 end
110 end
107 end
111 end
108
112
109 # Does the +new+ Hash have the same custom values as the previous Enumeration?
113 # Does the +new+ Hash have the same custom values as the previous Enumeration?
110 def self.same_custom_values?(new, previous)
114 def self.same_custom_values?(new, previous)
111 previous.custom_field_values.each do |custom_value|
115 previous.custom_field_values.each do |custom_value|
112 if custom_value.value != new["custom_field_values"][custom_value.custom_field_id.to_s]
116 if custom_value.value != new["custom_field_values"][custom_value.custom_field_id.to_s]
113 return false
117 return false
114 end
118 end
115 end
119 end
116
120
117 return true
121 return true
118 end
122 end
119
123
120 # Are the new and previous fields equal?
124 # Are the new and previous fields equal?
121 def self.same_active_state?(new, previous)
125 def self.same_active_state?(new, previous)
122 new = (new == "1" ? true : false)
126 new = (new == "1" ? true : false)
123 return new == previous
127 return new == previous
124 end
128 end
125
129
126 private
130 private
127 def check_integrity
131 def check_integrity
128 raise "Can't delete enumeration" if self.in_use?
132 raise "Can't delete enumeration" if self.in_use?
129 end
133 end
130
134
131 end
135 end
132
136
133 # Force load the subclasses in development mode
137 # Force load the subclasses in development mode
134 require_dependency 'time_entry_activity'
138 require_dependency 'time_entry_activity'
135 require_dependency 'document_category'
139 require_dependency 'document_category'
136 require_dependency 'issue_priority'
140 require_dependency 'issue_priority'
@@ -1,19 +1,11
1 <%= error_messages_for 'enumeration' %>
1 <%= error_messages_for 'enumeration' %>
2 <div class="box">
3 <!--[form:optvalue]-->
4 <%= hidden_field 'enumeration', 'type' %>
5
2
6 <p><label for="enumeration_name"><%=l(:field_name)%></label>
3 <div class="box tabular">
7 <%= text_field 'enumeration', 'name' %></p>
4 <p><%= f.text_field :name %></p>
5 <p><%= f.check_box :active %></p>
6 <p><%= f.check_box :is_default %></p>
8
7
9 <p><label for="enumeration_active"><%=l(:field_active)%></label>
8 <% @enumeration.custom_field_values.each do |value| %>
10 <%= check_box 'enumeration', 'active' %></p>
9 <p><%= custom_field_tag_with_label :enumeration, value %></p>
11
10 <% end %>
12 <p><label for="enumeration_is_default"><%=l(:field_is_default)%></label>
13 <%= check_box 'enumeration', 'is_default' %></p>
14 <!--[eoform:optvalue]-->
15
16 <% @enumeration.custom_field_values.each do |value| %>
17 <p><%= custom_field_tag_with_label :enumeration, value %></p>
18 <% end %>
19 </div>
11 </div>
@@ -1,12 +1,12
1 <h2><%= l(@enumeration.option_name) %>: <%=h @enumeration %></h2>
1 <h2><%= l(@enumeration.option_name) %>: <%=h @enumeration %></h2>
2
2
3 <% form_tag({}) do %>
3 <% form_tag({}, :method => :delete) do %>
4 <div class="box">
4 <div class="box">
5 <p><strong><%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %></strong></p>
5 <p><strong><%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %></strong></p>
6 <p><label for='reassign_to_id'><%= l(:text_enumeration_category_reassign_to) %></label>
6 <p><label for='reassign_to_id'><%= l(:text_enumeration_category_reassign_to) %></label>
7 <%= select_tag 'reassign_to_id', ("<option>--- #{l(:actionview_instancetag_blank_option)} ---</option>" + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p>
7 <%= select_tag 'reassign_to_id', ("<option>--- #{l(:actionview_instancetag_blank_option)} ---</option>" + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p>
8 </div>
8 </div>
9
9
10 <%= submit_tag l(:button_apply) %>
10 <%= submit_tag l(:button_apply) %>
11 <%= link_to l(:button_cancel), :controller => 'enumerations', :action => 'index' %>
11 <%= link_to l(:button_cancel), enumerations_path %>
12 <% end %>
12 <% end %>
@@ -1,6 +1,6
1 <h2><%= link_to l(@enumeration.option_name), :controller => 'enumerations', :action => 'index' %> &#187; <%=h @enumeration %></h2>
1 <h2><%= link_to l(@enumeration.option_name), enumerations_path %> &#187; <%=h @enumeration %></h2>
2
2
3 <% form_tag({:action => 'update', :id => @enumeration}, :class => "tabular") do %>
3 <% labelled_form_for :enumeration, @enumeration, :url => enumeration_path(@enumeration), :html => {:method => :put} do |f| %>
4 <%= render :partial => 'form' %>
4 <%= render :partial => 'form', :locals => {:f => f} %>
5 <%= submit_tag l(:button_save) %>
5 <%= submit_tag l(:button_save) %>
6 <% end %>
6 <% end %>
@@ -1,37 +1,37
1 <h2><%=l(:label_enumerations)%></h2>
1 <h2><%=l(:label_enumerations)%></h2>
2
2
3 <% Enumeration.get_subclasses.each do |klass| %>
3 <% Enumeration.get_subclasses.each do |klass| %>
4 <h3><%= l(klass::OptionName) %></h3>
4 <h3><%= l(klass::OptionName) %></h3>
5
5
6 <% enumerations = klass.shared %>
6 <% enumerations = klass.shared %>
7 <% if enumerations.any? %>
7 <% if enumerations.any? %>
8 <table class="list"><thead>
8 <table class="list"><thead>
9 <tr>
9 <tr>
10 <th><%= l(:field_name) %></th>
10 <th><%= l(:field_name) %></th>
11 <th style="width:15%;"><%= l(:field_is_default) %></th>
11 <th style="width:15%;"><%= l(:field_is_default) %></th>
12 <th style="width:15%;"><%= l(:field_active) %></th>
12 <th style="width:15%;"><%= l(:field_active) %></th>
13 <th style="width:15%;"></th>
13 <th style="width:15%;"></th>
14 <th align="center" style="width:10%;"> </th>
14 <th align="center" style="width:10%;"> </th>
15 </tr></thead>
15 </tr></thead>
16 <% enumerations.each do |enumeration| %>
16 <% enumerations.each do |enumeration| %>
17 <tr class="<%= cycle('odd', 'even') %>">
17 <tr class="<%= cycle('odd', 'even') %>">
18 <td><%= link_to h(enumeration), :action => 'edit', :id => enumeration %></td>
18 <td><%= link_to h(enumeration), edit_enumeration_path(enumeration) %></td>
19 <td class="center" style="width:15%;"><%= checked_image enumeration.is_default? %></td>
19 <td class="center" style="width:15%;"><%= checked_image enumeration.is_default? %></td>
20 <td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td>
20 <td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td>
21 <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %></td>
21 <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}, :put) %></td>
22 <td class="buttons">
22 <td class="buttons">
23 <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration },
23 <%= link_to l(:button_delete), enumeration_path(enumeration),
24 :method => :post,
24 :method => :delete,
25 :confirm => l(:text_are_you_sure),
25 :confirm => l(:text_are_you_sure),
26 :class => 'icon icon-del' %>
26 :class => 'icon icon-del' %>
27 </td>
27 </td>
28 </tr>
28 </tr>
29 <% end %>
29 <% end %>
30 </table>
30 </table>
31 <% reset_cycle %>
31 <% reset_cycle %>
32 <% end %>
32 <% end %>
33
33
34 <p><%= link_to l(:label_enumeration_new), { :action => 'new', :type => klass.name } %></p>
34 <p><%= link_to l(:label_enumeration_new), new_enumeration_path(:type => klass.name) %></p>
35 <% end %>
35 <% end %>
36
36
37 <% html_title(l(:label_enumerations)) -%>
37 <% html_title(l(:label_enumerations)) -%>
@@ -1,6 +1,7
1 <h2><%= link_to l(@enumeration.option_name), :controller => 'enumerations', :action => 'index' %> &#187; <%=l(:label_enumeration_new)%></h2>
1 <h2><%= link_to l(@enumeration.option_name), enumerations_path %> &#187; <%=l(:label_enumeration_new)%></h2>
2
2
3 <% form_tag({:action => 'create'}, :class => "tabular") do %>
3 <% labelled_form_for :enumeration, @enumeration, :url => enumerations_path do |f| %>
4 <%= render :partial => 'form' %>
4 <%= f.hidden_field :type %>
5 <%= render :partial => 'form', :locals => {:f => f} %>
5 <%= submit_tag l(:button_create) %>
6 <%= submit_tag l(:button_create) %>
6 <% end %>
7 <% end %>
@@ -1,267 +1,262
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', :conditions => {:method => :get}
9 map.home '', :controller => 'welcome', :conditions => {:method => :get}
10
10
11 map.signin 'login', :controller => 'account', :action => 'login', :conditions => {:method => [:get, :post]}
11 map.signin 'login', :controller => 'account', :action => 'login', :conditions => {:method => [:get, :post]}
12 map.signout 'logout', :controller => 'account', :action => 'logout', :conditions => {:method => :get}
12 map.signout 'logout', :controller => 'account', :action => 'logout', :conditions => {:method => :get}
13 map.connect 'account/register', :controller => 'account', :action => 'register', :conditions => {:method => [:get, :post]}
13 map.connect 'account/register', :controller => 'account', :action => 'register', :conditions => {:method => [:get, :post]}
14 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password', :conditions => {:method => [:get, :post]}
14 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password', :conditions => {:method => [:get, :post]}
15 map.connect 'account/activate', :controller => 'account', :action => 'activate', :conditions => {:method => :get}
15 map.connect 'account/activate', :controller => 'account', :action => 'activate', :conditions => {:method => :get}
16
16
17 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
17 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
18
18
19 map.connect 'help/:ctrl/:page', :controller => 'help', :conditions => {:method => :get}
19 map.connect 'help/:ctrl/:page', :controller => 'help', :conditions => {:method => :get}
20
20
21 map.connect '/time_entries/destroy',
21 map.connect '/time_entries/destroy',
22 :controller => 'timelog', :action => 'destroy', :conditions => { :method => :delete }
22 :controller => 'timelog', :action => 'destroy', :conditions => { :method => :delete }
23 map.time_entries_context_menu '/time_entries/context_menu',
23 map.time_entries_context_menu '/time_entries/context_menu',
24 :controller => 'context_menus', :action => 'time_entries'
24 :controller => 'context_menus', :action => 'time_entries'
25
25
26 map.resources :time_entries, :controller => 'timelog', :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
26 map.resources :time_entries, :controller => 'timelog', :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
27
27
28 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
28 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
29 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => [:get, :post]}
29 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => [:get, :post]}
30
30
31 map.with_options :controller => 'messages' do |messages_routes|
31 map.with_options :controller => 'messages' do |messages_routes|
32 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
32 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
33 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
33 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
34 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
34 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
35 messages_views.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
35 messages_views.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
36 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
36 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
37 end
37 end
38 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
38 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
39 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
39 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
40 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
40 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
41 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
41 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
42 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
42 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
43 end
43 end
44 end
44 end
45
45
46 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
46 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
47 map.resources :queries, :except => [:show]
47 map.resources :queries, :except => [:show]
48
48
49 # Misc issue routes. TODO: move into resources
49 # Misc issue routes. TODO: move into resources
50 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues', :conditions => { :method => :get }
50 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues', :conditions => { :method => :get }
51 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
51 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
52 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
52 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
53 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
53 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
54 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
54 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
55
55
56 map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff', :id => /\d+/, :conditions => { :method => :get }
56 map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff', :id => /\d+/, :conditions => { :method => :get }
57 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit', :id => /\d+/, :conditions => { :method => [:get, :post] }
57 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit', :id => /\d+/, :conditions => { :method => [:get, :post] }
58
58
59 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
59 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
60 gantts_routes.connect '/projects/:project_id/issues/gantt'
60 gantts_routes.connect '/projects/:project_id/issues/gantt'
61 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
61 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
62 gantts_routes.connect '/issues/gantt.:format'
62 gantts_routes.connect '/issues/gantt.:format'
63 end
63 end
64
64
65 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
65 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
66 calendars_routes.connect '/projects/:project_id/issues/calendar'
66 calendars_routes.connect '/projects/:project_id/issues/calendar'
67 calendars_routes.connect '/issues/calendar'
67 calendars_routes.connect '/issues/calendar'
68 end
68 end
69
69
70 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
70 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
71 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
71 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
72 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
72 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
73 end
73 end
74
74
75 map.connect 'my/account', :controller => 'my', :action => 'account', :conditions => {:method => [:get, :post]}
75 map.connect 'my/account', :controller => 'my', :action => 'account', :conditions => {:method => [:get, :post]}
76 map.connect 'my/page', :controller => 'my', :action => 'page', :conditions => {:method => :get}
76 map.connect 'my/page', :controller => 'my', :action => 'page', :conditions => {:method => :get}
77 map.connect 'my', :controller => 'my', :action => 'index', :conditions => {:method => :get} # Redirects to my/page
77 map.connect 'my', :controller => 'my', :action => 'index', :conditions => {:method => :get} # Redirects to my/page
78 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :conditions => {:method => :post}
78 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :conditions => {:method => :post}
79 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :conditions => {:method => :post}
79 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :conditions => {:method => :post}
80 map.connect 'my/password', :controller => 'my', :action => 'password', :conditions => {:method => [:get, :post]}
80 map.connect 'my/password', :controller => 'my', :action => 'password', :conditions => {:method => [:get, :post]}
81 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout', :conditions => {:method => :get}
81 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout', :conditions => {:method => :get}
82 map.connect 'my/add_block', :controller => 'my', :action => 'add_block', :conditions => {:method => :post}
82 map.connect 'my/add_block', :controller => 'my', :action => 'add_block', :conditions => {:method => :post}
83 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block', :conditions => {:method => :post}
83 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block', :conditions => {:method => :post}
84 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :conditions => {:method => :post}
84 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :conditions => {:method => :post}
85
85
86 map.resources :issues, :collection => {:bulk_edit => :get, :bulk_update => :post} do |issues|
86 map.resources :issues, :collection => {:bulk_edit => :get, :bulk_update => :post} do |issues|
87 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
87 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
88 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
88 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
89 end
89 end
90 # Bulk deletion
90 # Bulk deletion
91 map.connect '/issues', :controller => 'issues', :action => 'destroy', :conditions => {:method => :delete}
91 map.connect '/issues', :controller => 'issues', :action => 'destroy', :conditions => {:method => :delete}
92
92
93 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new', :conditions => { :method => :post }
93 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new', :conditions => { :method => :post }
94 map.connect 'members/edit/:id', :controller => 'members', :action => 'edit', :id => /\d+/, :conditions => { :method => :post }
94 map.connect 'members/edit/:id', :controller => 'members', :action => 'edit', :id => /\d+/, :conditions => { :method => :post }
95 map.connect 'members/destroy/:id', :controller => 'members', :action => 'destroy', :id => /\d+/, :conditions => { :method => :post }
95 map.connect 'members/destroy/:id', :controller => 'members', :action => 'destroy', :id => /\d+/, :conditions => { :method => :post }
96 map.connect 'members/autocomplete_for_member/:id', :controller => 'members', :action => 'autocomplete_for_member', :conditions => { :method => :post }
96 map.connect 'members/autocomplete_for_member/:id', :controller => 'members', :action => 'autocomplete_for_member', :conditions => { :method => :post }
97
97
98 map.resources :users
98 map.resources :users
99 map.with_options :controller => 'users' do |users|
99 map.with_options :controller => 'users' do |users|
100 users.user_memberships 'users/:id/memberships', :action => 'edit_membership', :conditions => {:method => :post}
100 users.user_memberships 'users/:id/memberships', :action => 'edit_membership', :conditions => {:method => :post}
101 users.user_membership 'users/:id/memberships/:membership_id', :action => 'edit_membership', :conditions => {:method => :put}
101 users.user_membership 'users/:id/memberships/:membership_id', :action => 'edit_membership', :conditions => {:method => :put}
102 users.connect 'users/:id/memberships/:membership_id', :action => 'destroy_membership', :conditions => {:method => :delete}
102 users.connect 'users/:id/memberships/:membership_id', :action => 'destroy_membership', :conditions => {:method => :delete}
103 end
103 end
104
104
105 # For nice "roadmap" in the url for the index action
105 # For nice "roadmap" in the url for the index action
106 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
106 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
107
107
108 map.all_news 'news', :controller => 'news', :action => 'index'
108 map.all_news 'news', :controller => 'news', :action => 'index'
109 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
109 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
110 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
110 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
111 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
111 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
112 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
112 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
113
113
114 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new', :conditions => {:method => [:get, :post]}
114 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new', :conditions => {:method => [:get, :post]}
115 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :conditions => {:method => :post}
115 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :conditions => {:method => :post}
116 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch', :conditions => {:method => :post}
116 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch', :conditions => {:method => :post}
117 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :conditions => {:method => :post}
117 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :conditions => {:method => :post}
118
118
119 map.resources :projects, :member => {
119 map.resources :projects, :member => {
120 :copy => [:get, :post],
120 :copy => [:get, :post],
121 :settings => :get,
121 :settings => :get,
122 :modules => :post,
122 :modules => :post,
123 :archive => :post,
123 :archive => :post,
124 :unarchive => :post
124 :unarchive => :post
125 } do |project|
125 } do |project|
126 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
126 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
127 project.resources :issues, :only => [:index, :new, :create] do |issues|
127 project.resources :issues, :only => [:index, :new, :create] do |issues|
128 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
128 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
129 end
129 end
130 project.resources :files, :only => [:index, :new, :create]
130 project.resources :files, :only => [:index, :new, :create]
131 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
131 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
132 project.resources :news, :shallow => true
132 project.resources :news, :shallow => true
133 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id', :collection => {:report => :get}
133 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id', :collection => {:report => :get}
134 project.resources :queries, :only => [:new, :create]
134 project.resources :queries, :only => [:new, :create]
135 project.resources :issue_categories, :shallow => true
135 project.resources :issue_categories, :shallow => true
136 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
136 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
137 project.resources :boards
137 project.resources :boards
138
138
139 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
139 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
140 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
140 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
141 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
141 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
142 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
142 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
143 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
143 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
144 project.resources :wiki, :except => [:new, :create], :member => {
144 project.resources :wiki, :except => [:new, :create], :member => {
145 :rename => [:get, :post],
145 :rename => [:get, :post],
146 :history => :get,
146 :history => :get,
147 :preview => :any,
147 :preview => :any,
148 :protect => :post,
148 :protect => :post,
149 :add_attachment => :post
149 :add_attachment => :post
150 }, :collection => {
150 }, :collection => {
151 :export => :get,
151 :export => :get,
152 :date_index => :get
152 :date_index => :get
153 }
153 }
154
154
155 end
155 end
156
156
157 # TODO: port to be part of the resources route(s)
157 # TODO: port to be part of the resources route(s)
158 map.with_options :controller => 'projects' do |project_mapper|
158 map.with_options :controller => 'projects' do |project_mapper|
159 project_mapper.with_options :conditions => {:method => :get} do |project_views|
159 project_mapper.with_options :conditions => {:method => :get} do |project_views|
160 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
160 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
161 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
161 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
162 end
162 end
163 end
163 end
164
164
165 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
165 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
166 activity.connect 'projects/:id/activity'
166 activity.connect 'projects/:id/activity'
167 activity.connect 'projects/:id/activity.:format'
167 activity.connect 'projects/:id/activity.:format'
168 activity.connect 'activity', :id => nil
168 activity.connect 'activity', :id => nil
169 activity.connect 'activity.:format', :id => nil
169 activity.connect 'activity.:format', :id => nil
170 end
170 end
171
171
172 map.with_options :controller => 'repositories' do |repositories|
172 map.with_options :controller => 'repositories' do |repositories|
173 repositories.with_options :conditions => {:method => :get} do |repository_views|
173 repositories.with_options :conditions => {:method => :get} do |repository_views|
174 repository_views.connect 'projects/:id/repository', :action => 'show'
174 repository_views.connect 'projects/:id/repository', :action => 'show'
175 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
175 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
176 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
176 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
177 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
177 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
178 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
178 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
179 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
179 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
180 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
180 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
181 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
181 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
182 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
182 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
183 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
183 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
184 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
184 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
185 repository_views.connect 'projects/:id/repository/browse/*path', :action => 'browse'
185 repository_views.connect 'projects/:id/repository/browse/*path', :action => 'browse'
186 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
186 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
187 repository_views.connect 'projects/:id/repository/changes/*path', :action => 'changes'
187 repository_views.connect 'projects/:id/repository/changes/*path', :action => 'changes'
188 repository_views.connect 'projects/:id/repository/annotate/*path', :action => 'annotate'
188 repository_views.connect 'projects/:id/repository/annotate/*path', :action => 'annotate'
189 repository_views.connect 'projects/:id/repository/diff/*path', :action => 'diff'
189 repository_views.connect 'projects/:id/repository/diff/*path', :action => 'diff'
190 repository_views.connect 'projects/:id/repository/graph', :action => 'graph'
190 repository_views.connect 'projects/:id/repository/graph', :action => 'graph'
191 end
191 end
192
192
193 repositories.connect 'projects/:id/repository/revision', :action => 'revision', :conditions => {:method => [:get, :post]}
193 repositories.connect 'projects/:id/repository/revision', :action => 'revision', :conditions => {:method => [:get, :post]}
194 repositories.connect 'projects/:id/repository/committers', :action => 'committers', :conditions => {:method => [:get, :post]}
194 repositories.connect 'projects/:id/repository/committers', :action => 'committers', :conditions => {:method => [:get, :post]}
195 repositories.connect 'projects/:id/repository/edit', :action => 'edit', :conditions => {:method => :post}
195 repositories.connect 'projects/:id/repository/edit', :action => 'edit', :conditions => {:method => :post}
196 repositories.connect 'projects/:id/repository/destroy', :action => 'destroy', :conditions => {:method => :post}
196 repositories.connect 'projects/:id/repository/destroy', :action => 'destroy', :conditions => {:method => :post}
197 end
197 end
198
198
199 map.resources :attachments, :only => [:show, :destroy]
199 map.resources :attachments, :only => [:show, :destroy]
200 # additional routes for having the file name at the end of url
200 # additional routes for having the file name at the end of url
201 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
201 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
202 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
202 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
203 map.connect 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :conditions => {:method => :get}
203 map.connect 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :conditions => {:method => :get}
204
204
205 map.resources :groups, :member => {:autocomplete_for_user => :get}
205 map.resources :groups, :member => {:autocomplete_for_user => :get}
206 map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
206 map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
207 map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
207 map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
208 map.connect 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :conditions => {:method => :post}
208 map.connect 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :conditions => {:method => :post}
209 map.connect 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :conditions => {:method => :post}
209 map.connect 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :conditions => {:method => :post}
210
210
211 map.resources :trackers, :except => :show
211 map.resources :trackers, :except => :show
212 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
212 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
213 map.resources :custom_fields, :except => :show
213 map.resources :custom_fields, :except => :show
214 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
214 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
215 map.resources :enumerations, :except => :show
215
216
216 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
217 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
217
218
218 map.connect 'mail_handler', :controller => 'mail_handler', :action => 'index', :conditions => {:method => :post}
219 map.connect 'mail_handler', :controller => 'mail_handler', :action => 'index', :conditions => {:method => :post}
219
220
220 map.connect 'admin', :controller => 'admin', :action => 'index', :conditions => {:method => :get}
221 map.connect 'admin', :controller => 'admin', :action => 'index', :conditions => {:method => :get}
221 map.connect 'admin/projects', :controller => 'admin', :action => 'projects', :conditions => {:method => :get}
222 map.connect 'admin/projects', :controller => 'admin', :action => 'projects', :conditions => {:method => :get}
222 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins', :conditions => {:method => :get}
223 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins', :conditions => {:method => :get}
223 map.connect 'admin/info', :controller => 'admin', :action => 'info', :conditions => {:method => :get}
224 map.connect 'admin/info', :controller => 'admin', :action => 'info', :conditions => {:method => :get}
224 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email', :conditions => {:method => :get}
225 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email', :conditions => {:method => :get}
225 map.connect 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :conditions => {:method => :post}
226 map.connect 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :conditions => {:method => :post}
226
227
227 # Used by AuthSourcesControllerTest
228 # Used by AuthSourcesControllerTest
228 # TODO : refactor *AuthSourcesController to remove these routes
229 # TODO : refactor *AuthSourcesController to remove these routes
229 map.connect 'auth_sources', :controller => 'auth_sources', :action => 'index', :conditions => {:method => :get}
230 map.connect 'auth_sources', :controller => 'auth_sources', :action => 'index', :conditions => {:method => :get}
230 map.connect 'auth_sources/new', :controller => 'auth_sources', :action => 'new', :conditions => {:method => :get}
231 map.connect 'auth_sources/new', :controller => 'auth_sources', :action => 'new', :conditions => {:method => :get}
231 map.connect 'auth_sources/create', :controller => 'auth_sources', :action => 'create', :conditions => {:method => :post}
232 map.connect 'auth_sources/create', :controller => 'auth_sources', :action => 'create', :conditions => {:method => :post}
232 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
233 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
233 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources', :action => 'test_connection', :conditions => {:method => :get}
234 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources', :action => 'test_connection', :conditions => {:method => :get}
234 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
235 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
235 map.connect 'auth_sources/update/:id', :controller => 'auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
236 map.connect 'auth_sources/update/:id', :controller => 'auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
236
237
237 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources', :action => 'index', :conditions => {:method => :get}
238 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources', :action => 'index', :conditions => {:method => :get}
238 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources', :action => 'new', :conditions => {:method => :get}
239 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources', :action => 'new', :conditions => {:method => :get}
239 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources', :action => 'create', :conditions => {:method => :post}
240 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources', :action => 'create', :conditions => {:method => :post}
240 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
241 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
241 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources', :action => 'test_connection', :conditions => {:method => :get}
242 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources', :action => 'test_connection', :conditions => {:method => :get}
242 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
243 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
243 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
244 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
244 map.connect 'workflows', :controller => 'workflows', :action => 'index', :conditions => {:method => :get}
245 map.connect 'workflows', :controller => 'workflows', :action => 'index', :conditions => {:method => :get}
245 map.connect 'workflows/edit', :controller => 'workflows', :action => 'edit', :conditions => {:method => [:get, :post]}
246 map.connect 'workflows/edit', :controller => 'workflows', :action => 'edit', :conditions => {:method => [:get, :post]}
246 map.connect 'workflows/copy', :controller => 'workflows', :action => 'copy', :conditions => {:method => [:get, :post]}
247 map.connect 'workflows/copy', :controller => 'workflows', :action => 'copy', :conditions => {:method => [:get, :post]}
247 map.connect 'enumerations', :controller => 'enumerations', :action => 'index', :conditions => {:method => :get}
248 map.connect 'enumerations/new', :controller => 'enumerations', :action => 'new', :conditions => {:method => :get}
249 map.connect 'enumerations/create', :controller => 'enumerations', :action => 'create', :conditions => {:method => :post}
250 map.connect 'enumerations/edit/:id', :controller => 'enumerations', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
251 map.connect 'enumerations/update/:id', :controller => 'enumerations', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
252 map.connect 'enumerations/destroy/:id', :controller => 'enumerations', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
253 map.connect 'settings', :controller => 'settings', :action => 'index', :conditions => {:method => :get}
248 map.connect 'settings', :controller => 'settings', :action => 'index', :conditions => {:method => :get}
254 map.connect 'settings/edit', :controller => 'settings', :action => 'edit', :conditions => {:method => [:get, :post]}
249 map.connect 'settings/edit', :controller => 'settings', :action => 'edit', :conditions => {:method => [:get, :post]}
255 map.connect 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :conditions => {:method => [:get, :post]}
250 map.connect 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :conditions => {:method => [:get, :post]}
256
251
257 map.with_options :controller => 'sys' do |sys|
252 map.with_options :controller => 'sys' do |sys|
258 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
253 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
259 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
254 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
260 sys.connect 'sys/fetch_changesets', :action => 'fetch_changesets', :conditions => {:method => :get}
255 sys.connect 'sys/fetch_changesets', :action => 'fetch_changesets', :conditions => {:method => :get}
261 end
256 end
262
257
263 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots', :conditions => {:method => :get}
258 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots', :conditions => {:method => :get}
264
259
265 # Used for OpenID
260 # Used for OpenID
266 map.root :controller => 'account', :action => 'login'
261 map.root :controller => 'account', :action => 'login'
267 end
262 end
@@ -1,101 +1,110
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 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.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class EnumerationsControllerTest < ActionController::TestCase
20 class EnumerationsControllerTest < ActionController::TestCase
21 fixtures :enumerations, :issues, :users
21 fixtures :enumerations, :issues, :users
22
22
23 def setup
23 def setup
24 @request.session[:user_id] = 1 # admin
24 @request.session[:user_id] = 1 # admin
25 end
25 end
26
26
27 def test_index
27 def test_index
28 get :index
28 get :index
29 assert_response :success
29 assert_response :success
30 assert_template 'index'
30 assert_template 'index'
31 end
31 end
32
32
33 def test_new
33 def test_new
34 get :new, :type => 'IssuePriority'
34 get :new, :type => 'IssuePriority'
35 assert_response :success
35 assert_response :success
36 assert_template 'new'
36 assert_template 'new'
37 assert_kind_of IssuePriority, assigns(:enumeration)
37 assert_kind_of IssuePriority, assigns(:enumeration)
38 assert_tag 'input', :attributes => {:name => 'enumeration[type]', :value => 'IssuePriority'}
39 assert_tag 'input', :attributes => {:name => 'enumeration[name]'}
38 end
40 end
39
41
40 def test_create
42 def test_create
41 assert_difference 'IssuePriority.count' do
43 assert_difference 'IssuePriority.count' do
42 post :create, :enumeration => {:type => 'IssuePriority', :name => 'Lowest'}
44 post :create, :enumeration => {:type => 'IssuePriority', :name => 'Lowest'}
43 end
45 end
44 assert_redirected_to '/enumerations?type=IssuePriority'
46 assert_redirected_to '/enumerations?type=IssuePriority'
45 e = IssuePriority.first(:order => 'id DESC')
47 e = IssuePriority.first(:order => 'id DESC')
46 assert_equal 'Lowest', e.name
48 assert_equal 'Lowest', e.name
47 end
49 end
48
50
49 def test_create_with_failure
51 def test_create_with_failure
50 assert_no_difference 'IssuePriority.count' do
52 assert_no_difference 'IssuePriority.count' do
51 post :create, :enumeration => {:type => 'IssuePriority', :name => ''}
53 post :create, :enumeration => {:type => 'IssuePriority', :name => ''}
52 end
54 end
53 assert_response :success
55 assert_response :success
54 assert_template 'new'
56 assert_template 'new'
55 end
57 end
56
58
57 def test_edit
59 def test_edit
58 get :edit, :id => 6
60 get :edit, :id => 6
59 assert_response :success
61 assert_response :success
60 assert_template 'edit'
62 assert_template 'edit'
63 assert_tag 'input', :attributes => {:name => 'enumeration[name]', :value => 'High'}
61 end
64 end
62
65
63 def test_update
66 def test_update
64 assert_no_difference 'IssuePriority.count' do
67 assert_no_difference 'IssuePriority.count' do
65 post :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'}
68 put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'}
66 end
69 end
67 assert_redirected_to '/enumerations?type=IssuePriority'
70 assert_redirected_to '/enumerations?type=IssuePriority'
68 e = IssuePriority.find(6)
71 e = IssuePriority.find(6)
69 assert_equal 'New name', e.name
72 assert_equal 'New name', e.name
70 end
73 end
71
74
72 def test_update_with_failure
75 def test_update_with_failure
73 assert_no_difference 'IssuePriority.count' do
76 assert_no_difference 'IssuePriority.count' do
74 post :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => ''}
77 put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => ''}
75 end
78 end
76 assert_response :success
79 assert_response :success
77 assert_template 'edit'
80 assert_template 'edit'
78 end
81 end
79
82
80 def test_destroy_enumeration_not_in_use
83 def test_destroy_enumeration_not_in_use
81 post :destroy, :id => 7
84 assert_difference 'IssuePriority.count', -1 do
85 delete :destroy, :id => 7
86 end
82 assert_redirected_to :controller => 'enumerations', :action => 'index'
87 assert_redirected_to :controller => 'enumerations', :action => 'index'
83 assert_nil Enumeration.find_by_id(7)
88 assert_nil Enumeration.find_by_id(7)
84 end
89 end
85
90
86 def test_destroy_enumeration_in_use
91 def test_destroy_enumeration_in_use
87 post :destroy, :id => 4
92 assert_no_difference 'IssuePriority.count' do
93 delete :destroy, :id => 4
94 end
88 assert_response :success
95 assert_response :success
89 assert_template 'destroy'
96 assert_template 'destroy'
90 assert_not_nil Enumeration.find_by_id(4)
97 assert_not_nil Enumeration.find_by_id(4)
91 end
98 end
92
99
93 def test_destroy_enumeration_in_use_with_reassignment
100 def test_destroy_enumeration_in_use_with_reassignment
94 issue = Issue.find(:first, :conditions => {:priority_id => 4})
101 issue = Issue.find(:first, :conditions => {:priority_id => 4})
95 post :destroy, :id => 4, :reassign_to_id => 6
102 assert_difference 'IssuePriority.count', -1 do
103 delete :destroy, :id => 4, :reassign_to_id => 6
104 end
96 assert_redirected_to :controller => 'enumerations', :action => 'index'
105 assert_redirected_to :controller => 'enumerations', :action => 'index'
97 assert_nil Enumeration.find_by_id(4)
106 assert_nil Enumeration.find_by_id(4)
98 # check that the issue was reassign
107 # check that the issue was reassign
99 assert_equal 6, issue.reload.priority_id
108 assert_equal 6, issue.reload.priority_id
100 end
109 end
101 end
110 end
@@ -1,443 +1,452
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 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.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
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.xml", :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml'
28 should_route :get, "/attachments/1.xml", :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml'
29 should_route :get, "/attachments/1.json", :controller => 'attachments', :action => 'show', :id => '1', :format => 'json'
29 should_route :get, "/attachments/1.json", :controller => 'attachments', :action => 'show', :id => '1', :format => 'json'
30 should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
30 should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
31 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
31 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
32 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
32 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
33 end
33 end
34
34
35 context "boards" do
35 context "boards" do
36 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
36 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
37 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
37 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
38 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
38 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
39 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
39 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
40 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
40 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
41
41
42 should_route :post, "/projects/world_domination/boards", :controller => 'boards', :action => 'create', :project_id => 'world_domination'
42 should_route :post, "/projects/world_domination/boards", :controller => 'boards', :action => 'create', :project_id => 'world_domination'
43 should_route :put, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44'
43 should_route :put, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44'
44 should_route :delete, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
44 should_route :delete, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
45
45
46 end
46 end
47
47
48 context "custom_fields" do
48 context "custom_fields" do
49 should_route :get, "/custom_fields", :controller => 'custom_fields', :action => 'index'
49 should_route :get, "/custom_fields", :controller => 'custom_fields', :action => 'index'
50 should_route :get, "/custom_fields/new", :controller => 'custom_fields', :action => 'new'
50 should_route :get, "/custom_fields/new", :controller => 'custom_fields', :action => 'new'
51 should_route :post, "/custom_fields", :controller => 'custom_fields', :action => 'create'
51 should_route :post, "/custom_fields", :controller => 'custom_fields', :action => 'create'
52 should_route :get, "/custom_fields/2/edit", :controller => 'custom_fields', :action => 'edit', :id => 2
52 should_route :get, "/custom_fields/2/edit", :controller => 'custom_fields', :action => 'edit', :id => 2
53 should_route :put, "/custom_fields/2", :controller => 'custom_fields', :action => 'update', :id => 2
53 should_route :put, "/custom_fields/2", :controller => 'custom_fields', :action => 'update', :id => 2
54 should_route :delete, "/custom_fields/2", :controller => 'custom_fields', :action => 'destroy', :id => 2
54 should_route :delete, "/custom_fields/2", :controller => 'custom_fields', :action => 'destroy', :id => 2
55 end
55 end
56
56
57 context "documents" do
57 context "documents" do
58 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
58 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
59 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
59 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
60 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
60 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
61 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
61 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
62
62
63 should_route :post, "/projects/567/documents", :controller => 'documents', :action => 'create', :project_id => '567'
63 should_route :post, "/projects/567/documents", :controller => 'documents', :action => 'create', :project_id => '567'
64 should_route :put, "/documents/22", :controller => 'documents', :action => 'update', :id => '22'
64 should_route :put, "/documents/22", :controller => 'documents', :action => 'update', :id => '22'
65 should_route :delete, "/documents/22", :controller => 'documents', :action => 'destroy', :id => '22'
65 should_route :delete, "/documents/22", :controller => 'documents', :action => 'destroy', :id => '22'
66
66
67 should_route :post, "/documents/22/add_attachment", :controller => 'documents', :action => 'add_attachment', :id => '22'
67 should_route :post, "/documents/22/add_attachment", :controller => 'documents', :action => 'add_attachment', :id => '22'
68 end
68 end
69
70 context "roles" do
71 should_route :get, "/enumerations", :controller => 'enumerations', :action => 'index'
72 should_route :get, "/enumerations/new", :controller => 'enumerations', :action => 'new'
73 should_route :post, "/enumerations", :controller => 'enumerations', :action => 'create'
74 should_route :get, "/enumerations/2/edit", :controller => 'enumerations', :action => 'edit', :id => 2
75 should_route :put, "/enumerations/2", :controller => 'enumerations', :action => 'update', :id => 2
76 should_route :delete, "/enumerations/2", :controller => 'enumerations', :action => 'destroy', :id => 2
77 end
69
78
70 context "groups" do
79 context "groups" do
71 should_route :post, "/groups/567/users", :controller => 'groups', :action => 'add_users', :id => '567'
80 should_route :post, "/groups/567/users", :controller => 'groups', :action => 'add_users', :id => '567'
72 should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12'
81 should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12'
73 end
82 end
74
83
75 context "issues" do
84 context "issues" do
76 # REST actions
85 # REST actions
77 should_route :get, "/issues", :controller => 'issues', :action => 'index'
86 should_route :get, "/issues", :controller => 'issues', :action => 'index'
78 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
87 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
79 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
88 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
80 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
89 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
81 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
90 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
82 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
91 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
83 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
92 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
84 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
93 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
85 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
94 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
86 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
95 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
87 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
96 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
88 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
97 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
89
98
90 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
99 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
91 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
100 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
92 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
101 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
93
102
94 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
103 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
95 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
104 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
96
105
97 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
106 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
98
107
99 # Extra actions
108 # Extra actions
100 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
109 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
101
110
102 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
111 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
103 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
112 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
104
113
105 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
114 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
106
115
107 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
116 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
108 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
117 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
109
118
110 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
119 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
111 should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf'
120 should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf'
112 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
121 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
113 should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf'
122 should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf'
114
123
115 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
124 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
116
125
117 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
126 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
118 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
127 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
119 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
128 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
120 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
129 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
121
130
122 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
131 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
123
132
124 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
133 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
125 should_route :post, "/issues/bulk_update", :controller => 'issues', :action => 'bulk_update'
134 should_route :post, "/issues/bulk_update", :controller => 'issues', :action => 'bulk_update'
126 end
135 end
127
136
128 context "issue categories" do
137 context "issue categories" do
129 should_route :get, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'index', :project_id => 'foo'
138 should_route :get, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'index', :project_id => 'foo'
130 should_route :get, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'xml'
139 should_route :get, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'xml'
131 should_route :get, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'json'
140 should_route :get, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'json'
132
141
133 should_route :get, "/projects/foo/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'foo'
142 should_route :get, "/projects/foo/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'foo'
134
143
135 should_route :post, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'create', :project_id => 'foo'
144 should_route :post, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'create', :project_id => 'foo'
136 should_route :post, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'xml'
145 should_route :post, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'xml'
137 should_route :post, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'json'
146 should_route :post, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'json'
138
147
139 should_route :get, "/issue_categories/1", :controller => 'issue_categories', :action => 'show', :id => '1'
148 should_route :get, "/issue_categories/1", :controller => 'issue_categories', :action => 'show', :id => '1'
140 should_route :get, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'xml'
149 should_route :get, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'xml'
141 should_route :get, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'json'
150 should_route :get, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'json'
142
151
143 should_route :get, "/issue_categories/1/edit", :controller => 'issue_categories', :action => 'edit', :id => '1'
152 should_route :get, "/issue_categories/1/edit", :controller => 'issue_categories', :action => 'edit', :id => '1'
144
153
145 should_route :put, "/issue_categories/1", :controller => 'issue_categories', :action => 'update', :id => '1'
154 should_route :put, "/issue_categories/1", :controller => 'issue_categories', :action => 'update', :id => '1'
146 should_route :put, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'xml'
155 should_route :put, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'xml'
147 should_route :put, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'json'
156 should_route :put, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'json'
148
157
149 should_route :delete, "/issue_categories/1", :controller => 'issue_categories', :action => 'destroy', :id => '1'
158 should_route :delete, "/issue_categories/1", :controller => 'issue_categories', :action => 'destroy', :id => '1'
150 should_route :delete, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'xml'
159 should_route :delete, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'xml'
151 should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json'
160 should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json'
152 end
161 end
153
162
154 context "issue relations" do
163 context "issue relations" do
155 should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1'
164 should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1'
156 should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml'
165 should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml'
157 should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json'
166 should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json'
158
167
159 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1'
168 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1'
160 should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml'
169 should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml'
161 should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json'
170 should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json'
162
171
163 should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23'
172 should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23'
164 should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml'
173 should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml'
165 should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json'
174 should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json'
166
175
167 should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23'
176 should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23'
168 should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml'
177 should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml'
169 should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json'
178 should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json'
170 end
179 end
171
180
172 context "issue reports" do
181 context "issue reports" do
173 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
182 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
174 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
183 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
175 end
184 end
176
185
177 context "members" do
186 context "members" do
178 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
187 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
179 end
188 end
180
189
181 context "messages" do
190 context "messages" do
182 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
191 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
183 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
192 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
184 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
193 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
185
194
186 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
195 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
187 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
196 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
188 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
197 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
189 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
198 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
190 end
199 end
191
200
192 context "news" do
201 context "news" do
193 should_route :get, "/news", :controller => 'news', :action => 'index'
202 should_route :get, "/news", :controller => 'news', :action => 'index'
194 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
203 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
195 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
204 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
196 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
205 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
197 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
206 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
198 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
207 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
199 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
208 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
200 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
209 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
201 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
210 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
202 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
211 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
203 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
212 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
204 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
213 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
205 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
214 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
206
215
207 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
216 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
208 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
217 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
209
218
210 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
219 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
211
220
212 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
221 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
213 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
222 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
214 end
223 end
215
224
216 context "projects" do
225 context "projects" do
217 should_route :get, "/projects", :controller => 'projects', :action => 'index'
226 should_route :get, "/projects", :controller => 'projects', :action => 'index'
218 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
227 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
219 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
228 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
220 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
229 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
221 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
230 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
222 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
231 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
223 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
232 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
224 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
233 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
225 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
234 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
226 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
235 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
227 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
236 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
228 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
237 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
229 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
238 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
230
239
231 should_route :post, "/projects", :controller => 'projects', :action => 'create'
240 should_route :post, "/projects", :controller => 'projects', :action => 'create'
232 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
241 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
233 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
242 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
234 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
243 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
235 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
244 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
236
245
237 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
246 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
238 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
247 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
239 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
248 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
240
249
241 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
250 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
242 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
251 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
243 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
252 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
244 end
253 end
245
254
246 context "queries" do
255 context "queries" do
247 should_route :get, "/queries.xml", :controller => 'queries', :action => 'index', :format => 'xml'
256 should_route :get, "/queries.xml", :controller => 'queries', :action => 'index', :format => 'xml'
248 should_route :get, "/queries.json", :controller => 'queries', :action => 'index', :format => 'json'
257 should_route :get, "/queries.json", :controller => 'queries', :action => 'index', :format => 'json'
249
258
250 should_route :get, "/queries/new", :controller => 'queries', :action => 'new'
259 should_route :get, "/queries/new", :controller => 'queries', :action => 'new'
251 should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
260 should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
252
261
253 should_route :post, "/queries", :controller => 'queries', :action => 'create'
262 should_route :post, "/queries", :controller => 'queries', :action => 'create'
254 should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine'
263 should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine'
255
264
256 should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1'
265 should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1'
257
266
258 should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1'
267 should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1'
259
268
260 should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1'
269 should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1'
261 end
270 end
262
271
263 context "repositories" do
272 context "repositories" do
264 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
273 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
265 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
274 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
266 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
275 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
267 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
276 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
268 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
277 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
269 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
278 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
270 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
279 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
271 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
280 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
272 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'
281 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'
273 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
282 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
274 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
283 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
275 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'
284 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'
276 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'
285 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'
277 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'
286 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'
278 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
287 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
279 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
288 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
280 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
289 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
281
290
282 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
291 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
283 end
292 end
284
293
285 context "roles" do
294 context "roles" do
286 should_route :get, "/roles", :controller => 'roles', :action => 'index'
295 should_route :get, "/roles", :controller => 'roles', :action => 'index'
287 should_route :get, "/roles/new", :controller => 'roles', :action => 'new'
296 should_route :get, "/roles/new", :controller => 'roles', :action => 'new'
288 should_route :post, "/roles", :controller => 'roles', :action => 'create'
297 should_route :post, "/roles", :controller => 'roles', :action => 'create'
289 should_route :get, "/roles/2/edit", :controller => 'roles', :action => 'edit', :id => 2
298 should_route :get, "/roles/2/edit", :controller => 'roles', :action => 'edit', :id => 2
290 should_route :put, "/roles/2", :controller => 'roles', :action => 'update', :id => 2
299 should_route :put, "/roles/2", :controller => 'roles', :action => 'update', :id => 2
291 should_route :delete, "/roles/2", :controller => 'roles', :action => 'destroy', :id => 2
300 should_route :delete, "/roles/2", :controller => 'roles', :action => 'destroy', :id => 2
292 should_route :get, "/roles/permissions", :controller => 'roles', :action => 'permissions'
301 should_route :get, "/roles/permissions", :controller => 'roles', :action => 'permissions'
293 should_route :post, "/roles/permissions", :controller => 'roles', :action => 'permissions'
302 should_route :post, "/roles/permissions", :controller => 'roles', :action => 'permissions'
294 end
303 end
295
304
296 context "timelogs (global)" do
305 context "timelogs (global)" do
297 should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
306 should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
298 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
307 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
299 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
308 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
300 should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
309 should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
301 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
310 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
302
311
303 should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
312 should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
304
313
305 should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
314 should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
306
315
307 should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
316 should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
308 end
317 end
309
318
310 context "timelogs (scoped under project)" do
319 context "timelogs (scoped under project)" do
311 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
320 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
312 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
321 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
313 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
322 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
314 should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
323 should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
315 should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
324 should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
316
325
317 should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
326 should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
318
327
319 should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
328 should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
320
329
321 should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
330 should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
322 end
331 end
323
332
324 context "timelogs (scoped under issues)" do
333 context "timelogs (scoped under issues)" do
325 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
334 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
326 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
335 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
327 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
336 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
328 should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
337 should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
329 should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
338 should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
330
339
331 should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
340 should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
332
341
333 should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
342 should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
334
343
335 should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
344 should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
336 end
345 end
337
346
338 context "timelogs (scoped under project and issues)" do
347 context "timelogs (scoped under project and issues)" do
339 should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
348 should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
340 should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
349 should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
341 should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
350 should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
342 should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
351 should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
343 should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
352 should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
344
353
345 should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
354 should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
346
355
347 should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
356 should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
348
357
349 should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
358 should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
350
359
351 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
360 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
352 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
361 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
353 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
362 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
354 end
363 end
355
364
356 context "users" do
365 context "users" do
357 should_route :get, "/users", :controller => 'users', :action => 'index'
366 should_route :get, "/users", :controller => 'users', :action => 'index'
358 should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
367 should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
359 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
368 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
360 should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
369 should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
361 should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
370 should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
362 should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
371 should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
363 should_route :get, "/users/new", :controller => 'users', :action => 'new'
372 should_route :get, "/users/new", :controller => 'users', :action => 'new'
364 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
373 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
365
374
366 should_route :post, "/users", :controller => 'users', :action => 'create'
375 should_route :post, "/users", :controller => 'users', :action => 'create'
367 should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
376 should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
368
377
369 should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
378 should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
370 should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
379 should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
371
380
372 should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
381 should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
373 should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
382 should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
374
383
375 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
384 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
376 should_route :put, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
385 should_route :put, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
377 should_route :delete, "/users/123/memberships/55", :controller => 'users', :action => 'destroy_membership', :id => '123', :membership_id => '55'
386 should_route :delete, "/users/123/memberships/55", :controller => 'users', :action => 'destroy_membership', :id => '123', :membership_id => '55'
378 end
387 end
379
388
380 context "versions" do
389 context "versions" do
381 # /projects/foo/versions is /projects/foo/roadmap
390 # /projects/foo/versions is /projects/foo/roadmap
382 should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
391 should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
383 should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
392 should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
384
393
385 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
394 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
386
395
387 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
396 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
388 should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
397 should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
389 should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
398 should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
390
399
391 should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
400 should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
392 should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
401 should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
393 should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
402 should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
394
403
395 should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
404 should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
396
405
397 should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
406 should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
398 should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
407 should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
399 should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
408 should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
400
409
401 should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
410 should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
402 should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
411 should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
403 should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
412 should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
404
413
405 should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
414 should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
406 should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
415 should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
407 end
416 end
408
417
409 context "wiki (singular, project's pages)" do
418 context "wiki (singular, project's pages)" do
410 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
419 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
411 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
420 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
412 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
421 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
413 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
422 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
414 should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
423 should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
415 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
424 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
416 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1'
425 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1'
417 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
426 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
418 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
427 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
419 should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
428 should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
420 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
429 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
421 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
430 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
422
431
423 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
432 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
424 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
433 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
425 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
434 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
426 should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
435 should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
427
436
428 should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
437 should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
429
438
430 should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
439 should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
431 end
440 end
432
441
433 context "wikis (plural, admin setup)" do
442 context "wikis (plural, admin setup)" do
434 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
443 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
435
444
436 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
445 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
437 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
446 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
438 end
447 end
439
448
440 context "administration panel" do
449 context "administration panel" do
441 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
450 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
442 end
451 end
443 end
452 end
General Comments 0
You need to be logged in to leave comments. Login now