@@ -0,0 +1,11 | |||
|
1 | api.array :relations do | |
|
2 | @relations.each do |relation| | |
|
3 | api.relation do | |
|
4 | api.id relation.id | |
|
5 | api.issue_id relation.issue_from_id | |
|
6 | api.issue_to_id relation.issue_to_id | |
|
7 | api.relation_type relation.relation_type | |
|
8 | api.delay relation.delay | |
|
9 | end | |
|
10 | end | |
|
11 | end |
@@ -1,87 +1,96 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | class IssueRelationsController < ApplicationController |
|
19 | 19 | before_filter :find_issue, :find_project_from_association, :authorize |
|
20 | accept_key_auth :show, :create, :destroy | |
|
20 | accept_key_auth :index, :show, :create, :destroy | |
|
21 | ||
|
22 | def index | |
|
23 | @relations = @issue.relations | |
|
24 | ||
|
25 | respond_to do |format| | |
|
26 | format.html { render :nothing => true } | |
|
27 | format.api | |
|
28 | end | |
|
29 | end | |
|
21 | 30 | |
|
22 | 31 | def show |
|
23 | 32 | @relation = @issue.find_relation(params[:id]) |
|
24 | 33 | |
|
25 | 34 | respond_to do |format| |
|
26 | 35 | format.html { render :nothing => true } |
|
27 | 36 | format.api |
|
28 | 37 | end |
|
29 | 38 | rescue ActiveRecord::RecordNotFound |
|
30 | 39 | render_404 |
|
31 | 40 | end |
|
32 | 41 | |
|
33 | 42 | verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } |
|
34 | 43 | def create |
|
35 | 44 | @relation = IssueRelation.new(params[:relation]) |
|
36 | 45 | @relation.issue_from = @issue |
|
37 | 46 | if params[:relation] && m = params[:relation][:issue_to_id].to_s.match(/^#?(\d+)$/) |
|
38 | 47 | @relation.issue_to = Issue.visible.find_by_id(m[1].to_i) |
|
39 | 48 | end |
|
40 | 49 | saved = @relation.save |
|
41 | 50 | |
|
42 | 51 | respond_to do |format| |
|
43 | 52 | format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue } |
|
44 | 53 | format.js do |
|
45 | 54 | @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } |
|
46 | 55 | render :update do |page| |
|
47 | 56 | page.replace_html "relations", :partial => 'issues/relations' |
|
48 | 57 | if @relation.errors.empty? |
|
49 | 58 | page << "$('relation_delay').value = ''" |
|
50 | 59 | page << "$('relation_issue_to_id').value = ''" |
|
51 | 60 | end |
|
52 | 61 | end |
|
53 | 62 | end |
|
54 | 63 | format.api { |
|
55 | 64 | if saved |
|
56 | 65 | render :action => 'show', :status => :created, :location => issue_relation_url(@issue, @relation) |
|
57 | 66 | else |
|
58 | 67 | render_validation_errors(@relation) |
|
59 | 68 | end |
|
60 | 69 | } |
|
61 | 70 | end |
|
62 | 71 | end |
|
63 | 72 | |
|
64 | 73 | verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed } |
|
65 | 74 | def destroy |
|
66 | 75 | relation = @issue.find_relation(params[:id]) |
|
67 | 76 | relation.destroy |
|
68 | 77 | |
|
69 | 78 | respond_to do |format| |
|
70 | 79 | format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue } |
|
71 | 80 | format.js { |
|
72 | 81 | @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } |
|
73 | 82 | render(:update) {|page| page.replace_html "relations", :partial => 'issues/relations'} |
|
74 | 83 | } |
|
75 | 84 | format.api { head :ok } |
|
76 | 85 | end |
|
77 | 86 | rescue ActiveRecord::RecordNotFound |
|
78 | 87 | render_404 |
|
79 | 88 | end |
|
80 | 89 | |
|
81 | 90 | private |
|
82 | 91 | def find_issue |
|
83 | 92 | @issue = @object = Issue.find(params[:issue_id]) |
|
84 | 93 | rescue ActiveRecord::RecordNotFound |
|
85 | 94 | render_404 |
|
86 | 95 | end |
|
87 | 96 | end |
@@ -1,61 +1,61 | |||
|
1 | 1 | api.issue do |
|
2 | 2 | api.id @issue.id |
|
3 | 3 | api.project(:id => @issue.project_id, :name => @issue.project.name) unless @issue.project.nil? |
|
4 | 4 | api.tracker(:id => @issue.tracker_id, :name => @issue.tracker.name) unless @issue.tracker.nil? |
|
5 | 5 | api.status(:id => @issue.status_id, :name => @issue.status.name) unless @issue.status.nil? |
|
6 | 6 | api.priority(:id => @issue.priority_id, :name => @issue.priority.name) unless @issue.priority.nil? |
|
7 | 7 | api.author(:id => @issue.author_id, :name => @issue.author.name) unless @issue.author.nil? |
|
8 | 8 | api.assigned_to(:id => @issue.assigned_to_id, :name => @issue.assigned_to.name) unless @issue.assigned_to.nil? |
|
9 | 9 | api.category(:id => @issue.category_id, :name => @issue.category.name) unless @issue.category.nil? |
|
10 | 10 | api.fixed_version(:id => @issue.fixed_version_id, :name => @issue.fixed_version.name) unless @issue.fixed_version.nil? |
|
11 | 11 | api.parent(:id => @issue.parent_id) unless @issue.parent.nil? |
|
12 | 12 | |
|
13 | 13 | api.subject @issue.subject |
|
14 | 14 | api.description @issue.description |
|
15 | 15 | api.start_date @issue.start_date |
|
16 | 16 | api.due_date @issue.due_date |
|
17 | 17 | api.done_ratio @issue.done_ratio |
|
18 | 18 | api.estimated_hours @issue.estimated_hours |
|
19 | 19 | api.spent_hours(@issue.spent_hours) if User.current.allowed_to?(:view_time_entries, @project) |
|
20 | 20 | |
|
21 | 21 | render_api_custom_values @issue.custom_field_values, api |
|
22 | 22 | |
|
23 | 23 | api.created_on @issue.created_on |
|
24 | 24 | api.updated_on @issue.updated_on |
|
25 | 25 | |
|
26 | 26 | render_api_issue_children(@issue, api) if include_in_api_response?('children') |
|
27 | 27 | |
|
28 | 28 | api.array :relations do |
|
29 | 29 | @relations.each do |relation| |
|
30 |
api.relation(:id => relation.id, :issue_id => relation.issue_from_id, :issue_to_id => relation.issue_to_id, :relation_type => relation.relation_type |
|
|
30 | api.relation(:id => relation.id, :issue_id => relation.issue_from_id, :issue_to_id => relation.issue_to_id, :relation_type => relation.relation_type, :delay => relation.delay) | |
|
31 | 31 | end |
|
32 | 32 | end if include_in_api_response?('relations') && @relations.present? |
|
33 | 33 | |
|
34 | 34 | api.array :changesets do |
|
35 | 35 | @issue.changesets.each do |changeset| |
|
36 | 36 | api.changeset :revision => changeset.revision do |
|
37 | 37 | api.user(:id => changeset.user_id, :name => changeset.user.name) unless changeset.user.nil? |
|
38 | 38 | api.comments changeset.comments |
|
39 | 39 | api.committed_on changeset.committed_on |
|
40 | 40 | end |
|
41 | 41 | end |
|
42 | 42 | end if include_in_api_response?('changesets') && User.current.allowed_to?(:view_changesets, @project) |
|
43 | 43 | |
|
44 | 44 | api.array :journals do |
|
45 | 45 | @issue.journals.each do |journal| |
|
46 | 46 | api.journal :id => journal.id do |
|
47 | 47 | api.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil? |
|
48 | 48 | api.notes journal.notes |
|
49 | 49 | api.created_on journal.created_on |
|
50 | 50 | api.array :details do |
|
51 | 51 | journal.details.each do |detail| |
|
52 | 52 | api.detail :property => detail.property, :name => detail.prop_key do |
|
53 | 53 | api.old_value detail.old_value |
|
54 | 54 | api.new_value detail.value |
|
55 | 55 | end |
|
56 | 56 | end |
|
57 | 57 | end |
|
58 | 58 | end |
|
59 | 59 | end |
|
60 | 60 | end if include_in_api_response?('journals') |
|
61 | 61 | end |
@@ -1,255 +1,255 | |||
|
1 | 1 | ActionController::Routing::Routes.draw do |map| |
|
2 | 2 | # Add your own custom routes here. |
|
3 | 3 | # The priority is based upon order of creation: first created -> highest priority. |
|
4 | 4 | |
|
5 | 5 | # Here's a sample route: |
|
6 | 6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' |
|
7 | 7 | # Keep in mind you can assign values other than :controller and :action |
|
8 | 8 | |
|
9 | 9 | map.home '', :controller => 'welcome' |
|
10 | 10 | |
|
11 | 11 | map.signin 'login', :controller => 'account', :action => 'login' |
|
12 | 12 | map.signout 'logout', :controller => 'account', :action => 'logout' |
|
13 | 13 | |
|
14 | 14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
15 | 15 | map.connect 'help/:ctrl/:page', :controller => 'help' |
|
16 | 16 | |
|
17 | 17 | map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| |
|
18 | 18 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report' |
|
19 | 19 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format' |
|
20 | 20 | time_report.connect 'projects/:project_id/time_entries/report' |
|
21 | 21 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
22 | 22 | time_report.connect 'time_entries/report' |
|
23 | 23 | time_report.connect 'time_entries/report.:format' |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | 26 | map.bulk_edit_time_entry 'time_entries/bulk_edit', |
|
27 | 27 | :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get } |
|
28 | 28 | map.bulk_update_time_entry 'time_entries/bulk_edit', |
|
29 | 29 | :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post } |
|
30 | 30 | map.time_entries_context_menu '/time_entries/context_menu', |
|
31 | 31 | :controller => 'context_menus', :action => 'time_entries' |
|
32 | 32 | # TODO: wasteful since this is also nested under issues, projects, and projects/issues |
|
33 | 33 | map.resources :time_entries, :controller => 'timelog' |
|
34 | 34 | |
|
35 | 35 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
36 | 36 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
37 | 37 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} |
|
38 | 38 | |
|
39 | 39 | map.with_options :controller => 'messages' do |messages_routes| |
|
40 | 40 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
41 | 41 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
42 | 42 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
43 | 43 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
44 | 44 | end |
|
45 | 45 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
46 | 46 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
47 | 47 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
48 | 48 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ |
|
49 | 49 | end |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | map.with_options :controller => 'boards' do |board_routes| |
|
53 | 53 | board_routes.with_options :conditions => {:method => :get} do |board_views| |
|
54 | 54 | board_views.connect 'projects/:project_id/boards', :action => 'index' |
|
55 | 55 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' |
|
56 | 56 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' |
|
57 | 57 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' |
|
58 | 58 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' |
|
59 | 59 | end |
|
60 | 60 | board_routes.with_options :conditions => {:method => :post} do |board_actions| |
|
61 | 61 | board_actions.connect 'projects/:project_id/boards', :action => 'new' |
|
62 | 62 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ |
|
63 | 63 | end |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | map.with_options :controller => 'documents' do |document_routes| |
|
67 | 67 | document_routes.with_options :conditions => {:method => :get} do |document_views| |
|
68 | 68 | document_views.connect 'projects/:project_id/documents', :action => 'index' |
|
69 | 69 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' |
|
70 | 70 | document_views.connect 'documents/:id', :action => 'show' |
|
71 | 71 | document_views.connect 'documents/:id/edit', :action => 'edit' |
|
72 | 72 | end |
|
73 | 73 | document_routes.with_options :conditions => {:method => :post} do |document_actions| |
|
74 | 74 | document_actions.connect 'projects/:project_id/documents', :action => 'new' |
|
75 | 75 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ |
|
76 | 76 | end |
|
77 | 77 | end |
|
78 | 78 | |
|
79 | 79 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' |
|
80 | 80 | |
|
81 | 81 | # Misc issue routes. TODO: move into resources |
|
82 | 82 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' |
|
83 | 83 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview |
|
84 | 84 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' |
|
85 | 85 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' |
|
86 | 86 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } |
|
87 | 87 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } |
|
88 | 88 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } |
|
89 | 89 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy |
|
90 | 90 | |
|
91 | 91 | map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes| |
|
92 | 92 | gantts_routes.connect '/projects/:project_id/issues/gantt' |
|
93 | 93 | gantts_routes.connect '/projects/:project_id/issues/gantt.:format' |
|
94 | 94 | gantts_routes.connect '/issues/gantt.:format' |
|
95 | 95 | end |
|
96 | 96 | |
|
97 | 97 | map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes| |
|
98 | 98 | calendars_routes.connect '/projects/:project_id/issues/calendar' |
|
99 | 99 | calendars_routes.connect '/issues/calendar' |
|
100 | 100 | end |
|
101 | 101 | |
|
102 | 102 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| |
|
103 | 103 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' |
|
104 | 104 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' |
|
105 | 105 | end |
|
106 | 106 | |
|
107 | 107 | # Following two routes conflict with the resources because #index allows POST |
|
108 | 108 | map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
109 | 109 | map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
110 | 110 | |
|
111 | 111 | map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues| |
|
112 | 112 | issues.resources :time_entries, :controller => 'timelog' |
|
113 | issues.resources :relations, :controller => 'issue_relations', :only => [:show, :create, :destroy] | |
|
113 | issues.resources :relations, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] | |
|
114 | 114 | end |
|
115 | 115 | |
|
116 | 116 | map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues| |
|
117 | 117 | issues.resources :time_entries, :controller => 'timelog' |
|
118 | 118 | end |
|
119 | 119 | |
|
120 | 120 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
121 | 121 | |
|
122 | 122 | map.with_options :controller => 'users' do |users| |
|
123 | 123 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} |
|
124 | 124 | |
|
125 | 125 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
126 | 126 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
127 | 127 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
128 | 128 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
129 | 129 | end |
|
130 | 130 | end |
|
131 | 131 | |
|
132 | 132 | map.resources :users, :member => { |
|
133 | 133 | :edit_membership => :post, |
|
134 | 134 | :destroy_membership => :post |
|
135 | 135 | } |
|
136 | 136 | |
|
137 | 137 | # For nice "roadmap" in the url for the index action |
|
138 | 138 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' |
|
139 | 139 | |
|
140 | 140 | map.all_news 'news', :controller => 'news', :action => 'index' |
|
141 | 141 | map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' |
|
142 | 142 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' |
|
143 | 143 | map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} |
|
144 | 144 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} |
|
145 | 145 | |
|
146 | 146 | map.resources :projects, :member => { |
|
147 | 147 | :copy => [:get, :post], |
|
148 | 148 | :settings => :get, |
|
149 | 149 | :modules => :post, |
|
150 | 150 | :archive => :post, |
|
151 | 151 | :unarchive => :post |
|
152 | 152 | } do |project| |
|
153 | 153 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] |
|
154 | 154 | project.resources :files, :only => [:index, :new, :create] |
|
155 | 155 | project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post} |
|
156 | 156 | project.resources :news, :shallow => true |
|
157 | 157 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' |
|
158 | 158 | |
|
159 | 159 | project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get} |
|
160 | 160 | project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get} |
|
161 | 161 | project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil |
|
162 | 162 | project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' |
|
163 | 163 | project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' |
|
164 | 164 | project.resources :wiki, :except => [:new, :create], :member => { |
|
165 | 165 | :rename => [:get, :post], |
|
166 | 166 | :history => :get, |
|
167 | 167 | :preview => :any, |
|
168 | 168 | :protect => :post, |
|
169 | 169 | :add_attachment => :post |
|
170 | 170 | }, :collection => { |
|
171 | 171 | :export => :get, |
|
172 | 172 | :date_index => :get |
|
173 | 173 | } |
|
174 | 174 | |
|
175 | 175 | end |
|
176 | 176 | |
|
177 | 177 | # Destroy uses a get request to prompt the user before the actual DELETE request |
|
178 | 178 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} |
|
179 | 179 | |
|
180 | 180 | # TODO: port to be part of the resources route(s) |
|
181 | 181 | map.with_options :controller => 'projects' do |project_mapper| |
|
182 | 182 | project_mapper.with_options :conditions => {:method => :get} do |project_views| |
|
183 | 183 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' |
|
184 | 184 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' |
|
185 | 185 | end |
|
186 | 186 | end |
|
187 | 187 | |
|
188 | 188 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| |
|
189 | 189 | activity.connect 'projects/:id/activity' |
|
190 | 190 | activity.connect 'projects/:id/activity.:format' |
|
191 | 191 | activity.connect 'activity', :id => nil |
|
192 | 192 | activity.connect 'activity.:format', :id => nil |
|
193 | 193 | end |
|
194 | 194 | |
|
195 | 195 | |
|
196 | 196 | map.with_options :controller => 'issue_categories' do |categories| |
|
197 | 197 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' |
|
198 | 198 | end |
|
199 | 199 | |
|
200 | 200 | map.with_options :controller => 'repositories' do |repositories| |
|
201 | 201 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
202 | 202 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
203 | 203 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
204 | 204 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
205 | 205 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
206 | 206 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
207 | 207 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
208 | 208 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
209 | 209 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
210 | 210 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
211 | 211 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
212 | 212 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' |
|
213 | 213 | # TODO: why the following route is required? |
|
214 | 214 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' |
|
215 | 215 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
216 | 216 | end |
|
217 | 217 | |
|
218 | 218 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
219 | 219 | end |
|
220 | 220 | |
|
221 | 221 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ |
|
222 | 222 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
223 | 223 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
224 | 224 | |
|
225 | 225 | map.resources :groups |
|
226 | 226 | |
|
227 | 227 | #left old routes at the bottom for backwards compat |
|
228 | 228 | map.connect 'projects/:project_id/queries/:action', :controller => 'queries' |
|
229 | 229 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' |
|
230 | 230 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' |
|
231 | 231 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' |
|
232 | 232 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
233 | 233 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
234 | 234 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
235 | 235 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
236 | 236 | map.with_options :controller => 'repositories' do |omap| |
|
237 | 237 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
238 | 238 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
239 | 239 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
240 | 240 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
241 | 241 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
242 | 242 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
243 | 243 | end |
|
244 | 244 | |
|
245 | 245 | map.with_options :controller => 'sys' do |sys| |
|
246 | 246 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
247 | 247 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
248 | 248 | end |
|
249 | 249 | |
|
250 | 250 | # Install the default route as the lowest priority. |
|
251 | 251 | map.connect ':controller/:action/:id' |
|
252 | 252 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
253 | 253 | # Used for OpenID |
|
254 | 254 | map.root :controller => 'account', :action => 'login' |
|
255 | 255 | end |
@@ -1,237 +1,237 | |||
|
1 | 1 | require 'redmine/access_control' |
|
2 | 2 | require 'redmine/menu_manager' |
|
3 | 3 | require 'redmine/activity' |
|
4 | 4 | require 'redmine/search' |
|
5 | 5 | require 'redmine/custom_field_format' |
|
6 | 6 | require 'redmine/mime_type' |
|
7 | 7 | require 'redmine/core_ext' |
|
8 | 8 | require 'redmine/themes' |
|
9 | 9 | require 'redmine/hook' |
|
10 | 10 | require 'redmine/plugin' |
|
11 | 11 | require 'redmine/notifiable' |
|
12 | 12 | require 'redmine/wiki_formatting' |
|
13 | 13 | require 'redmine/scm/base' |
|
14 | 14 | |
|
15 | 15 | begin |
|
16 | 16 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) |
|
17 | 17 | rescue LoadError |
|
18 | 18 | # RMagick is not available |
|
19 | 19 | end |
|
20 | 20 | |
|
21 | 21 | if RUBY_VERSION < '1.9' |
|
22 | 22 | require 'faster_csv' |
|
23 | 23 | else |
|
24 | 24 | require 'csv' |
|
25 | 25 | FCSV = CSV |
|
26 | 26 | end |
|
27 | 27 | |
|
28 | 28 | Redmine::Scm::Base.add "Subversion" |
|
29 | 29 | Redmine::Scm::Base.add "Darcs" |
|
30 | 30 | Redmine::Scm::Base.add "Mercurial" |
|
31 | 31 | Redmine::Scm::Base.add "Cvs" |
|
32 | 32 | Redmine::Scm::Base.add "Bazaar" |
|
33 | 33 | Redmine::Scm::Base.add "Git" |
|
34 | 34 | Redmine::Scm::Base.add "Filesystem" |
|
35 | 35 | |
|
36 | 36 | Redmine::CustomFieldFormat.map do |fields| |
|
37 | 37 | fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1) |
|
38 | 38 | fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2) |
|
39 | 39 | fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3) |
|
40 | 40 | fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4) |
|
41 | 41 | fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5) |
|
42 | 42 | fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6) |
|
43 | 43 | fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7) |
|
44 | 44 | fields.register Redmine::CustomFieldFormat.new('user', :label => :label_user, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 8) |
|
45 | 45 | fields.register Redmine::CustomFieldFormat.new('version', :label => :label_version, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 9) |
|
46 | 46 | end |
|
47 | 47 | |
|
48 | 48 | # Permissions |
|
49 | 49 | Redmine::AccessControl.map do |map| |
|
50 | 50 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true |
|
51 | 51 | map.permission :search_project, {:search => :index}, :public => true |
|
52 | 52 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
|
53 | 53 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
54 | 54 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
55 | 55 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
56 | 56 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member |
|
57 | 57 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
58 | 58 | |
|
59 | 59 | map.project_module :issue_tracking do |map| |
|
60 | 60 | # Issue categories |
|
61 | 61 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member |
|
62 | 62 | # Issues |
|
63 | 63 | map.permission :view_issues, {:issues => [:index, :show], |
|
64 | 64 | :auto_complete => [:issues], |
|
65 | 65 | :context_menus => [:issues], |
|
66 | 66 | :versions => [:index, :show, :status_by], |
|
67 | 67 | :journals => [:index, :diff], |
|
68 | 68 | :queries => :index, |
|
69 | 69 | :reports => [:issue_report, :issue_report_details]} |
|
70 | 70 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} |
|
71 | 71 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} |
|
72 | map.permission :manage_issue_relations, {:issue_relations => [:show, :create, :destroy]} | |
|
72 | map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]} | |
|
73 | 73 | map.permission :manage_subtasks, {} |
|
74 | 74 | map.permission :set_issues_private, {} |
|
75 | 75 | map.permission :set_own_issues_private, {}, :require => :loggedin |
|
76 | 76 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} |
|
77 | 77 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin |
|
78 | 78 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin |
|
79 | 79 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin |
|
80 | 80 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
81 | 81 | # Queries |
|
82 | 82 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member |
|
83 | 83 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin |
|
84 | 84 | # Watchers |
|
85 | 85 | map.permission :view_issue_watchers, {} |
|
86 | 86 | map.permission :add_issue_watchers, {:watchers => :new} |
|
87 | 87 | map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
88 | 88 | end |
|
89 | 89 | |
|
90 | 90 | map.project_module :time_tracking do |map| |
|
91 | 91 | map.permission :log_time, {:timelog => [:new, :create, :edit, :update, :bulk_edit, :bulk_update]}, :require => :loggedin |
|
92 | 92 | map.permission :view_time_entries, :timelog => [:index, :show], :time_entry_reports => [:report] |
|
93 | 93 | map.permission :edit_time_entries, {:timelog => [:new, :create, :edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member |
|
94 | 94 | map.permission :edit_own_time_entries, {:timelog => [:new, :create, :edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin |
|
95 | 95 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member |
|
96 | 96 | end |
|
97 | 97 | |
|
98 | 98 | map.project_module :news do |map| |
|
99 | 99 | map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member |
|
100 | 100 | map.permission :view_news, {:news => [:index, :show]}, :public => true |
|
101 | 101 | map.permission :comment_news, {:comments => :create} |
|
102 | 102 | end |
|
103 | 103 | |
|
104 | 104 | map.project_module :documents do |map| |
|
105 | 105 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin |
|
106 | 106 | map.permission :view_documents, :documents => [:index, :show, :download] |
|
107 | 107 | end |
|
108 | 108 | |
|
109 | 109 | map.project_module :files do |map| |
|
110 | 110 | map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin |
|
111 | 111 | map.permission :view_files, :files => :index, :versions => :download |
|
112 | 112 | end |
|
113 | 113 | |
|
114 | 114 | map.project_module :wiki do |map| |
|
115 | 115 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
|
116 | 116 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
117 | 117 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
118 | 118 | map.permission :view_wiki_pages, :wiki => [:index, :show, :special, :date_index] |
|
119 | 119 | map.permission :export_wiki_pages, :wiki => [:export] |
|
120 | 120 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] |
|
121 | 121 | map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment] |
|
122 | 122 | map.permission :delete_wiki_pages_attachments, {} |
|
123 | 123 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
124 | 124 | end |
|
125 | 125 | |
|
126 | 126 | map.project_module :repository do |map| |
|
127 | 127 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member |
|
128 | 128 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] |
|
129 | 129 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
130 | 130 | map.permission :commit_access, {} |
|
131 | 131 | end |
|
132 | 132 | |
|
133 | 133 | map.project_module :boards do |map| |
|
134 | 134 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member |
|
135 | 135 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
136 | 136 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} |
|
137 | 137 | map.permission :edit_messages, {:messages => :edit}, :require => :member |
|
138 | 138 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin |
|
139 | 139 | map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
140 | 140 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
141 | 141 | end |
|
142 | 142 | |
|
143 | 143 | map.project_module :calendar do |map| |
|
144 | 144 | map.permission :view_calendar, :calendars => [:show, :update] |
|
145 | 145 | end |
|
146 | 146 | |
|
147 | 147 | map.project_module :gantt do |map| |
|
148 | 148 | map.permission :view_gantt, :gantts => [:show, :update] |
|
149 | 149 | end |
|
150 | 150 | end |
|
151 | 151 | |
|
152 | 152 | Redmine::MenuManager.map :top_menu do |menu| |
|
153 | 153 | menu.push :home, :home_path |
|
154 | 154 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } |
|
155 | 155 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural |
|
156 | 156 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true |
|
157 | 157 | menu.push :help, Redmine::Info.help_url, :last => true |
|
158 | 158 | end |
|
159 | 159 | |
|
160 | 160 | Redmine::MenuManager.map :account_menu do |menu| |
|
161 | 161 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } |
|
162 | 162 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } |
|
163 | 163 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } |
|
164 | 164 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } |
|
165 | 165 | end |
|
166 | 166 | |
|
167 | 167 | Redmine::MenuManager.map :application_menu do |menu| |
|
168 | 168 | # Empty |
|
169 | 169 | end |
|
170 | 170 | |
|
171 | 171 | Redmine::MenuManager.map :admin_menu do |menu| |
|
172 | 172 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural |
|
173 | 173 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural |
|
174 | 174 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural |
|
175 | 175 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions |
|
176 | 176 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural |
|
177 | 177 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, |
|
178 | 178 | :html => {:class => 'issue_statuses'} |
|
179 | 179 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow |
|
180 | 180 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, |
|
181 | 181 | :html => {:class => 'custom_fields'} |
|
182 | 182 | menu.push :enumerations, {:controller => 'enumerations'} |
|
183 | 183 | menu.push :settings, {:controller => 'settings'} |
|
184 | 184 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, |
|
185 | 185 | :html => {:class => 'server_authentication'} |
|
186 | 186 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true |
|
187 | 187 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true |
|
188 | 188 | end |
|
189 | 189 | |
|
190 | 190 | Redmine::MenuManager.map :project_menu do |menu| |
|
191 | 191 | menu.push :overview, { :controller => 'projects', :action => 'show' } |
|
192 | 192 | menu.push :activity, { :controller => 'activities', :action => 'index' } |
|
193 | 193 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, |
|
194 | 194 | :if => Proc.new { |p| p.shared_versions.any? } |
|
195 | 195 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural |
|
196 | 196 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, |
|
197 | 197 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } |
|
198 | 198 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt |
|
199 | 199 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar |
|
200 | 200 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
201 | 201 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
202 | 202 | menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id, |
|
203 | 203 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } |
|
204 | 204 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, |
|
205 | 205 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural |
|
206 | 206 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id |
|
207 | 207 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, |
|
208 | 208 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } |
|
209 | 209 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true |
|
210 | 210 | end |
|
211 | 211 | |
|
212 | 212 | Redmine::Activity.map do |activity| |
|
213 | 213 | activity.register :issues, :class_name => %w(Issue Journal) |
|
214 | 214 | activity.register :changesets |
|
215 | 215 | activity.register :news |
|
216 | 216 | activity.register :documents, :class_name => %w(Document Attachment) |
|
217 | 217 | activity.register :files, :class_name => 'Attachment' |
|
218 | 218 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false |
|
219 | 219 | activity.register :messages, :default => false |
|
220 | 220 | activity.register :time_entries, :default => false |
|
221 | 221 | end |
|
222 | 222 | |
|
223 | 223 | Redmine::Search.map do |search| |
|
224 | 224 | search.register :issues |
|
225 | 225 | search.register :news |
|
226 | 226 | search.register :documents |
|
227 | 227 | search.register :changesets |
|
228 | 228 | search.register :wiki_pages |
|
229 | 229 | search.register :messages |
|
230 | 230 | search.register :projects |
|
231 | 231 | end |
|
232 | 232 | |
|
233 | 233 | Redmine::WikiFormatting.map do |format| |
|
234 | 234 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper |
|
235 | 235 | end |
|
236 | 236 | |
|
237 | 237 | ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler |
@@ -1,83 +1,102 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class ApiTest::IssueRelationsTest < ActionController::IntegrationTest |
|
21 | 21 | fixtures :all |
|
22 | 22 | |
|
23 | 23 | def setup |
|
24 | 24 | Setting.rest_api_enabled = '1' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | context "/issues/:issue_id/relations" do |
|
28 | context "GET" do | |
|
29 | should "return issue relations" do | |
|
30 | get '/issues/9/relations.xml', {}, :authorization => credentials('jsmith') | |
|
31 | ||
|
32 | assert_response :success | |
|
33 | assert_equal 'application/xml', @response.content_type | |
|
34 | ||
|
35 | assert_tag :tag => 'relations', | |
|
36 | :attributes => { :type => 'array' }, | |
|
37 | :child => { | |
|
38 | :tag => 'relation', | |
|
39 | :child => { | |
|
40 | :tag => 'id', | |
|
41 | :content => '1' | |
|
42 | } | |
|
43 | } | |
|
44 | end | |
|
45 | end | |
|
46 | ||
|
28 | 47 | context "POST" do |
|
29 | 48 | should "create a relation" do |
|
30 | 49 | assert_difference('IssueRelation.count') do |
|
31 | 50 | post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, :authorization => credentials('jsmith') |
|
32 | 51 | end |
|
33 | 52 | |
|
34 | 53 | relation = IssueRelation.first(:order => 'id DESC') |
|
35 | 54 | assert_equal 2, relation.issue_from_id |
|
36 | 55 | assert_equal 7, relation.issue_to_id |
|
37 | 56 | assert_equal 'relates', relation.relation_type |
|
38 | 57 | |
|
39 | 58 | assert_response :created |
|
40 | 59 | assert_equal 'application/xml', @response.content_type |
|
41 | 60 | assert_tag 'relation', :child => {:tag => 'id', :content => relation.id.to_s} |
|
42 | 61 | end |
|
43 | 62 | |
|
44 | 63 | context "with failure" do |
|
45 | 64 | should "return the errors" do |
|
46 | 65 | assert_no_difference('IssueRelation.count') do |
|
47 | 66 | post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'foo'}}, :authorization => credentials('jsmith') |
|
48 | 67 | end |
|
49 | 68 | |
|
50 | 69 | assert_response :unprocessable_entity |
|
51 | 70 | assert_tag :errors, :child => {:tag => 'error', :content => 'relation_type is not included in the list'} |
|
52 | 71 | end |
|
53 | 72 | end |
|
54 | 73 | end |
|
55 | 74 | end |
|
56 | 75 | |
|
57 | 76 | context "/issues/:issue_id/relations/:id" do |
|
58 | 77 | context "GET" do |
|
59 | 78 | should "return the relation" do |
|
60 | 79 | get '/issues/3/relations/2.xml', {}, :authorization => credentials('jsmith') |
|
61 | 80 | |
|
62 | 81 | assert_response :success |
|
63 | 82 | assert_equal 'application/xml', @response.content_type |
|
64 | 83 | assert_tag 'relation', :child => {:tag => 'id', :content => '2'} |
|
65 | 84 | end |
|
66 | 85 | end |
|
67 | 86 | |
|
68 | 87 | context "DELETE" do |
|
69 | 88 | should "delete the relation" do |
|
70 | 89 | assert_difference('IssueRelation.count', -1) do |
|
71 | 90 | delete '/issues/3/relations/2.xml', {}, :authorization => credentials('jsmith') |
|
72 | 91 | end |
|
73 | 92 | |
|
74 | 93 | assert_response :ok |
|
75 | 94 | assert_nil IssueRelation.find_by_id(2) |
|
76 | 95 | end |
|
77 | 96 | end |
|
78 | 97 | end |
|
79 | 98 | |
|
80 | 99 | def credentials(user, password=nil) |
|
81 | 100 | ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) |
|
82 | 101 | end |
|
83 | 102 | end |
@@ -1,371 +1,375 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class RoutingTest < ActionController::IntegrationTest |
|
21 | 21 | context "activities" do |
|
22 | 22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil |
|
23 | 23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | 26 | context "attachments" do |
|
27 | 27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' |
|
28 | 28 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' |
|
29 | 29 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' |
|
30 | 30 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' |
|
31 | 31 | end |
|
32 | 32 | |
|
33 | 33 | context "boards" do |
|
34 | 34 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' |
|
35 | 35 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
36 | 36 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' |
|
37 | 37 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' |
|
38 | 38 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
39 | 39 | |
|
40 | 40 | should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
41 | 41 | should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
42 | 42 | should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' |
|
43 | 43 | |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | context "documents" do |
|
47 | 47 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' |
|
48 | 48 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
49 | 49 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' |
|
50 | 50 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' |
|
51 | 51 | |
|
52 | 52 | should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
53 | 53 | should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' |
|
54 | 54 | should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' |
|
55 | 55 | end |
|
56 | 56 | |
|
57 | 57 | context "issues" do |
|
58 | 58 | # REST actions |
|
59 | 59 | should_route :get, "/issues", :controller => 'issues', :action => 'index' |
|
60 | 60 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' |
|
61 | 61 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' |
|
62 | 62 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' |
|
63 | 63 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' |
|
64 | 64 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' |
|
65 | 65 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' |
|
66 | 66 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' |
|
67 | 67 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' |
|
68 | 68 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' |
|
69 | 69 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' |
|
70 | 70 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' |
|
71 | 71 | |
|
72 | 72 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' |
|
73 | 73 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' |
|
74 | 74 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' |
|
75 | 75 | |
|
76 | 76 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
77 | 77 | # TODO: Should use PUT |
|
78 | 78 | should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
79 | 79 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' |
|
80 | 80 | |
|
81 | 81 | # TODO: Should use DELETE |
|
82 | 82 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' |
|
83 | 83 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' |
|
84 | 84 | |
|
85 | 85 | # Extra actions |
|
86 | 86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' |
|
87 | 87 | |
|
88 | 88 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' |
|
89 | 89 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' |
|
90 | 90 | |
|
91 | 91 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' |
|
92 | 92 | |
|
93 | 93 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' |
|
94 | 94 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' |
|
95 | 95 | |
|
96 | 96 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' |
|
97 | 97 | should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf' |
|
98 | 98 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' |
|
99 | 99 | should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf' |
|
100 | 100 | |
|
101 | 101 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' |
|
102 | 102 | |
|
103 | 103 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
104 | 104 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
105 | 105 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
106 | 106 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
107 | 107 | |
|
108 | 108 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' |
|
109 | 109 | |
|
110 | 110 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' |
|
111 | 111 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' |
|
112 | 112 | end |
|
113 | 113 | |
|
114 | 114 | context "issue categories" do |
|
115 | 115 | should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
116 | 116 | |
|
117 | 117 | should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
118 | 118 | end |
|
119 | 119 | |
|
120 | 120 | context "issue relations" do |
|
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' | |
|
123 | should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json' | |
|
124 | ||
|
121 | 125 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1' |
|
122 | 126 | should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml' |
|
123 | 127 | should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json' |
|
124 | 128 | |
|
125 | 129 | should_route :get, "/issues/1/relations/23", :controller => 'issue_relations', :action => 'show', :issue_id => '1', :id => '23' |
|
126 | 130 | should_route :get, "/issues/1/relations/23.xml", :controller => 'issue_relations', :action => 'show', :issue_id => '1', :id => '23', :format => 'xml' |
|
127 | 131 | should_route :get, "/issues/1/relations/23.json", :controller => 'issue_relations', :action => 'show', :issue_id => '1', :id => '23', :format => 'json' |
|
128 | 132 | |
|
129 | 133 | should_route :delete, "/issues/1/relations/23", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' |
|
130 | 134 | should_route :delete, "/issues/1/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23', :format => 'xml' |
|
131 | 135 | should_route :delete, "/issues/1/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23', :format => 'json' |
|
132 | 136 | end |
|
133 | 137 | |
|
134 | 138 | context "issue reports" do |
|
135 | 139 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' |
|
136 | 140 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' |
|
137 | 141 | end |
|
138 | 142 | |
|
139 | 143 | context "members" do |
|
140 | 144 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' |
|
141 | 145 | end |
|
142 | 146 | |
|
143 | 147 | context "messages" do |
|
144 | 148 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' |
|
145 | 149 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
146 | 150 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
147 | 151 | |
|
148 | 152 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
149 | 153 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
150 | 154 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' |
|
151 | 155 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' |
|
152 | 156 | end |
|
153 | 157 | |
|
154 | 158 | context "news" do |
|
155 | 159 | should_route :get, "/news", :controller => 'news', :action => 'index' |
|
156 | 160 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' |
|
157 | 161 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' |
|
158 | 162 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' |
|
159 | 163 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' |
|
160 | 164 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' |
|
161 | 165 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' |
|
162 | 166 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' |
|
163 | 167 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' |
|
164 | 168 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
165 | 169 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' |
|
166 | 170 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' |
|
167 | 171 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' |
|
168 | 172 | |
|
169 | 173 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' |
|
170 | 174 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' |
|
171 | 175 | |
|
172 | 176 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' |
|
173 | 177 | |
|
174 | 178 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' |
|
175 | 179 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' |
|
176 | 180 | end |
|
177 | 181 | |
|
178 | 182 | context "projects" do |
|
179 | 183 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
180 | 184 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
181 | 185 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
182 | 186 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' |
|
183 | 187 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
184 | 188 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
185 | 189 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
186 | 190 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' |
|
187 | 191 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' |
|
188 | 192 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' |
|
189 | 193 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' |
|
190 | 194 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' |
|
191 | 195 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' |
|
192 | 196 | |
|
193 | 197 | should_route :post, "/projects", :controller => 'projects', :action => 'create' |
|
194 | 198 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' |
|
195 | 199 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' |
|
196 | 200 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' |
|
197 | 201 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' |
|
198 | 202 | |
|
199 | 203 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' |
|
200 | 204 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' |
|
201 | 205 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' |
|
202 | 206 | |
|
203 | 207 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' |
|
204 | 208 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' |
|
205 | 209 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' |
|
206 | 210 | end |
|
207 | 211 | |
|
208 | 212 | context "queries" do |
|
209 | 213 | should_route :get, "/queries/new", :controller => 'queries', :action => 'new' |
|
210 | 214 | should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine' |
|
211 | 215 | |
|
212 | 216 | should_route :post, "/queries/new", :controller => 'queries', :action => 'new' |
|
213 | 217 | should_route :post, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine' |
|
214 | 218 | end |
|
215 | 219 | |
|
216 | 220 | context "repositories" do |
|
217 | 221 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' |
|
218 | 222 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
219 | 223 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' |
|
220 | 224 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' |
|
221 | 225 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' |
|
222 | 226 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' |
|
223 | 227 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' |
|
224 | 228 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] |
|
225 | 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' |
|
226 | 230 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] |
|
227 | 231 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] |
|
228 | 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' |
|
229 | 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' |
|
230 | 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' |
|
231 | 235 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] |
|
232 | 236 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] |
|
233 | 237 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' |
|
234 | 238 | |
|
235 | 239 | |
|
236 | 240 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
237 | 241 | end |
|
238 | 242 | |
|
239 | 243 | context "timelogs (global)" do |
|
240 | 244 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'index' |
|
241 | 245 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv' |
|
242 | 246 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom' |
|
243 | 247 | should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new' |
|
244 | 248 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' |
|
245 | 249 | |
|
246 | 250 | should_route :post, "/time_entries", :controller => 'timelog', :action => 'create' |
|
247 | 251 | |
|
248 | 252 | should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22' |
|
249 | 253 | |
|
250 | 254 | should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55' |
|
251 | 255 | end |
|
252 | 256 | |
|
253 | 257 | context "timelogs (scoped under project)" do |
|
254 | 258 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' |
|
255 | 259 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' |
|
256 | 260 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom' |
|
257 | 261 | should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567' |
|
258 | 262 | should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567' |
|
259 | 263 | |
|
260 | 264 | should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567' |
|
261 | 265 | |
|
262 | 266 | should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567' |
|
263 | 267 | |
|
264 | 268 | should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567' |
|
265 | 269 | end |
|
266 | 270 | |
|
267 | 271 | context "timelogs (scoped under issues)" do |
|
268 | 272 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234' |
|
269 | 273 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv' |
|
270 | 274 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom' |
|
271 | 275 | should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234' |
|
272 | 276 | should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234' |
|
273 | 277 | |
|
274 | 278 | should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234' |
|
275 | 279 | |
|
276 | 280 | should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234' |
|
277 | 281 | |
|
278 | 282 | should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234' |
|
279 | 283 | end |
|
280 | 284 | |
|
281 | 285 | context "timelogs (scoped under project and issues)" do |
|
282 | 286 | should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook' |
|
283 | 287 | should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' |
|
284 | 288 | should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' |
|
285 | 289 | should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook' |
|
286 | 290 | should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
287 | 291 | |
|
288 | 292 | should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook' |
|
289 | 293 | |
|
290 | 294 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
291 | 295 | |
|
292 | 296 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' |
|
293 | 297 | end |
|
294 | 298 | |
|
295 | 299 | context "time_entry_reports" do |
|
296 | 300 | should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report' |
|
297 | 301 | should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567' |
|
298 | 302 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' |
|
299 | 303 | end |
|
300 | 304 | |
|
301 | 305 | context "users" do |
|
302 | 306 | should_route :get, "/users", :controller => 'users', :action => 'index' |
|
303 | 307 | should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml' |
|
304 | 308 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' |
|
305 | 309 | should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml' |
|
306 | 310 | should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current' |
|
307 | 311 | should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml' |
|
308 | 312 | should_route :get, "/users/new", :controller => 'users', :action => 'new' |
|
309 | 313 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
310 | 314 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' |
|
311 | 315 | |
|
312 | 316 | should_route :post, "/users", :controller => 'users', :action => 'create' |
|
313 | 317 | should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml' |
|
314 | 318 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' |
|
315 | 319 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' |
|
316 | 320 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
317 | 321 | |
|
318 | 322 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' |
|
319 | 323 | should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml' |
|
320 | 324 | |
|
321 | 325 | should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44' |
|
322 | 326 | should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml' |
|
323 | 327 | end |
|
324 | 328 | |
|
325 | 329 | # TODO: should they all be scoped under /projects/:project_id ? |
|
326 | 330 | context "versions" do |
|
327 | 331 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
328 | 332 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' |
|
329 | 333 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' |
|
330 | 334 | |
|
331 | 335 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' |
|
332 | 336 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' |
|
333 | 337 | |
|
334 | 338 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' |
|
335 | 339 | end |
|
336 | 340 | |
|
337 | 341 | context "wiki (singular, project's pages)" do |
|
338 | 342 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' |
|
339 | 343 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala' |
|
340 | 344 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page' |
|
341 | 345 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation' |
|
342 | 346 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation' |
|
343 | 347 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2' |
|
344 | 348 | 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' |
|
345 | 349 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2' |
|
346 | 350 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' |
|
347 | 351 | should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' |
|
348 | 352 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' |
|
349 | 353 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' |
|
350 | 354 | |
|
351 | 355 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation' |
|
352 | 356 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' |
|
353 | 357 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida' |
|
354 | 358 | should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida' |
|
355 | 359 | |
|
356 | 360 | should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page' |
|
357 | 361 | |
|
358 | 362 | should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida' |
|
359 | 363 | end |
|
360 | 364 | |
|
361 | 365 | context "wikis (plural, admin setup)" do |
|
362 | 366 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
363 | 367 | |
|
364 | 368 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' |
|
365 | 369 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
366 | 370 | end |
|
367 | 371 | |
|
368 | 372 | context "administration panel" do |
|
369 | 373 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' |
|
370 | 374 | end |
|
371 | 375 | end |
General Comments 0
You need to be logged in to leave comments.
Login now