##// END OF EJS Templates
Makes relations resource shallow (#7366)....
Jean-Philippe Lang -
r6064:42f9dc7d2c5a
parent child
Show More
@@ -1,96 +1,101
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 IssueRelationsController < ApplicationController
18 class IssueRelationsController < ApplicationController
19 before_filter :find_issue, :find_project_from_association, :authorize
19 before_filter :find_issue, :find_project_from_association, :authorize, :only => [:index, :create]
20 before_filter :find_relation, :except => [:index, :create]
21
20 accept_key_auth :index, :show, :create, :destroy
22 accept_key_auth :index, :show, :create, :destroy
21
23
22 def index
24 def index
23 @relations = @issue.relations
25 @relations = @issue.relations
24
26
25 respond_to do |format|
27 respond_to do |format|
26 format.html { render :nothing => true }
28 format.html { render :nothing => true }
27 format.api
29 format.api
28 end
30 end
29 end
31 end
30
32
31 def show
33 def show
32 @relation = @issue.find_relation(params[:id])
34 raise Unauthorized unless @relation.visible?
33
35
34 respond_to do |format|
36 respond_to do |format|
35 format.html { render :nothing => true }
37 format.html { render :nothing => true }
36 format.api
38 format.api
37 end
39 end
38 rescue ActiveRecord::RecordNotFound
40 rescue ActiveRecord::RecordNotFound
39 render_404
41 render_404
40 end
42 end
41
43
42 verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
44 verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
43 def create
45 def create
44 @relation = IssueRelation.new(params[:relation])
46 @relation = IssueRelation.new(params[:relation])
45 @relation.issue_from = @issue
47 @relation.issue_from = @issue
46 if params[:relation] && m = params[:relation][:issue_to_id].to_s.match(/^#?(\d+)$/)
48 if params[:relation] && m = params[:relation][:issue_to_id].to_s.match(/^#?(\d+)$/)
47 @relation.issue_to = Issue.visible.find_by_id(m[1].to_i)
49 @relation.issue_to = Issue.visible.find_by_id(m[1].to_i)
48 end
50 end
49 saved = @relation.save
51 saved = @relation.save
50
52
51 respond_to do |format|
53 respond_to do |format|
52 format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
54 format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
53 format.js do
55 format.js do
54 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
56 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
55 render :update do |page|
57 render :update do |page|
56 page.replace_html "relations", :partial => 'issues/relations'
58 page.replace_html "relations", :partial => 'issues/relations'
57 if @relation.errors.empty?
59 if @relation.errors.empty?
58 page << "$('relation_delay').value = ''"
60 page << "$('relation_delay').value = ''"
59 page << "$('relation_issue_to_id').value = ''"
61 page << "$('relation_issue_to_id').value = ''"
60 end
62 end
61 end
63 end
62 end
64 end
63 format.api {
65 format.api {
64 if saved
66 if saved
65 render :action => 'show', :status => :created, :location => issue_relation_url(@issue, @relation)
67 render :action => 'show', :status => :created, :location => relation_url(@relation)
66 else
68 else
67 render_validation_errors(@relation)
69 render_validation_errors(@relation)
68 end
70 end
69 }
71 }
70 end
72 end
71 end
73 end
72
74
73 verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
75 verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
74 def destroy
76 def destroy
75 relation = @issue.find_relation(params[:id])
77 raise Unauthorized unless @relation.deletable?
76 relation.destroy
78 @relation.destroy
77
79
78 respond_to do |format|
80 respond_to do |format|
79 format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
81 format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
80 format.js {
82 format.js { render(:update) {|page| page.remove "relation-#{@relation.id}"} }
81 @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
83 format.api { head :ok }
82 render(:update) {|page| page.replace_html "relations", :partial => 'issues/relations'}
83 }
84 format.api { head :ok }
85 end
84 end
86 rescue ActiveRecord::RecordNotFound
85 rescue ActiveRecord::RecordNotFound
87 render_404
86 render_404
88 end
87 end
89
88
90 private
89 private
91 def find_issue
90 def find_issue
92 @issue = @object = Issue.find(params[:issue_id])
91 @issue = @object = Issue.find(params[:issue_id])
93 rescue ActiveRecord::RecordNotFound
92 rescue ActiveRecord::RecordNotFound
94 render_404
93 render_404
95 end
94 end
95
96 def find_relation
97 @relation = IssueRelation.find(params[:id])
98 rescue ActiveRecord::RecordNotFound
99 render_404
100 end
96 end
101 end
@@ -1,128 +1,138
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 IssueRelation < ActiveRecord::Base
18 class IssueRelation < ActiveRecord::Base
19 belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id'
19 belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id'
20 belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id'
20 belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id'
21
21
22 TYPE_RELATES = "relates"
22 TYPE_RELATES = "relates"
23 TYPE_DUPLICATES = "duplicates"
23 TYPE_DUPLICATES = "duplicates"
24 TYPE_DUPLICATED = "duplicated"
24 TYPE_DUPLICATED = "duplicated"
25 TYPE_BLOCKS = "blocks"
25 TYPE_BLOCKS = "blocks"
26 TYPE_BLOCKED = "blocked"
26 TYPE_BLOCKED = "blocked"
27 TYPE_PRECEDES = "precedes"
27 TYPE_PRECEDES = "precedes"
28 TYPE_FOLLOWS = "follows"
28 TYPE_FOLLOWS = "follows"
29
29
30 TYPES = { TYPE_RELATES => { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1, :sym => TYPE_RELATES },
30 TYPES = { TYPE_RELATES => { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1, :sym => TYPE_RELATES },
31 TYPE_DUPLICATES => { :name => :label_duplicates, :sym_name => :label_duplicated_by, :order => 2, :sym => TYPE_DUPLICATED },
31 TYPE_DUPLICATES => { :name => :label_duplicates, :sym_name => :label_duplicated_by, :order => 2, :sym => TYPE_DUPLICATED },
32 TYPE_DUPLICATED => { :name => :label_duplicated_by, :sym_name => :label_duplicates, :order => 3, :sym => TYPE_DUPLICATES, :reverse => TYPE_DUPLICATES },
32 TYPE_DUPLICATED => { :name => :label_duplicated_by, :sym_name => :label_duplicates, :order => 3, :sym => TYPE_DUPLICATES, :reverse => TYPE_DUPLICATES },
33 TYPE_BLOCKS => { :name => :label_blocks, :sym_name => :label_blocked_by, :order => 4, :sym => TYPE_BLOCKED },
33 TYPE_BLOCKS => { :name => :label_blocks, :sym_name => :label_blocked_by, :order => 4, :sym => TYPE_BLOCKED },
34 TYPE_BLOCKED => { :name => :label_blocked_by, :sym_name => :label_blocks, :order => 5, :sym => TYPE_BLOCKS, :reverse => TYPE_BLOCKS },
34 TYPE_BLOCKED => { :name => :label_blocked_by, :sym_name => :label_blocks, :order => 5, :sym => TYPE_BLOCKS, :reverse => TYPE_BLOCKS },
35 TYPE_PRECEDES => { :name => :label_precedes, :sym_name => :label_follows, :order => 6, :sym => TYPE_FOLLOWS },
35 TYPE_PRECEDES => { :name => :label_precedes, :sym_name => :label_follows, :order => 6, :sym => TYPE_FOLLOWS },
36 TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES }
36 TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES }
37 }.freeze
37 }.freeze
38
38
39 validates_presence_of :issue_from, :issue_to, :relation_type
39 validates_presence_of :issue_from, :issue_to, :relation_type
40 validates_inclusion_of :relation_type, :in => TYPES.keys
40 validates_inclusion_of :relation_type, :in => TYPES.keys
41 validates_numericality_of :delay, :allow_nil => true
41 validates_numericality_of :delay, :allow_nil => true
42 validates_uniqueness_of :issue_to_id, :scope => :issue_from_id
42 validates_uniqueness_of :issue_to_id, :scope => :issue_from_id
43
43
44 attr_protected :issue_from_id, :issue_to_id
44 attr_protected :issue_from_id, :issue_to_id
45
45
46 def visible?(user=User.current)
47 (issue_from.nil? || issue_from.visible?(user)) && (issue_to.nil? || issue_to.visible?(user))
48 end
49
50 def deletable?(user=User.current)
51 visible?(user) &&
52 ((issue_from.nil? || user.allowed_to?(:manage_issue_relations, issue_from.project)) ||
53 (issue_to.nil? || user.allowed_to?(:manage_issue_relations, issue_to.project)))
54 end
55
46 def after_initialize
56 def after_initialize
47 if new_record?
57 if new_record?
48 if relation_type.blank?
58 if relation_type.blank?
49 self.relation_type = IssueRelation::TYPE_RELATES
59 self.relation_type = IssueRelation::TYPE_RELATES
50 end
60 end
51 end
61 end
52 end
62 end
53
63
54 def validate
64 def validate
55 if issue_from && issue_to
65 if issue_from && issue_to
56 errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id
66 errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id
57 errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations?
67 errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations?
58 #detect circular dependencies depending wether the relation should be reversed
68 #detect circular dependencies depending wether the relation should be reversed
59 if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse]
69 if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse]
60 errors.add_to_base :circular_dependency if issue_from.all_dependent_issues.include? issue_to
70 errors.add_to_base :circular_dependency if issue_from.all_dependent_issues.include? issue_to
61 else
71 else
62 errors.add_to_base :circular_dependency if issue_to.all_dependent_issues.include? issue_from
72 errors.add_to_base :circular_dependency if issue_to.all_dependent_issues.include? issue_from
63 end
73 end
64 errors.add_to_base :cant_link_an_issue_with_a_descendant if issue_from.is_descendant_of?(issue_to) || issue_from.is_ancestor_of?(issue_to)
74 errors.add_to_base :cant_link_an_issue_with_a_descendant if issue_from.is_descendant_of?(issue_to) || issue_from.is_ancestor_of?(issue_to)
65 end
75 end
66 end
76 end
67
77
68 def other_issue(issue)
78 def other_issue(issue)
69 (self.issue_from_id == issue.id) ? issue_to : issue_from
79 (self.issue_from_id == issue.id) ? issue_to : issue_from
70 end
80 end
71
81
72 # Returns the relation type for +issue+
82 # Returns the relation type for +issue+
73 def relation_type_for(issue)
83 def relation_type_for(issue)
74 if TYPES[relation_type]
84 if TYPES[relation_type]
75 if self.issue_from_id == issue.id
85 if self.issue_from_id == issue.id
76 relation_type
86 relation_type
77 else
87 else
78 TYPES[relation_type][:sym]
88 TYPES[relation_type][:sym]
79 end
89 end
80 end
90 end
81 end
91 end
82
92
83 def label_for(issue)
93 def label_for(issue)
84 TYPES[relation_type] ? TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name] : :unknow
94 TYPES[relation_type] ? TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name] : :unknow
85 end
95 end
86
96
87 def before_save
97 def before_save
88 reverse_if_needed
98 reverse_if_needed
89
99
90 if TYPE_PRECEDES == relation_type
100 if TYPE_PRECEDES == relation_type
91 self.delay ||= 0
101 self.delay ||= 0
92 else
102 else
93 self.delay = nil
103 self.delay = nil
94 end
104 end
95 set_issue_to_dates
105 set_issue_to_dates
96 end
106 end
97
107
98 def set_issue_to_dates
108 def set_issue_to_dates
99 soonest_start = self.successor_soonest_start
109 soonest_start = self.successor_soonest_start
100 if soonest_start && issue_to
110 if soonest_start && issue_to
101 issue_to.reschedule_after(soonest_start)
111 issue_to.reschedule_after(soonest_start)
102 end
112 end
103 end
113 end
104
114
105 def successor_soonest_start
115 def successor_soonest_start
106 if (TYPE_PRECEDES == self.relation_type) && delay && issue_from && (issue_from.start_date || issue_from.due_date)
116 if (TYPE_PRECEDES == self.relation_type) && delay && issue_from && (issue_from.start_date || issue_from.due_date)
107 (issue_from.due_date || issue_from.start_date) + 1 + delay
117 (issue_from.due_date || issue_from.start_date) + 1 + delay
108 end
118 end
109 end
119 end
110
120
111 def <=>(relation)
121 def <=>(relation)
112 TYPES[self.relation_type][:order] <=> TYPES[relation.relation_type][:order]
122 TYPES[self.relation_type][:order] <=> TYPES[relation.relation_type][:order]
113 end
123 end
114
124
115 private
125 private
116
126
117 # Reverses the relation if needed so that it gets stored in the proper way
127 # Reverses the relation if needed so that it gets stored in the proper way
118 # Should not be reversed before validation so that it can be displayed back
128 # Should not be reversed before validation so that it can be displayed back
119 # as entered on new relation form
129 # as entered on new relation form
120 def reverse_if_needed
130 def reverse_if_needed
121 if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse]
131 if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse]
122 issue_tmp = issue_to
132 issue_tmp = issue_to
123 self.issue_to = issue_from
133 self.issue_to = issue_from
124 self.issue_from = issue_tmp
134 self.issue_from = issue_tmp
125 self.relation_type = TYPES[relation_type][:reverse]
135 self.relation_type = TYPES[relation_type][:reverse]
126 end
136 end
127 end
137 end
128 end
138 end
@@ -1,7 +1,7
1 api.relation do
1 api.relation do
2 api.id @relation.id
2 api.id @relation.id
3 api.issue_id @relation.issue_from_id
3 api.issue_id @relation.issue_from_id
4 api.issue_to_id @relation.issue_to_id
4 api.issue_to_id @relation.issue_to_id
5 api.relation_type @relation.relation_type_for(@issue)
5 api.relation_type @relation.relation_type
6 api.delay @relation.delay
6 api.delay @relation.delay
7 end
7 end
@@ -1,37 +1,37
1 <div class="contextual">
1 <div class="contextual">
2 <% if User.current.allowed_to?(:manage_issue_relations, @project) %>
2 <% if User.current.allowed_to?(:manage_issue_relations, @project) %>
3 <%= toggle_link l(:button_add), 'new-relation-form', {:focus => 'relation_issue_to_id'} %>
3 <%= toggle_link l(:button_add), 'new-relation-form', {:focus => 'relation_issue_to_id'} %>
4 <% end %>
4 <% end %>
5 </div>
5 </div>
6
6
7 <p><strong><%=l(:label_related_issues)%></strong></p>
7 <p><strong><%=l(:label_related_issues)%></strong></p>
8
8
9 <% if @relations.present? %>
9 <% if @relations.present? %>
10 <form>
10 <form>
11 <table class="list issues">
11 <table class="list issues">
12 <% @relations.each do |relation| %>
12 <% @relations.each do |relation| %>
13 <tr class="issue hascontextmenu">
13 <tr class="issue hascontextmenu" id="relation-<%= relation.id %>">
14 <td class="checkbox"><%= check_box_tag("ids[]", relation.other_issue(@issue).id, false, :id => nil) %></td>
14 <td class="checkbox"><%= check_box_tag("ids[]", relation.other_issue(@issue).id, false, :id => nil) %></td>
15 <td class="subject"><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %>
15 <td class="subject"><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %>
16 <%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %>
16 <%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %>
17 <%= link_to_issue(relation.other_issue(@issue), :truncate => 60) %>
17 <%= link_to_issue(relation.other_issue(@issue), :truncate => 60) %>
18 </td>
18 </td>
19 <td class="status"><%= relation.other_issue(@issue).status.name %></td>
19 <td class="status"><%= relation.other_issue(@issue).status.name %></td>
20 <td class="start_date"><%= format_date(relation.other_issue(@issue).start_date) %></td>
20 <td class="start_date"><%= format_date(relation.other_issue(@issue).start_date) %></td>
21 <td class="due_date"><%= format_date(relation.other_issue(@issue).due_date) %></td>
21 <td class="due_date"><%= format_date(relation.other_issue(@issue).due_date) %></td>
22 <td class="buttons"><%= link_to_remote(image_tag('link_break.png'), { :url => {:controller => 'issue_relations', :action => 'destroy', :issue_id => @issue, :id => relation},
22 <td class="buttons"><%= link_to_remote(image_tag('link_break.png'), { :url => {:controller => 'issue_relations', :action => 'destroy', :id => relation},
23 :method => :delete
23 :method => :delete
24 }, :title => l(:label_relation_delete)) if authorize_for('issue_relations', 'destroy') %></td>
24 }, :title => l(:label_relation_delete)) if authorize_for('issue_relations', 'destroy') %></td>
25 </tr>
25 </tr>
26 <% end %>
26 <% end %>
27 </table>
27 </table>
28 </form>
28 </form>
29 <% end %>
29 <% end %>
30
30
31 <% remote_form_for(:relation, @relation,
31 <% remote_form_for(:relation, @relation,
32 :url => {:controller => 'issue_relations', :action => 'create', :issue_id => @issue},
32 :url => {:controller => 'issue_relations', :action => 'create', :issue_id => @issue},
33 :method => :post,
33 :method => :post,
34 :complete => "Form.Element.focus('relation_issue_to_id');",
34 :complete => "Form.Element.focus('relation_issue_to_id');",
35 :html => {:id => 'new-relation-form', :style => (@relation ? '' : 'display: none;')}) do |f| %>
35 :html => {:id => 'new-relation-form', :style => (@relation ? '' : 'display: none;')}) do |f| %>
36 <%= render :partial => 'issue_relations/form', :locals => {:f => f}%>
36 <%= render :partial => 'issue_relations/form', :locals => {:f => f}%>
37 <% end %>
37 <% end %>
@@ -1,255 +1,255
1 ActionController::Routing::Routes.draw do |map|
1 ActionController::Routing::Routes.draw do |map|
2 # Add your own custom routes here.
2 # Add your own custom routes here.
3 # The priority is based upon order of creation: first created -> highest priority.
3 # The priority is based upon order of creation: first created -> highest priority.
4
4
5 # Here's a sample route:
5 # Here's a sample route:
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 # Keep in mind you can assign values other than :controller and :action
7 # Keep in mind you can assign values other than :controller and :action
8
8
9 map.home '', :controller => 'welcome'
9 map.home '', :controller => 'welcome'
10
10
11 map.signin 'login', :controller => 'account', :action => 'login'
11 map.signin 'login', :controller => 'account', :action => 'login'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
12 map.signout 'logout', :controller => 'account', :action => 'logout'
13
13
14 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
14 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
15 map.connect 'help/:ctrl/:page', :controller => 'help'
16
16
17 map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report|
17 map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report|
18 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report'
18 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report'
19 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format'
19 time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format'
20 time_report.connect 'projects/:project_id/time_entries/report'
20 time_report.connect 'projects/:project_id/time_entries/report'
21 time_report.connect 'projects/:project_id/time_entries/report.:format'
21 time_report.connect 'projects/:project_id/time_entries/report.:format'
22 time_report.connect 'time_entries/report'
22 time_report.connect 'time_entries/report'
23 time_report.connect 'time_entries/report.:format'
23 time_report.connect 'time_entries/report.:format'
24 end
24 end
25
25
26 map.bulk_edit_time_entry 'time_entries/bulk_edit',
26 map.bulk_edit_time_entry 'time_entries/bulk_edit',
27 :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get }
27 :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get }
28 map.bulk_update_time_entry 'time_entries/bulk_edit',
28 map.bulk_update_time_entry 'time_entries/bulk_edit',
29 :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post }
29 :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post }
30 map.time_entries_context_menu '/time_entries/context_menu',
30 map.time_entries_context_menu '/time_entries/context_menu',
31 :controller => 'context_menus', :action => 'time_entries'
31 :controller => 'context_menus', :action => 'time_entries'
32 # TODO: wasteful since this is also nested under issues, projects, and projects/issues
32 # TODO: wasteful since this is also nested under issues, projects, and projects/issues
33 map.resources :time_entries, :controller => 'timelog'
33 map.resources :time_entries, :controller => 'timelog'
34
34
35 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
35 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
36 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
36 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
37 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
37 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
38
38
39 map.with_options :controller => 'messages' do |messages_routes|
39 map.with_options :controller => 'messages' do |messages_routes|
40 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
40 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
41 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
41 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
42 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
42 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
43 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
43 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
44 end
44 end
45 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
45 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
46 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
46 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
47 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
47 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
48 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
48 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
49 end
49 end
50 end
50 end
51
51
52 map.with_options :controller => 'boards' do |board_routes|
52 map.with_options :controller => 'boards' do |board_routes|
53 board_routes.with_options :conditions => {:method => :get} do |board_views|
53 board_routes.with_options :conditions => {:method => :get} do |board_views|
54 board_views.connect 'projects/:project_id/boards', :action => 'index'
54 board_views.connect 'projects/:project_id/boards', :action => 'index'
55 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
55 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
56 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
56 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
57 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
57 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
58 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
58 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
59 end
59 end
60 board_routes.with_options :conditions => {:method => :post} do |board_actions|
60 board_routes.with_options :conditions => {:method => :post} do |board_actions|
61 board_actions.connect 'projects/:project_id/boards', :action => 'new'
61 board_actions.connect 'projects/:project_id/boards', :action => 'new'
62 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
62 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
63 end
63 end
64 end
64 end
65
65
66 map.with_options :controller => 'documents' do |document_routes|
66 map.with_options :controller => 'documents' do |document_routes|
67 document_routes.with_options :conditions => {:method => :get} do |document_views|
67 document_routes.with_options :conditions => {:method => :get} do |document_views|
68 document_views.connect 'projects/:project_id/documents', :action => 'index'
68 document_views.connect 'projects/:project_id/documents', :action => 'index'
69 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
69 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
70 document_views.connect 'documents/:id', :action => 'show'
70 document_views.connect 'documents/:id', :action => 'show'
71 document_views.connect 'documents/:id/edit', :action => 'edit'
71 document_views.connect 'documents/:id/edit', :action => 'edit'
72 end
72 end
73 document_routes.with_options :conditions => {:method => :post} do |document_actions|
73 document_routes.with_options :conditions => {:method => :post} do |document_actions|
74 document_actions.connect 'projects/:project_id/documents', :action => 'new'
74 document_actions.connect 'projects/:project_id/documents', :action => 'new'
75 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
75 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
76 end
76 end
77 end
77 end
78
78
79 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
79 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
80
80
81 # Misc issue routes. TODO: move into resources
81 # Misc issue routes. TODO: move into resources
82 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
82 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
83 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
83 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
84 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
84 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
85 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
85 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
86 map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
86 map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
87 map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
87 map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
88 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
88 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
89 map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
89 map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
90
90
91 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
91 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
92 gantts_routes.connect '/projects/:project_id/issues/gantt'
92 gantts_routes.connect '/projects/:project_id/issues/gantt'
93 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
93 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
94 gantts_routes.connect '/issues/gantt.:format'
94 gantts_routes.connect '/issues/gantt.:format'
95 end
95 end
96
96
97 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
97 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
98 calendars_routes.connect '/projects/:project_id/issues/calendar'
98 calendars_routes.connect '/projects/:project_id/issues/calendar'
99 calendars_routes.connect '/issues/calendar'
99 calendars_routes.connect '/issues/calendar'
100 end
100 end
101
101
102 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
102 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
103 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
103 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
104 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
104 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
105 end
105 end
106
106
107 # Following two routes conflict with the resources because #index allows POST
107 # Following two routes conflict with the resources because #index allows POST
108 map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
108 map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
109 map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
109 map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
110
110
111 map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues|
111 map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues|
112 issues.resources :time_entries, :controller => 'timelog'
112 issues.resources :time_entries, :controller => 'timelog'
113 issues.resources :relations, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
113 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
114 end
114 end
115
115
116 map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues|
116 map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues|
117 issues.resources :time_entries, :controller => 'timelog'
117 issues.resources :time_entries, :controller => 'timelog'
118 end
118 end
119
119
120 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
120 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
121
121
122 map.with_options :controller => 'users' do |users|
122 map.with_options :controller => 'users' do |users|
123 users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get}
123 users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get}
124
124
125 users.with_options :conditions => {:method => :post} do |user_actions|
125 users.with_options :conditions => {:method => :post} do |user_actions|
126 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
126 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
127 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
127 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
128 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
128 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
129 end
129 end
130 end
130 end
131
131
132 map.resources :users, :member => {
132 map.resources :users, :member => {
133 :edit_membership => :post,
133 :edit_membership => :post,
134 :destroy_membership => :post
134 :destroy_membership => :post
135 }
135 }
136
136
137 # For nice "roadmap" in the url for the index action
137 # For nice "roadmap" in the url for the index action
138 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
138 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
139
139
140 map.all_news 'news', :controller => 'news', :action => 'index'
140 map.all_news 'news', :controller => 'news', :action => 'index'
141 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
141 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
142 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
142 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
143 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
143 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
144 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
144 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
145
145
146 map.resources :projects, :member => {
146 map.resources :projects, :member => {
147 :copy => [:get, :post],
147 :copy => [:get, :post],
148 :settings => :get,
148 :settings => :get,
149 :modules => :post,
149 :modules => :post,
150 :archive => :post,
150 :archive => :post,
151 :unarchive => :post
151 :unarchive => :post
152 } do |project|
152 } do |project|
153 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
153 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
154 project.resources :files, :only => [:index, :new, :create]
154 project.resources :files, :only => [:index, :new, :create]
155 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
155 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
156 project.resources :news, :shallow => true
156 project.resources :news, :shallow => true
157 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
157 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
158
158
159 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
159 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
160 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
160 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
161 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
161 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
162 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
162 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
163 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
163 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
164 project.resources :wiki, :except => [:new, :create], :member => {
164 project.resources :wiki, :except => [:new, :create], :member => {
165 :rename => [:get, :post],
165 :rename => [:get, :post],
166 :history => :get,
166 :history => :get,
167 :preview => :any,
167 :preview => :any,
168 :protect => :post,
168 :protect => :post,
169 :add_attachment => :post
169 :add_attachment => :post
170 }, :collection => {
170 }, :collection => {
171 :export => :get,
171 :export => :get,
172 :date_index => :get
172 :date_index => :get
173 }
173 }
174
174
175 end
175 end
176
176
177 # Destroy uses a get request to prompt the user before the actual DELETE request
177 # Destroy uses a get request to prompt the user before the actual DELETE request
178 map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get}
178 map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get}
179
179
180 # TODO: port to be part of the resources route(s)
180 # TODO: port to be part of the resources route(s)
181 map.with_options :controller => 'projects' do |project_mapper|
181 map.with_options :controller => 'projects' do |project_mapper|
182 project_mapper.with_options :conditions => {:method => :get} do |project_views|
182 project_mapper.with_options :conditions => {:method => :get} do |project_views|
183 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
183 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
184 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
184 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
185 end
185 end
186 end
186 end
187
187
188 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
188 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
189 activity.connect 'projects/:id/activity'
189 activity.connect 'projects/:id/activity'
190 activity.connect 'projects/:id/activity.:format'
190 activity.connect 'projects/:id/activity.:format'
191 activity.connect 'activity', :id => nil
191 activity.connect 'activity', :id => nil
192 activity.connect 'activity.:format', :id => nil
192 activity.connect 'activity.:format', :id => nil
193 end
193 end
194
194
195
195
196 map.with_options :controller => 'issue_categories' do |categories|
196 map.with_options :controller => 'issue_categories' do |categories|
197 categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
197 categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
198 end
198 end
199
199
200 map.with_options :controller => 'repositories' do |repositories|
200 map.with_options :controller => 'repositories' do |repositories|
201 repositories.with_options :conditions => {:method => :get} do |repository_views|
201 repositories.with_options :conditions => {:method => :get} do |repository_views|
202 repository_views.connect 'projects/:id/repository', :action => 'show'
202 repository_views.connect 'projects/:id/repository', :action => 'show'
203 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
203 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
204 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
204 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
205 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
205 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
206 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
206 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
207 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
207 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
208 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
208 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
209 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
209 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
210 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
210 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
211 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
211 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
212 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
212 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
213 # TODO: why the following route is required?
213 # TODO: why the following route is required?
214 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
214 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
215 repository_views.connect 'projects/:id/repository/:action/*path'
215 repository_views.connect 'projects/:id/repository/:action/*path'
216 end
216 end
217
217
218 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
218 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
219 end
219 end
220
220
221 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
221 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
222 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
222 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
223 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
223 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
224
224
225 map.resources :groups
225 map.resources :groups
226
226
227 #left old routes at the bottom for backwards compat
227 #left old routes at the bottom for backwards compat
228 map.connect 'projects/:project_id/queries/:action', :controller => 'queries'
228 map.connect 'projects/:project_id/queries/:action', :controller => 'queries'
229 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
229 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
230 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
230 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
231 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
231 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
232 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
232 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
233 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
233 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
234 map.connect 'projects/:project_id/news/:action', :controller => 'news'
234 map.connect 'projects/:project_id/news/:action', :controller => 'news'
235 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
235 map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
236 map.with_options :controller => 'repositories' do |omap|
236 map.with_options :controller => 'repositories' do |omap|
237 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
237 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
238 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
238 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
239 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
239 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
240 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
240 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
241 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
241 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
242 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
242 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
243 end
243 end
244
244
245 map.with_options :controller => 'sys' do |sys|
245 map.with_options :controller => 'sys' do |sys|
246 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
246 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
247 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
247 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
248 end
248 end
249
249
250 # Install the default route as the lowest priority.
250 # Install the default route as the lowest priority.
251 map.connect ':controller/:action/:id'
251 map.connect ':controller/:action/:id'
252 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
252 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
253 # Used for OpenID
253 # Used for OpenID
254 map.root :controller => 'account', :action => 'login'
254 map.root :controller => 'account', :action => 'login'
255 end
255 end
@@ -1,119 +1,116
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 require 'issue_relations_controller'
19 require 'issue_relations_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class IssueRelationsController; def rescue_action(e) raise e end; end
22 class IssueRelationsController; def rescue_action(e) raise e end; end
23
23
24
24
25 class IssueRelationsControllerTest < ActionController::TestCase
25 class IssueRelationsControllerTest < ActionController::TestCase
26 fixtures :projects,
26 fixtures :projects,
27 :users,
27 :users,
28 :roles,
28 :roles,
29 :members,
29 :members,
30 :member_roles,
30 :member_roles,
31 :issues,
31 :issues,
32 :issue_statuses,
32 :issue_statuses,
33 :issue_relations,
33 :issue_relations,
34 :enabled_modules,
34 :enabled_modules,
35 :enumerations,
35 :enumerations,
36 :trackers
36 :trackers
37
37
38 def setup
38 def setup
39 @controller = IssueRelationsController.new
39 @controller = IssueRelationsController.new
40 @request = ActionController::TestRequest.new
40 @request = ActionController::TestRequest.new
41 @response = ActionController::TestResponse.new
41 @response = ActionController::TestResponse.new
42 User.current = nil
42 User.current = nil
43 end
43 end
44
44
45 def test_create
45 def test_create
46 assert_difference 'IssueRelation.count' do
46 assert_difference 'IssueRelation.count' do
47 @request.session[:user_id] = 3
47 @request.session[:user_id] = 3
48 post :create, :issue_id => 1,
48 post :create, :issue_id => 1,
49 :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
49 :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
50 end
50 end
51 end
51 end
52
52
53 def test_create_xhr
53 def test_create_xhr
54 assert_difference 'IssueRelation.count' do
54 assert_difference 'IssueRelation.count' do
55 @request.session[:user_id] = 3
55 @request.session[:user_id] = 3
56 xhr :post, :create,
56 xhr :post, :create,
57 :issue_id => 3,
57 :issue_id => 3,
58 :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
58 :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
59 assert_select_rjs 'relations' do
59 assert_select_rjs 'relations' do
60 assert_select 'table', 1
60 assert_select 'table', 1
61 assert_select 'tr', 2 # relations
61 assert_select 'tr', 2 # relations
62 end
62 end
63 end
63 end
64 end
64 end
65
65
66 def test_create_should_accept_id_with_hash
66 def test_create_should_accept_id_with_hash
67 assert_difference 'IssueRelation.count' do
67 assert_difference 'IssueRelation.count' do
68 @request.session[:user_id] = 3
68 @request.session[:user_id] = 3
69 post :create, :issue_id => 1,
69 post :create, :issue_id => 1,
70 :relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
70 :relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
71 end
71 end
72 end
72 end
73
73
74 def test_create_should_not_break_with_non_numerical_id
74 def test_create_should_not_break_with_non_numerical_id
75 assert_no_difference 'IssueRelation.count' do
75 assert_no_difference 'IssueRelation.count' do
76 assert_nothing_raised do
76 assert_nothing_raised do
77 @request.session[:user_id] = 3
77 @request.session[:user_id] = 3
78 post :create, :issue_id => 1,
78 post :create, :issue_id => 1,
79 :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
79 :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
80 end
80 end
81 end
81 end
82 end
82 end
83
83
84 def test_should_create_relations_with_visible_issues_only
84 def test_should_create_relations_with_visible_issues_only
85 Setting.cross_project_issue_relations = '1'
85 Setting.cross_project_issue_relations = '1'
86 assert_nil Issue.visible(User.find(3)).find_by_id(4)
86 assert_nil Issue.visible(User.find(3)).find_by_id(4)
87
87
88 assert_no_difference 'IssueRelation.count' do
88 assert_no_difference 'IssueRelation.count' do
89 @request.session[:user_id] = 3
89 @request.session[:user_id] = 3
90 post :create, :issue_id => 1,
90 post :create, :issue_id => 1,
91 :relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''}
91 :relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''}
92 end
92 end
93 end
93 end
94
94
95 should "prevent relation creation when there's a circular dependency"
95 should "prevent relation creation when there's a circular dependency"
96
96
97 def test_destroy
97 def test_destroy
98 assert_difference 'IssueRelation.count', -1 do
98 assert_difference 'IssueRelation.count', -1 do
99 @request.session[:user_id] = 3
99 @request.session[:user_id] = 3
100 delete :destroy, :id => '2', :issue_id => '3'
100 delete :destroy, :id => '2'
101 end
101 end
102 end
102 end
103
103
104 def test_destroy_xhr
104 def test_destroy_xhr
105 IssueRelation.create!(:relation_type => IssueRelation::TYPE_RELATES) do |r|
105 IssueRelation.create!(:relation_type => IssueRelation::TYPE_RELATES) do |r|
106 r.issue_from_id = 3
106 r.issue_from_id = 3
107 r.issue_to_id = 1
107 r.issue_to_id = 1
108 end
108 end
109
109
110 assert_difference 'IssueRelation.count', -1 do
110 assert_difference 'IssueRelation.count', -1 do
111 @request.session[:user_id] = 3
111 @request.session[:user_id] = 3
112 xhr :delete, :destroy, :id => '2', :issue_id => '3'
112 xhr :delete, :destroy, :id => '2'
113 assert_select_rjs 'relations' do
113 assert_select_rjs :remove, 'relation-2'
114 assert_select 'table', 1
115 assert_select 'tr', 1 # relation left
116 end
117 end
114 end
118 end
115 end
119 end
116 end
@@ -1,102 +1,102
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 ApiTest::IssueRelationsTest < ActionController::IntegrationTest
20 class ApiTest::IssueRelationsTest < ActionController::IntegrationTest
21 fixtures :all
21 fixtures :all
22
22
23 def setup
23 def setup
24 Setting.rest_api_enabled = '1'
24 Setting.rest_api_enabled = '1'
25 end
25 end
26
26
27 context "/issues/:issue_id/relations" do
27 context "/issues/:issue_id/relations" do
28 context "GET" do
28 context "GET" do
29 should "return issue relations" do
29 should "return issue relations" do
30 get '/issues/9/relations.xml', {}, :authorization => credentials('jsmith')
30 get '/issues/9/relations.xml', {}, :authorization => credentials('jsmith')
31
31
32 assert_response :success
32 assert_response :success
33 assert_equal 'application/xml', @response.content_type
33 assert_equal 'application/xml', @response.content_type
34
34
35 assert_tag :tag => 'relations',
35 assert_tag :tag => 'relations',
36 :attributes => { :type => 'array' },
36 :attributes => { :type => 'array' },
37 :child => {
37 :child => {
38 :tag => 'relation',
38 :tag => 'relation',
39 :child => {
39 :child => {
40 :tag => 'id',
40 :tag => 'id',
41 :content => '1'
41 :content => '1'
42 }
42 }
43 }
43 }
44 end
44 end
45 end
45 end
46
46
47 context "POST" do
47 context "POST" do
48 should "create a relation" do
48 should "create a relation" do
49 assert_difference('IssueRelation.count') do
49 assert_difference('IssueRelation.count') do
50 post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, :authorization => credentials('jsmith')
50 post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, :authorization => credentials('jsmith')
51 end
51 end
52
52
53 relation = IssueRelation.first(:order => 'id DESC')
53 relation = IssueRelation.first(:order => 'id DESC')
54 assert_equal 2, relation.issue_from_id
54 assert_equal 2, relation.issue_from_id
55 assert_equal 7, relation.issue_to_id
55 assert_equal 7, relation.issue_to_id
56 assert_equal 'relates', relation.relation_type
56 assert_equal 'relates', relation.relation_type
57
57
58 assert_response :created
58 assert_response :created
59 assert_equal 'application/xml', @response.content_type
59 assert_equal 'application/xml', @response.content_type
60 assert_tag 'relation', :child => {:tag => 'id', :content => relation.id.to_s}
60 assert_tag 'relation', :child => {:tag => 'id', :content => relation.id.to_s}
61 end
61 end
62
62
63 context "with failure" do
63 context "with failure" do
64 should "return the errors" do
64 should "return the errors" do
65 assert_no_difference('IssueRelation.count') do
65 assert_no_difference('IssueRelation.count') do
66 post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'foo'}}, :authorization => credentials('jsmith')
66 post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'foo'}}, :authorization => credentials('jsmith')
67 end
67 end
68
68
69 assert_response :unprocessable_entity
69 assert_response :unprocessable_entity
70 assert_tag :errors, :child => {:tag => 'error', :content => 'relation_type is not included in the list'}
70 assert_tag :errors, :child => {:tag => 'error', :content => 'relation_type is not included in the list'}
71 end
71 end
72 end
72 end
73 end
73 end
74 end
74 end
75
75
76 context "/issues/:issue_id/relations/:id" do
76 context "/relations/:id" do
77 context "GET" do
77 context "GET" do
78 should "return the relation" do
78 should "return the relation" do
79 get '/issues/3/relations/2.xml', {}, :authorization => credentials('jsmith')
79 get '/relations/2.xml', {}, :authorization => credentials('jsmith')
80
80
81 assert_response :success
81 assert_response :success
82 assert_equal 'application/xml', @response.content_type
82 assert_equal 'application/xml', @response.content_type
83 assert_tag 'relation', :child => {:tag => 'id', :content => '2'}
83 assert_tag 'relation', :child => {:tag => 'id', :content => '2'}
84 end
84 end
85 end
85 end
86
86
87 context "DELETE" do
87 context "DELETE" do
88 should "delete the relation" do
88 should "delete the relation" do
89 assert_difference('IssueRelation.count', -1) do
89 assert_difference('IssueRelation.count', -1) do
90 delete '/issues/3/relations/2.xml', {}, :authorization => credentials('jsmith')
90 delete '/relations/2.xml', {}, :authorization => credentials('jsmith')
91 end
91 end
92
92
93 assert_response :ok
93 assert_response :ok
94 assert_nil IssueRelation.find_by_id(2)
94 assert_nil IssueRelation.find_by_id(2)
95 end
95 end
96 end
96 end
97 end
97 end
98
98
99 def credentials(user, password=nil)
99 def credentials(user, password=nil)
100 ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)
100 ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)
101 end
101 end
102 end
102 end
@@ -1,392 +1,392
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/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
28 should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
29 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
29 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
30 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
30 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
31 end
31 end
32
32
33 context "boards" do
33 context "boards" do
34 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
34 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
35 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
35 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
36 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
36 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
37 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
37 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
38 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
38 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
39
39
40 should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
40 should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
41 should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
41 should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
42 should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
42 should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
43
43
44 end
44 end
45
45
46 context "documents" do
46 context "documents" do
47 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
47 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
48 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
48 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
49 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
49 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
50 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
50 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
51
51
52 should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
52 should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
53 should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567'
53 should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567'
54 should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567'
54 should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567'
55 end
55 end
56
56
57 context "issues" do
57 context "issues" do
58 # REST actions
58 # REST actions
59 should_route :get, "/issues", :controller => 'issues', :action => 'index'
59 should_route :get, "/issues", :controller => 'issues', :action => 'index'
60 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
60 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
61 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
61 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
62 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
62 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
63 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
63 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
64 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
64 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
65 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
65 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
66 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
66 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
67 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
67 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
68 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
68 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
69 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
69 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
70 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
70 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
71
71
72 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
72 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
73 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
73 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
74 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
74 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
75
75
76 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
76 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
77 # TODO: Should use PUT
77 # TODO: Should use PUT
78 should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
78 should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
79 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
79 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
80
80
81 # TODO: Should use DELETE
81 # TODO: Should use DELETE
82 should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64'
82 should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64'
83 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
83 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
84
84
85 # Extra actions
85 # Extra actions
86 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
86 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
87
87
88 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
88 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
89 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
89 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
90
90
91 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
91 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
92
92
93 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
93 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
94 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
94 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
95
95
96 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
96 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
97 should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf'
97 should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf'
98 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
98 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
99 should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf'
99 should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf'
100
100
101 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
101 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
102
102
103 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
103 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
104 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
104 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
105 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
105 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
106 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
106 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
107
107
108 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
108 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
109
109
110 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
110 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
111 should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update'
111 should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update'
112 end
112 end
113
113
114 context "issue categories" do
114 context "issue categories" do
115 should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
115 should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
116
116
117 should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
117 should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
118 end
118 end
119
119
120 context "issue relations" do
120 context "issue relations" do
121 should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1'
121 should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1'
122 should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml'
122 should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml'
123 should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json'
123 should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json'
124
124
125 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1'
125 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1'
126 should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml'
126 should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml'
127 should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json'
127 should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json'
128
128
129 should_route :get, "/issues/1/relations/23", :controller => 'issue_relations', :action => 'show', :issue_id => '1', :id => '23'
129 should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23'
130 should_route :get, "/issues/1/relations/23.xml", :controller => 'issue_relations', :action => 'show', :issue_id => '1', :id => '23', :format => 'xml'
130 should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml'
131 should_route :get, "/issues/1/relations/23.json", :controller => 'issue_relations', :action => 'show', :issue_id => '1', :id => '23', :format => 'json'
131 should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json'
132
132
133 should_route :delete, "/issues/1/relations/23", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23'
133 should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23'
134 should_route :delete, "/issues/1/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23', :format => 'xml'
134 should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml'
135 should_route :delete, "/issues/1/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23', :format => 'json'
135 should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json'
136 end
136 end
137
137
138 context "issue reports" do
138 context "issue reports" do
139 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
139 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
140 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
140 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
141 end
141 end
142
142
143 context "members" do
143 context "members" do
144 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
144 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
145 end
145 end
146
146
147 context "messages" do
147 context "messages" do
148 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
148 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
149 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
149 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
150 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
150 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
151
151
152 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
152 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
153 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
153 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
154 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
154 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
155 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
155 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
156 end
156 end
157
157
158 context "news" do
158 context "news" do
159 should_route :get, "/news", :controller => 'news', :action => 'index'
159 should_route :get, "/news", :controller => 'news', :action => 'index'
160 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
160 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
161 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
161 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
162 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
162 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
163 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
163 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
164 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
164 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
165 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
165 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
166 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
166 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
167 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
167 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
168 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
168 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
169 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
169 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
170 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
170 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
171 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
171 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
172
172
173 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
173 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
174 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
174 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
175
175
176 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
176 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
177
177
178 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
178 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
179 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
179 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
180 end
180 end
181
181
182 context "projects" do
182 context "projects" do
183 should_route :get, "/projects", :controller => 'projects', :action => 'index'
183 should_route :get, "/projects", :controller => 'projects', :action => 'index'
184 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
184 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
185 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
185 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
186 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
186 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
187 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
187 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
188 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
188 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
189 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
189 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
190 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
190 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
191 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
191 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
192 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
192 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
193 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
193 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
194 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
194 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
195 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
195 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
196
196
197 should_route :post, "/projects", :controller => 'projects', :action => 'create'
197 should_route :post, "/projects", :controller => 'projects', :action => 'create'
198 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
198 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
199 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
199 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
200 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
200 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
201 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
201 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
202
202
203 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
203 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
204 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
204 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
205 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
205 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
206
206
207 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
207 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
208 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
208 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
209 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
209 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
210 end
210 end
211
211
212 context "queries" do
212 context "queries" do
213 should_route :get, "/queries/new", :controller => 'queries', :action => 'new'
213 should_route :get, "/queries/new", :controller => 'queries', :action => 'new'
214 should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
214 should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
215
215
216 should_route :post, "/queries/new", :controller => 'queries', :action => 'new'
216 should_route :post, "/queries/new", :controller => 'queries', :action => 'new'
217 should_route :post, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
217 should_route :post, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
218 end
218 end
219
219
220 context "repositories" do
220 context "repositories" do
221 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
221 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
222 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
222 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
223 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
223 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
224 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
224 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
225 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
225 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
226 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
226 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
227 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
227 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
228 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
228 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
229 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'
229 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'
230 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
230 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
231 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
231 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
232 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'
232 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'
233 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'
233 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'
234 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'
234 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'
235 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
235 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
236 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
236 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
237 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
237 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
238
238
239
239
240 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
240 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
241 end
241 end
242
242
243 context "timelogs (global)" do
243 context "timelogs (global)" do
244 should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
244 should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
245 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
245 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
246 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
246 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
247 should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
247 should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
248 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
248 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
249
249
250 should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
250 should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
251
251
252 should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
252 should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
253
253
254 should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
254 should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
255 end
255 end
256
256
257 context "timelogs (scoped under project)" do
257 context "timelogs (scoped under project)" do
258 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
258 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
259 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
259 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
260 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
260 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
261 should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
261 should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
262 should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
262 should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
263
263
264 should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
264 should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
265
265
266 should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
266 should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
267
267
268 should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
268 should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
269 end
269 end
270
270
271 context "timelogs (scoped under issues)" do
271 context "timelogs (scoped under issues)" do
272 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
272 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
273 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
273 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
274 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
274 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
275 should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
275 should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
276 should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
276 should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
277
277
278 should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
278 should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
279
279
280 should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
280 should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
281
281
282 should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
282 should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
283 end
283 end
284
284
285 context "timelogs (scoped under project and issues)" do
285 context "timelogs (scoped under project and issues)" do
286 should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
286 should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
287 should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
287 should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
288 should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
288 should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
289 should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
289 should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
290 should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
290 should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
291
291
292 should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
292 should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
293
293
294 should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
294 should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
295
295
296 should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
296 should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
297 end
297 end
298
298
299 context "time_entry_reports" do
299 context "time_entry_reports" do
300 should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report'
300 should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report'
301 should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567'
301 should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567'
302 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv'
302 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv'
303 end
303 end
304
304
305 context "users" do
305 context "users" do
306 should_route :get, "/users", :controller => 'users', :action => 'index'
306 should_route :get, "/users", :controller => 'users', :action => 'index'
307 should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
307 should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
308 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
308 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
309 should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
309 should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
310 should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
310 should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
311 should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
311 should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
312 should_route :get, "/users/new", :controller => 'users', :action => 'new'
312 should_route :get, "/users/new", :controller => 'users', :action => 'new'
313 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
313 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
314 should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
314 should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
315
315
316 should_route :post, "/users", :controller => 'users', :action => 'create'
316 should_route :post, "/users", :controller => 'users', :action => 'create'
317 should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
317 should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
318 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
318 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
319 should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
319 should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
320 should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
320 should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
321
321
322 should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
322 should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
323 should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
323 should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
324
324
325 should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
325 should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
326 should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
326 should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
327 end
327 end
328
328
329 context "versions" do
329 context "versions" do
330 # /projects/foo/versions is /projects/foo/roadmap
330 # /projects/foo/versions is /projects/foo/roadmap
331 should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
331 should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
332 should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
332 should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
333
333
334 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
334 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
335
335
336 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
336 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
337 should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
337 should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
338 should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
338 should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
339
339
340 should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
340 should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
341 should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
341 should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
342 should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
342 should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
343
343
344 should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
344 should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
345
345
346 should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
346 should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
347 should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
347 should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
348 should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
348 should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
349
349
350 should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
350 should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
351 should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
351 should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
352 should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
352 should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
353
353
354 should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
354 should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
355 should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
355 should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
356 end
356 end
357
357
358 context "wiki (singular, project's pages)" do
358 context "wiki (singular, project's pages)" do
359 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
359 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
360 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
360 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
361 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
361 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
362 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
362 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
363 should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
363 should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
364 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
364 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
365 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'
365 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'
366 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
366 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
367 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
367 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
368 should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
368 should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
369 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
369 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
370 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
370 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
371
371
372 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
372 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
373 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
373 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
374 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
374 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
375 should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
375 should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
376
376
377 should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
377 should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
378
378
379 should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
379 should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
380 end
380 end
381
381
382 context "wikis (plural, admin setup)" do
382 context "wikis (plural, admin setup)" do
383 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
383 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
384
384
385 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
385 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
386 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
386 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
387 end
387 end
388
388
389 context "administration panel" do
389 context "administration panel" do
390 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
390 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
391 end
391 end
392 end
392 end
General Comments 0
You need to be logged in to leave comments. Login now