@@ -1,117 +1,123 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 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 ReportsController < ApplicationController |
|
18 | class ReportsController < ApplicationController | |
19 | menu_item :issues |
|
19 | menu_item :issues | |
20 | before_filter :find_project, :authorize |
|
20 | before_filter :find_project, :authorize | |
21 |
|
21 | |||
22 | def issue_report |
|
22 | def issue_report | |
23 | @statuses = IssueStatus.find(:all, :order => 'position') |
|
23 | @statuses = IssueStatus.find(:all, :order => 'position') | |
24 |
|
24 | |||
|
25 | @trackers = @project.trackers | |||
|
26 | @versions = @project.shared_versions.sort | |||
|
27 | @priorities = IssuePriority.all | |||
|
28 | @categories = @project.issue_categories | |||
|
29 | @assignees = @project.members.collect { |m| m.user }.sort | |||
|
30 | @authors = @project.members.collect { |m| m.user }.sort | |||
|
31 | @subprojects = @project.descendants.active | |||
|
32 | issues_by_tracker | |||
|
33 | issues_by_version | |||
|
34 | issues_by_priority | |||
|
35 | issues_by_category | |||
|
36 | issues_by_assigned_to | |||
|
37 | issues_by_author | |||
|
38 | issues_by_subproject | |||
|
39 | ||||
|
40 | render :template => "reports/issue_report" | |||
|
41 | end | |||
|
42 | ||||
|
43 | def issue_report_details | |||
|
44 | @statuses = IssueStatus.find(:all, :order => 'position') | |||
|
45 | ||||
25 | case params[:detail] |
|
46 | case params[:detail] | |
26 | when "tracker" |
|
47 | when "tracker" | |
27 | @field = "tracker_id" |
|
48 | @field = "tracker_id" | |
28 | @rows = @project.trackers |
|
49 | @rows = @project.trackers | |
29 | @data = issues_by_tracker |
|
50 | @data = issues_by_tracker | |
30 | @report_title = l(:field_tracker) |
|
51 | @report_title = l(:field_tracker) | |
31 | render :template => "reports/issue_report_details" |
|
52 | render :template => "reports/issue_report_details" | |
32 | when "version" |
|
53 | when "version" | |
33 | @field = "fixed_version_id" |
|
54 | @field = "fixed_version_id" | |
34 | @rows = @project.shared_versions.sort |
|
55 | @rows = @project.shared_versions.sort | |
35 | @data = issues_by_version |
|
56 | @data = issues_by_version | |
36 | @report_title = l(:field_version) |
|
57 | @report_title = l(:field_version) | |
37 | render :template => "reports/issue_report_details" |
|
58 | render :template => "reports/issue_report_details" | |
38 | when "priority" |
|
59 | when "priority" | |
39 | @field = "priority_id" |
|
60 | @field = "priority_id" | |
40 | @rows = IssuePriority.all |
|
61 | @rows = IssuePriority.all | |
41 | @data = issues_by_priority |
|
62 | @data = issues_by_priority | |
42 | @report_title = l(:field_priority) |
|
63 | @report_title = l(:field_priority) | |
43 | render :template => "reports/issue_report_details" |
|
64 | render :template => "reports/issue_report_details" | |
44 | when "category" |
|
65 | when "category" | |
45 | @field = "category_id" |
|
66 | @field = "category_id" | |
46 | @rows = @project.issue_categories |
|
67 | @rows = @project.issue_categories | |
47 | @data = issues_by_category |
|
68 | @data = issues_by_category | |
48 | @report_title = l(:field_category) |
|
69 | @report_title = l(:field_category) | |
49 | render :template => "reports/issue_report_details" |
|
70 | render :template => "reports/issue_report_details" | |
50 | when "assigned_to" |
|
71 | when "assigned_to" | |
51 | @field = "assigned_to_id" |
|
72 | @field = "assigned_to_id" | |
52 | @rows = @project.members.collect { |m| m.user }.sort |
|
73 | @rows = @project.members.collect { |m| m.user }.sort | |
53 | @data = issues_by_assigned_to |
|
74 | @data = issues_by_assigned_to | |
54 | @report_title = l(:field_assigned_to) |
|
75 | @report_title = l(:field_assigned_to) | |
55 | render :template => "reports/issue_report_details" |
|
76 | render :template => "reports/issue_report_details" | |
56 | when "author" |
|
77 | when "author" | |
57 | @field = "author_id" |
|
78 | @field = "author_id" | |
58 | @rows = @project.members.collect { |m| m.user }.sort |
|
79 | @rows = @project.members.collect { |m| m.user }.sort | |
59 | @data = issues_by_author |
|
80 | @data = issues_by_author | |
60 | @report_title = l(:field_author) |
|
81 | @report_title = l(:field_author) | |
61 | render :template => "reports/issue_report_details" |
|
82 | render :template => "reports/issue_report_details" | |
62 | when "subproject" |
|
83 | when "subproject" | |
63 | @field = "project_id" |
|
84 | @field = "project_id" | |
64 | @rows = @project.descendants.active |
|
85 | @rows = @project.descendants.active | |
65 | @data = issues_by_subproject |
|
86 | @data = issues_by_subproject | |
66 | @report_title = l(:field_subproject) |
|
87 | @report_title = l(:field_subproject) | |
67 | render :template => "reports/issue_report_details" |
|
88 | render :template => "reports/issue_report_details" | |
68 | else |
|
89 | else | |
69 | @trackers = @project.trackers |
|
90 | redirect_to :action => 'issue_report', :id => @project | |
70 | @versions = @project.shared_versions.sort |
|
|||
71 | @priorities = IssuePriority.all |
|
|||
72 | @categories = @project.issue_categories |
|
|||
73 | @assignees = @project.members.collect { |m| m.user }.sort |
|
|||
74 | @authors = @project.members.collect { |m| m.user }.sort |
|
|||
75 | @subprojects = @project.descendants.active |
|
|||
76 | issues_by_tracker |
|
|||
77 | issues_by_version |
|
|||
78 | issues_by_priority |
|
|||
79 | issues_by_category |
|
|||
80 | issues_by_assigned_to |
|
|||
81 | issues_by_author |
|
|||
82 | issues_by_subproject |
|
|||
83 |
|
||||
84 | render :template => "reports/issue_report" |
|
|||
85 | end |
|
91 | end | |
86 | end |
|
92 | ||
87 |
|
93 | end | ||
88 | private |
|
94 | private | |
89 | def issues_by_tracker |
|
95 | def issues_by_tracker | |
90 | @issues_by_tracker ||= Issue.by_tracker(@project) |
|
96 | @issues_by_tracker ||= Issue.by_tracker(@project) | |
91 | end |
|
97 | end | |
92 |
|
98 | |||
93 | def issues_by_version |
|
99 | def issues_by_version | |
94 | @issues_by_version ||= Issue.by_version(@project) |
|
100 | @issues_by_version ||= Issue.by_version(@project) | |
95 | end |
|
101 | end | |
96 |
|
102 | |||
97 | def issues_by_priority |
|
103 | def issues_by_priority | |
98 | @issues_by_priority ||= Issue.by_priority(@project) |
|
104 | @issues_by_priority ||= Issue.by_priority(@project) | |
99 | end |
|
105 | end | |
100 |
|
106 | |||
101 | def issues_by_category |
|
107 | def issues_by_category | |
102 | @issues_by_category ||= Issue.by_category(@project) |
|
108 | @issues_by_category ||= Issue.by_category(@project) | |
103 | end |
|
109 | end | |
104 |
|
110 | |||
105 | def issues_by_assigned_to |
|
111 | def issues_by_assigned_to | |
106 | @issues_by_assigned_to ||= Issue.by_assigned_to(@project) |
|
112 | @issues_by_assigned_to ||= Issue.by_assigned_to(@project) | |
107 | end |
|
113 | end | |
108 |
|
114 | |||
109 | def issues_by_author |
|
115 | def issues_by_author | |
110 | @issues_by_author ||= Issue.by_author(@project) |
|
116 | @issues_by_author ||= Issue.by_author(@project) | |
111 | end |
|
117 | end | |
112 |
|
118 | |||
113 | def issues_by_subproject |
|
119 | def issues_by_subproject | |
114 | @issues_by_subproject ||= Issue.by_subproject(@project) |
|
120 | @issues_by_subproject ||= Issue.by_subproject(@project) | |
115 | @issues_by_subproject ||= [] |
|
121 | @issues_by_subproject ||= [] | |
116 | end |
|
122 | end | |
117 | end |
|
123 | end |
@@ -1,287 +1,287 | |||||
1 | ActionController::Routing::Routes.draw do |map| |
|
1 | ActionController::Routing::Routes.draw do |map| | |
2 | # Add your own custom routes here. |
|
2 | # Add your own custom routes here. | |
3 | # The priority is based upon order of creation: first created -> highest priority. |
|
3 | # The priority is based upon order of creation: first created -> highest priority. | |
4 |
|
4 | |||
5 | # Here's a sample route: |
|
5 | # Here's a sample route: | |
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' |
|
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' | |
7 | # Keep in mind you can assign values other than :controller and :action |
|
7 | # Keep in mind you can assign values other than :controller and :action | |
8 |
|
8 | |||
9 | map.home '', :controller => 'welcome' |
|
9 | map.home '', :controller => 'welcome' | |
10 |
|
10 | |||
11 | map.signin 'login', :controller => 'account', :action => 'login' |
|
11 | map.signin 'login', :controller => 'account', :action => 'login' | |
12 | map.signout 'logout', :controller => 'account', :action => 'logout' |
|
12 | map.signout 'logout', :controller => 'account', :action => 'logout' | |
13 |
|
13 | |||
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' | |
15 | map.connect 'help/:ctrl/:page', :controller => 'help' |
|
15 | map.connect 'help/:ctrl/:page', :controller => 'help' | |
16 |
|
16 | |||
17 | map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog' |
|
17 | map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog' | |
18 | map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
18 | map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog' | |
19 | map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
19 | map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog' | |
20 |
|
20 | |||
21 | map.with_options :controller => 'timelog' do |timelog| |
|
21 | map.with_options :controller => 'timelog' do |timelog| | |
22 | timelog.connect 'projects/:project_id/time_entries', :action => 'details' |
|
22 | timelog.connect 'projects/:project_id/time_entries', :action => 'details' | |
23 |
|
23 | |||
24 | timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details| |
|
24 | timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details| | |
25 | time_details.connect 'time_entries' |
|
25 | time_details.connect 'time_entries' | |
26 | time_details.connect 'time_entries.:format' |
|
26 | time_details.connect 'time_entries.:format' | |
27 | time_details.connect 'issues/:issue_id/time_entries' |
|
27 | time_details.connect 'issues/:issue_id/time_entries' | |
28 | time_details.connect 'issues/:issue_id/time_entries.:format' |
|
28 | time_details.connect 'issues/:issue_id/time_entries.:format' | |
29 | time_details.connect 'projects/:project_id/time_entries.:format' |
|
29 | time_details.connect 'projects/:project_id/time_entries.:format' | |
30 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries' |
|
30 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries' | |
31 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format' |
|
31 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format' | |
32 | end |
|
32 | end | |
33 | timelog.connect 'projects/:project_id/time_entries/report', :action => 'report' |
|
33 | timelog.connect 'projects/:project_id/time_entries/report', :action => 'report' | |
34 | timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report| |
|
34 | timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report| | |
35 | time_report.connect 'time_entries/report' |
|
35 | time_report.connect 'time_entries/report' | |
36 | time_report.connect 'time_entries/report.:format' |
|
36 | time_report.connect 'time_entries/report.:format' | |
37 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
37 | time_report.connect 'projects/:project_id/time_entries/report.:format' | |
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit| |
|
40 | timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit| | |
41 | time_edit.connect 'issues/:issue_id/time_entries/new' |
|
41 | time_edit.connect 'issues/:issue_id/time_entries/new' | |
42 | end |
|
42 | end | |
43 |
|
43 | |||
44 | timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post} |
|
44 | timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post} | |
45 | end |
|
45 | end | |
46 |
|
46 | |||
47 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
47 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} | |
48 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
48 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} | |
49 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} |
|
49 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} | |
50 | map.with_options :controller => 'wiki' do |wiki_routes| |
|
50 | map.with_options :controller => 'wiki' do |wiki_routes| | |
51 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| |
|
51 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| | |
52 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i |
|
52 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i | |
53 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil |
|
53 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil | |
54 | wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' |
|
54 | wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' | |
55 | wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' |
|
55 | wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' | |
56 | wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' |
|
56 | wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' | |
57 | wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' |
|
57 | wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' | |
58 | wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' |
|
58 | wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' | |
59 | end |
|
59 | end | |
60 |
|
60 | |||
61 | wiki_routes.connect 'projects/:id/wiki/:page/:action', |
|
61 | wiki_routes.connect 'projects/:id/wiki/:page/:action', | |
62 | :action => /edit|rename|destroy|preview|protect/, |
|
62 | :action => /edit|rename|destroy|preview|protect/, | |
63 | :conditions => {:method => :post} |
|
63 | :conditions => {:method => :post} | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | map.with_options :controller => 'messages' do |messages_routes| |
|
66 | map.with_options :controller => 'messages' do |messages_routes| | |
67 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
67 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| | |
68 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
68 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' | |
69 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
69 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' | |
70 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
70 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | |
71 | end |
|
71 | end | |
72 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
72 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| | |
73 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
73 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' | |
74 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
74 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' | |
75 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ |
|
75 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ | |
76 | end |
|
76 | end | |
77 | end |
|
77 | end | |
78 |
|
78 | |||
79 | map.with_options :controller => 'boards' do |board_routes| |
|
79 | map.with_options :controller => 'boards' do |board_routes| | |
80 | board_routes.with_options :conditions => {:method => :get} do |board_views| |
|
80 | board_routes.with_options :conditions => {:method => :get} do |board_views| | |
81 | board_views.connect 'projects/:project_id/boards', :action => 'index' |
|
81 | board_views.connect 'projects/:project_id/boards', :action => 'index' | |
82 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' |
|
82 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' | |
83 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' |
|
83 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' | |
84 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' |
|
84 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' | |
85 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' |
|
85 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' | |
86 | end |
|
86 | end | |
87 | board_routes.with_options :conditions => {:method => :post} do |board_actions| |
|
87 | board_routes.with_options :conditions => {:method => :post} do |board_actions| | |
88 | board_actions.connect 'projects/:project_id/boards', :action => 'new' |
|
88 | board_actions.connect 'projects/:project_id/boards', :action => 'new' | |
89 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ |
|
89 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ | |
90 | end |
|
90 | end | |
91 | end |
|
91 | end | |
92 |
|
92 | |||
93 | map.with_options :controller => 'documents' do |document_routes| |
|
93 | map.with_options :controller => 'documents' do |document_routes| | |
94 | document_routes.with_options :conditions => {:method => :get} do |document_views| |
|
94 | document_routes.with_options :conditions => {:method => :get} do |document_views| | |
95 | document_views.connect 'projects/:project_id/documents', :action => 'index' |
|
95 | document_views.connect 'projects/:project_id/documents', :action => 'index' | |
96 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' |
|
96 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' | |
97 | document_views.connect 'documents/:id', :action => 'show' |
|
97 | document_views.connect 'documents/:id', :action => 'show' | |
98 | document_views.connect 'documents/:id/edit', :action => 'edit' |
|
98 | document_views.connect 'documents/:id/edit', :action => 'edit' | |
99 | end |
|
99 | end | |
100 | document_routes.with_options :conditions => {:method => :post} do |document_actions| |
|
100 | document_routes.with_options :conditions => {:method => :post} do |document_actions| | |
101 | document_actions.connect 'projects/:project_id/documents', :action => 'new' |
|
101 | document_actions.connect 'projects/:project_id/documents', :action => 'new' | |
102 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ |
|
102 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ | |
103 | end |
|
103 | end | |
104 | end |
|
104 | end | |
105 |
|
105 | |||
106 | map.with_options :controller => 'issues' do |issues_routes| |
|
106 | map.with_options :controller => 'issues' do |issues_routes| | |
107 | issues_routes.with_options :conditions => {:method => :get} do |issues_views| |
|
107 | issues_routes.with_options :conditions => {:method => :get} do |issues_views| | |
108 | issues_views.connect 'issues', :action => 'index' |
|
108 | issues_views.connect 'issues', :action => 'index' | |
109 | issues_views.connect 'issues.:format', :action => 'index' |
|
109 | issues_views.connect 'issues.:format', :action => 'index' | |
110 | issues_views.connect 'projects/:project_id/issues', :action => 'index' |
|
110 | issues_views.connect 'projects/:project_id/issues', :action => 'index' | |
111 | issues_views.connect 'projects/:project_id/issues.:format', :action => 'index' |
|
111 | issues_views.connect 'projects/:project_id/issues.:format', :action => 'index' | |
112 | issues_views.connect 'projects/:project_id/issues/new', :action => 'new' |
|
112 | issues_views.connect 'projects/:project_id/issues/new', :action => 'new' | |
113 | issues_views.connect 'projects/:project_id/issues/gantt', :action => 'gantt' |
|
113 | issues_views.connect 'projects/:project_id/issues/gantt', :action => 'gantt' | |
114 | issues_views.connect 'projects/:project_id/issues/calendar', :action => 'calendar' |
|
114 | issues_views.connect 'projects/:project_id/issues/calendar', :action => 'calendar' | |
115 | issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new' |
|
115 | issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new' | |
116 | issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/ |
|
116 | issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/ | |
117 | issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/ |
|
117 | issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/ | |
118 | issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/ |
|
118 | issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/ | |
119 | issues_views.connect 'issues/:id/move', :action => 'move', :id => /\d+/ |
|
119 | issues_views.connect 'issues/:id/move', :action => 'move', :id => /\d+/ | |
120 | end |
|
120 | end | |
121 | issues_routes.with_options :conditions => {:method => :post} do |issues_actions| |
|
121 | issues_routes.with_options :conditions => {:method => :post} do |issues_actions| | |
122 | issues_actions.connect 'issues', :action => 'index' |
|
122 | issues_actions.connect 'issues', :action => 'index' | |
123 | issues_actions.connect 'projects/:project_id/issues', :action => 'new' |
|
123 | issues_actions.connect 'projects/:project_id/issues', :action => 'new' | |
124 | issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/ |
|
124 | issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/ | |
125 | issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/ |
|
125 | issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/ | |
126 | issues_actions.connect 'issues.:format', :action => 'new', :format => /xml/ |
|
126 | issues_actions.connect 'issues.:format', :action => 'new', :format => /xml/ | |
127 | end |
|
127 | end | |
128 | issues_routes.with_options :conditions => {:method => :put} do |issues_actions| |
|
128 | issues_routes.with_options :conditions => {:method => :put} do |issues_actions| | |
129 | issues_actions.connect 'issues/:id.:format', :action => 'edit', :id => /\d+/, :format => /xml/ |
|
129 | issues_actions.connect 'issues/:id.:format', :action => 'edit', :id => /\d+/, :format => /xml/ | |
130 | end |
|
130 | end | |
131 | issues_routes.with_options :conditions => {:method => :delete} do |issues_actions| |
|
131 | issues_routes.with_options :conditions => {:method => :delete} do |issues_actions| | |
132 | issues_actions.connect 'issues/:id.:format', :action => 'destroy', :id => /\d+/, :format => /xml/ |
|
132 | issues_actions.connect 'issues/:id.:format', :action => 'destroy', :id => /\d+/, :format => /xml/ | |
133 | end |
|
133 | end | |
134 | issues_routes.connect 'issues/:action' |
|
134 | issues_routes.connect 'issues/:action' | |
135 | end |
|
135 | end | |
136 |
|
136 | |||
137 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| |
|
137 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| | |
138 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' |
|
138 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' | |
139 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' |
|
139 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' | |
140 | end |
|
140 | end | |
141 |
|
141 | |||
142 |
map.with_options :controller => 'reports' |
|
142 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| | |
143 | reports.connect 'projects/:id/issues/report' |
|
143 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' | |
144 | reports.connect 'projects/:id/issues/report/:detail' |
|
144 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' | |
145 | end |
|
145 | end | |
146 |
|
146 | |||
147 | map.with_options :controller => 'news' do |news_routes| |
|
147 | map.with_options :controller => 'news' do |news_routes| | |
148 | news_routes.with_options :conditions => {:method => :get} do |news_views| |
|
148 | news_routes.with_options :conditions => {:method => :get} do |news_views| | |
149 | news_views.connect 'news', :action => 'index' |
|
149 | news_views.connect 'news', :action => 'index' | |
150 | news_views.connect 'projects/:project_id/news', :action => 'index' |
|
150 | news_views.connect 'projects/:project_id/news', :action => 'index' | |
151 | news_views.connect 'projects/:project_id/news.:format', :action => 'index' |
|
151 | news_views.connect 'projects/:project_id/news.:format', :action => 'index' | |
152 | news_views.connect 'news.:format', :action => 'index' |
|
152 | news_views.connect 'news.:format', :action => 'index' | |
153 | news_views.connect 'projects/:project_id/news/new', :action => 'new' |
|
153 | news_views.connect 'projects/:project_id/news/new', :action => 'new' | |
154 | news_views.connect 'news/:id', :action => 'show' |
|
154 | news_views.connect 'news/:id', :action => 'show' | |
155 | news_views.connect 'news/:id/edit', :action => 'edit' |
|
155 | news_views.connect 'news/:id/edit', :action => 'edit' | |
156 | end |
|
156 | end | |
157 | news_routes.with_options do |news_actions| |
|
157 | news_routes.with_options do |news_actions| | |
158 | news_actions.connect 'projects/:project_id/news', :action => 'new' |
|
158 | news_actions.connect 'projects/:project_id/news', :action => 'new' | |
159 | news_actions.connect 'news/:id/edit', :action => 'edit' |
|
159 | news_actions.connect 'news/:id/edit', :action => 'edit' | |
160 | news_actions.connect 'news/:id/destroy', :action => 'destroy' |
|
160 | news_actions.connect 'news/:id/destroy', :action => 'destroy' | |
161 | end |
|
161 | end | |
162 | end |
|
162 | end | |
163 |
|
163 | |||
164 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
164 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' | |
165 |
|
165 | |||
166 | map.with_options :controller => 'users' do |users| |
|
166 | map.with_options :controller => 'users' do |users| | |
167 | users.with_options :conditions => {:method => :get} do |user_views| |
|
167 | users.with_options :conditions => {:method => :get} do |user_views| | |
168 | user_views.connect 'users', :action => 'index' |
|
168 | user_views.connect 'users', :action => 'index' | |
169 | user_views.connect 'users/:id', :action => 'show', :id => /\d+/ |
|
169 | user_views.connect 'users/:id', :action => 'show', :id => /\d+/ | |
170 | user_views.connect 'users/new', :action => 'add' |
|
170 | user_views.connect 'users/new', :action => 'add' | |
171 | user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil |
|
171 | user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil | |
172 | end |
|
172 | end | |
173 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
173 | users.with_options :conditions => {:method => :post} do |user_actions| | |
174 | user_actions.connect 'users', :action => 'add' |
|
174 | user_actions.connect 'users', :action => 'add' | |
175 | user_actions.connect 'users/new', :action => 'add' |
|
175 | user_actions.connect 'users/new', :action => 'add' | |
176 | user_actions.connect 'users/:id/edit', :action => 'edit' |
|
176 | user_actions.connect 'users/:id/edit', :action => 'edit' | |
177 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
177 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' | |
178 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
178 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' | |
179 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
179 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' | |
180 | end |
|
180 | end | |
181 | end |
|
181 | end | |
182 |
|
182 | |||
183 | map.with_options :controller => 'projects' do |projects| |
|
183 | map.with_options :controller => 'projects' do |projects| | |
184 | projects.with_options :conditions => {:method => :get} do |project_views| |
|
184 | projects.with_options :conditions => {:method => :get} do |project_views| | |
185 | project_views.connect 'projects', :action => 'index' |
|
185 | project_views.connect 'projects', :action => 'index' | |
186 | project_views.connect 'projects.:format', :action => 'index' |
|
186 | project_views.connect 'projects.:format', :action => 'index' | |
187 | project_views.connect 'projects/new', :action => 'add' |
|
187 | project_views.connect 'projects/new', :action => 'add' | |
188 | project_views.connect 'projects/:id', :action => 'show' |
|
188 | project_views.connect 'projects/:id', :action => 'show' | |
189 | project_views.connect 'projects/:id.:format', :action => 'show' |
|
189 | project_views.connect 'projects/:id.:format', :action => 'show' | |
190 | project_views.connect 'projects/:id/:action', :action => /roadmap|destroy|settings/ |
|
190 | project_views.connect 'projects/:id/:action', :action => /roadmap|destroy|settings/ | |
191 | project_views.connect 'projects/:id/files', :action => 'list_files' |
|
191 | project_views.connect 'projects/:id/files', :action => 'list_files' | |
192 | project_views.connect 'projects/:id/files/new', :action => 'add_file' |
|
192 | project_views.connect 'projects/:id/files/new', :action => 'add_file' | |
193 | project_views.connect 'projects/:id/versions/new', :action => 'add_version' |
|
193 | project_views.connect 'projects/:id/versions/new', :action => 'add_version' | |
194 | project_views.connect 'projects/:id/categories/new', :action => 'add_issue_category' |
|
194 | project_views.connect 'projects/:id/categories/new', :action => 'add_issue_category' | |
195 | project_views.connect 'projects/:id/settings/:tab', :action => 'settings' |
|
195 | project_views.connect 'projects/:id/settings/:tab', :action => 'settings' | |
196 | end |
|
196 | end | |
197 |
|
197 | |||
198 | projects.with_options :action => 'activity', :conditions => {:method => :get} do |activity| |
|
198 | projects.with_options :action => 'activity', :conditions => {:method => :get} do |activity| | |
199 | activity.connect 'projects/:id/activity' |
|
199 | activity.connect 'projects/:id/activity' | |
200 | activity.connect 'projects/:id/activity.:format' |
|
200 | activity.connect 'projects/:id/activity.:format' | |
201 | activity.connect 'activity', :id => nil |
|
201 | activity.connect 'activity', :id => nil | |
202 | activity.connect 'activity.:format', :id => nil |
|
202 | activity.connect 'activity.:format', :id => nil | |
203 | end |
|
203 | end | |
204 |
|
204 | |||
205 | projects.with_options :conditions => {:method => :post} do |project_actions| |
|
205 | projects.with_options :conditions => {:method => :post} do |project_actions| | |
206 | project_actions.connect 'projects/new', :action => 'add' |
|
206 | project_actions.connect 'projects/new', :action => 'add' | |
207 | project_actions.connect 'projects', :action => 'add' |
|
207 | project_actions.connect 'projects', :action => 'add' | |
208 | project_actions.connect 'projects.:format', :action => 'add', :format => /xml/ |
|
208 | project_actions.connect 'projects.:format', :action => 'add', :format => /xml/ | |
209 | project_actions.connect 'projects/:id/:action', :action => /edit|destroy|archive|unarchive/ |
|
209 | project_actions.connect 'projects/:id/:action', :action => /edit|destroy|archive|unarchive/ | |
210 | project_actions.connect 'projects/:id/files/new', :action => 'add_file' |
|
210 | project_actions.connect 'projects/:id/files/new', :action => 'add_file' | |
211 | project_actions.connect 'projects/:id/versions/new', :action => 'add_version' |
|
211 | project_actions.connect 'projects/:id/versions/new', :action => 'add_version' | |
212 | project_actions.connect 'projects/:id/categories/new', :action => 'add_issue_category' |
|
212 | project_actions.connect 'projects/:id/categories/new', :action => 'add_issue_category' | |
213 | project_actions.connect 'projects/:id/activities/save', :action => 'save_activities' |
|
213 | project_actions.connect 'projects/:id/activities/save', :action => 'save_activities' | |
214 | end |
|
214 | end | |
215 |
|
215 | |||
216 | projects.with_options :conditions => {:method => :put} do |project_actions| |
|
216 | projects.with_options :conditions => {:method => :put} do |project_actions| | |
217 | project_actions.conditions 'projects/:id.:format', :action => 'edit', :format => /xml/ |
|
217 | project_actions.conditions 'projects/:id.:format', :action => 'edit', :format => /xml/ | |
218 | end |
|
218 | end | |
219 |
|
219 | |||
220 | projects.with_options :conditions => {:method => :delete} do |project_actions| |
|
220 | projects.with_options :conditions => {:method => :delete} do |project_actions| | |
221 | project_actions.conditions 'projects/:id.:format', :action => 'destroy', :format => /xml/ |
|
221 | project_actions.conditions 'projects/:id.:format', :action => 'destroy', :format => /xml/ | |
222 | project_actions.conditions 'projects/:id/reset_activities', :action => 'reset_activities' |
|
222 | project_actions.conditions 'projects/:id/reset_activities', :action => 'reset_activities' | |
223 | end |
|
223 | end | |
224 | end |
|
224 | end | |
225 |
|
225 | |||
226 | map.with_options :controller => 'versions' do |versions| |
|
226 | map.with_options :controller => 'versions' do |versions| | |
227 | versions.with_options :conditions => {:method => :post} do |version_actions| |
|
227 | versions.with_options :conditions => {:method => :post} do |version_actions| | |
228 | version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed' |
|
228 | version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed' | |
229 | end |
|
229 | end | |
230 | end |
|
230 | end | |
231 |
|
231 | |||
232 | map.with_options :controller => 'repositories' do |repositories| |
|
232 | map.with_options :controller => 'repositories' do |repositories| | |
233 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
233 | repositories.with_options :conditions => {:method => :get} do |repository_views| | |
234 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
234 | repository_views.connect 'projects/:id/repository', :action => 'show' | |
235 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
235 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' | |
236 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
236 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' | |
237 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
237 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' | |
238 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
238 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' | |
239 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
239 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' | |
240 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
240 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' | |
241 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
241 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' | |
242 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
242 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
243 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
243 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
244 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' |
|
244 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' | |
245 | # TODO: why the following route is required? |
|
245 | # TODO: why the following route is required? | |
246 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' |
|
246 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' | |
247 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
247 | repository_views.connect 'projects/:id/repository/:action/*path' | |
248 | end |
|
248 | end | |
249 |
|
249 | |||
250 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
250 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} | |
251 | end |
|
251 | end | |
252 |
|
252 | |||
253 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ |
|
253 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ | |
254 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
254 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ | |
255 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
255 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ | |
256 |
|
256 | |||
257 | map.resources :groups |
|
257 | map.resources :groups | |
258 |
|
258 | |||
259 | #left old routes at the bottom for backwards compat |
|
259 | #left old routes at the bottom for backwards compat | |
260 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' |
|
260 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' | |
261 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' |
|
261 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' | |
262 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' |
|
262 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' | |
263 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
263 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' | |
264 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
264 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' | |
265 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' |
|
265 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' | |
266 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
266 | map.connect 'projects/:project_id/news/:action', :controller => 'news' | |
267 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
267 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ | |
268 | map.with_options :controller => 'repositories' do |omap| |
|
268 | map.with_options :controller => 'repositories' do |omap| | |
269 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
269 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' | |
270 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
270 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' | |
271 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
271 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' | |
272 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
272 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' | |
273 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
273 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' | |
274 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
274 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' | |
275 | end |
|
275 | end | |
276 |
|
276 | |||
277 | map.with_options :controller => 'sys' do |sys| |
|
277 | map.with_options :controller => 'sys' do |sys| | |
278 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
278 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} | |
279 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
279 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} | |
280 | end |
|
280 | end | |
281 |
|
281 | |||
282 | # Install the default route as the lowest priority. |
|
282 | # Install the default route as the lowest priority. | |
283 | map.connect ':controller/:action/:id' |
|
283 | map.connect ':controller/:action/:id' | |
284 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
284 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' | |
285 | # Used for OpenID |
|
285 | # Used for OpenID | |
286 | map.root :controller => 'account', :action => 'login' |
|
286 | map.root :controller => 'account', :action => 'login' | |
287 | end |
|
287 | end |
@@ -1,176 +1,176 | |||||
1 | require 'redmine/access_control' |
|
1 | require 'redmine/access_control' | |
2 | require 'redmine/menu_manager' |
|
2 | require 'redmine/menu_manager' | |
3 | require 'redmine/activity' |
|
3 | require 'redmine/activity' | |
4 | require 'redmine/mime_type' |
|
4 | require 'redmine/mime_type' | |
5 | require 'redmine/core_ext' |
|
5 | require 'redmine/core_ext' | |
6 | require 'redmine/themes' |
|
6 | require 'redmine/themes' | |
7 | require 'redmine/hook' |
|
7 | require 'redmine/hook' | |
8 | require 'redmine/plugin' |
|
8 | require 'redmine/plugin' | |
9 | require 'redmine/wiki_formatting' |
|
9 | require 'redmine/wiki_formatting' | |
10 |
|
10 | |||
11 | begin |
|
11 | begin | |
12 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) |
|
12 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) | |
13 | rescue LoadError |
|
13 | rescue LoadError | |
14 | # RMagick is not available |
|
14 | # RMagick is not available | |
15 | end |
|
15 | end | |
16 |
|
16 | |||
17 | if RUBY_VERSION < '1.9' |
|
17 | if RUBY_VERSION < '1.9' | |
18 | require 'faster_csv' |
|
18 | require 'faster_csv' | |
19 | else |
|
19 | else | |
20 | require 'csv' |
|
20 | require 'csv' | |
21 | FCSV = CSV |
|
21 | FCSV = CSV | |
22 | end |
|
22 | end | |
23 |
|
23 | |||
24 | REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs Bazaar Git Filesystem ) |
|
24 | REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs Bazaar Git Filesystem ) | |
25 |
|
25 | |||
26 | # Permissions |
|
26 | # Permissions | |
27 | Redmine::AccessControl.map do |map| |
|
27 | Redmine::AccessControl.map do |map| | |
28 | map.permission :view_project, {:projects => [:show, :activity]}, :public => true |
|
28 | map.permission :view_project, {:projects => [:show, :activity]}, :public => true | |
29 | map.permission :search_project, {:search => :index}, :public => true |
|
29 | map.permission :search_project, {:search => :index}, :public => true | |
30 | map.permission :add_project, {:projects => :add}, :require => :loggedin |
|
30 | map.permission :add_project, {:projects => :add}, :require => :loggedin | |
31 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member |
|
31 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member | |
32 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
32 | map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
33 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
33 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member | |
34 | map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :close_completed, :destroy]}, :require => :member |
|
34 | map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :close_completed, :destroy]}, :require => :member | |
35 | map.permission :add_subprojects, {:projects => :add}, :require => :member |
|
35 | map.permission :add_subprojects, {:projects => :add}, :require => :member | |
36 |
|
36 | |||
37 | map.project_module :issue_tracking do |map| |
|
37 | map.project_module :issue_tracking do |map| | |
38 | # Issue categories |
|
38 | # Issue categories | |
39 | map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member |
|
39 | map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member | |
40 | # Issues |
|
40 | # Issues | |
41 | map.permission :view_issues, {:projects => :roadmap, |
|
41 | map.permission :view_issues, {:projects => :roadmap, | |
42 | :issues => [:index, :changes, :show, :context_menu], |
|
42 | :issues => [:index, :changes, :show, :context_menu], | |
43 | :versions => [:show, :status_by], |
|
43 | :versions => [:show, :status_by], | |
44 | :queries => :index, |
|
44 | :queries => :index, | |
45 | :reports => :issue_report} |
|
45 | :reports => [:issue_report, :issue_report_details]} | |
46 | map.permission :add_issues, {:issues => [:new, :update_form]} |
|
46 | map.permission :add_issues, {:issues => [:new, :update_form]} | |
47 | map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]} |
|
47 | map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]} | |
48 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} |
|
48 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} | |
49 | map.permission :add_issue_notes, {:issues => [:edit, :reply]} |
|
49 | map.permission :add_issue_notes, {:issues => [:edit, :reply]} | |
50 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin |
|
50 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin | |
51 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin |
|
51 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin | |
52 | map.permission :move_issues, {:issues => :move}, :require => :loggedin |
|
52 | map.permission :move_issues, {:issues => :move}, :require => :loggedin | |
53 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
53 | map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
54 | # Queries |
|
54 | # Queries | |
55 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member |
|
55 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member | |
56 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin |
|
56 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin | |
57 | # Gantt & calendar |
|
57 | # Gantt & calendar | |
58 | map.permission :view_gantt, :issues => :gantt |
|
58 | map.permission :view_gantt, :issues => :gantt | |
59 | map.permission :view_calendar, :issues => :calendar |
|
59 | map.permission :view_calendar, :issues => :calendar | |
60 | # Watchers |
|
60 | # Watchers | |
61 | map.permission :view_issue_watchers, {} |
|
61 | map.permission :view_issue_watchers, {} | |
62 | map.permission :add_issue_watchers, {:watchers => :new} |
|
62 | map.permission :add_issue_watchers, {:watchers => :new} | |
63 | map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
63 | map.permission :delete_issue_watchers, {:watchers => :destroy} | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | map.project_module :time_tracking do |map| |
|
66 | map.project_module :time_tracking do |map| | |
67 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin |
|
67 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin | |
68 | map.permission :view_time_entries, :timelog => [:details, :report] |
|
68 | map.permission :view_time_entries, :timelog => [:details, :report] | |
69 | map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member |
|
69 | map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member | |
70 | map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin |
|
70 | map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin | |
71 | map.permission :manage_project_activities, {:projects => [:save_activities, :reset_activities]}, :require => :member |
|
71 | map.permission :manage_project_activities, {:projects => [:save_activities, :reset_activities]}, :require => :member | |
72 | end |
|
72 | end | |
73 |
|
73 | |||
74 | map.project_module :news do |map| |
|
74 | map.project_module :news do |map| | |
75 | map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member |
|
75 | map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member | |
76 | map.permission :view_news, {:news => [:index, :show]}, :public => true |
|
76 | map.permission :view_news, {:news => [:index, :show]}, :public => true | |
77 | map.permission :comment_news, {:news => :add_comment} |
|
77 | map.permission :comment_news, {:news => :add_comment} | |
78 | end |
|
78 | end | |
79 |
|
79 | |||
80 | map.project_module :documents do |map| |
|
80 | map.project_module :documents do |map| | |
81 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin |
|
81 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin | |
82 | map.permission :view_documents, :documents => [:index, :show, :download] |
|
82 | map.permission :view_documents, :documents => [:index, :show, :download] | |
83 | end |
|
83 | end | |
84 |
|
84 | |||
85 | map.project_module :files do |map| |
|
85 | map.project_module :files do |map| | |
86 | map.permission :manage_files, {:projects => :add_file}, :require => :loggedin |
|
86 | map.permission :manage_files, {:projects => :add_file}, :require => :loggedin | |
87 | map.permission :view_files, :projects => :list_files, :versions => :download |
|
87 | map.permission :view_files, :projects => :list_files, :versions => :download | |
88 | end |
|
88 | end | |
89 |
|
89 | |||
90 | map.project_module :wiki do |map| |
|
90 | map.project_module :wiki do |map| | |
91 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
|
91 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |
92 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
92 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |
93 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
93 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member | |
94 | map.permission :view_wiki_pages, :wiki => [:index, :special] |
|
94 | map.permission :view_wiki_pages, :wiki => [:index, :special] | |
95 | map.permission :export_wiki_pages, {} |
|
95 | map.permission :export_wiki_pages, {} | |
96 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] |
|
96 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] | |
97 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] |
|
97 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] | |
98 | map.permission :delete_wiki_pages_attachments, {} |
|
98 | map.permission :delete_wiki_pages_attachments, {} | |
99 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
99 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member | |
100 | end |
|
100 | end | |
101 |
|
101 | |||
102 | map.project_module :repository do |map| |
|
102 | map.project_module :repository do |map| | |
103 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member |
|
103 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member | |
104 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] |
|
104 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] | |
105 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
105 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] | |
106 | map.permission :commit_access, {} |
|
106 | map.permission :commit_access, {} | |
107 | end |
|
107 | end | |
108 |
|
108 | |||
109 | map.project_module :boards do |map| |
|
109 | map.project_module :boards do |map| | |
110 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member |
|
110 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member | |
111 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
111 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true | |
112 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} |
|
112 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} | |
113 | map.permission :edit_messages, {:messages => :edit}, :require => :member |
|
113 | map.permission :edit_messages, {:messages => :edit}, :require => :member | |
114 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin |
|
114 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin | |
115 | map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
115 | map.permission :delete_messages, {:messages => :destroy}, :require => :member | |
116 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
116 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin | |
117 | end |
|
117 | end | |
118 | end |
|
118 | end | |
119 |
|
119 | |||
120 | Redmine::MenuManager.map :top_menu do |menu| |
|
120 | Redmine::MenuManager.map :top_menu do |menu| | |
121 | menu.push :home, :home_path |
|
121 | menu.push :home, :home_path | |
122 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } |
|
122 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } | |
123 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural |
|
123 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural | |
124 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true |
|
124 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true | |
125 | menu.push :help, Redmine::Info.help_url, :last => true |
|
125 | menu.push :help, Redmine::Info.help_url, :last => true | |
126 | end |
|
126 | end | |
127 |
|
127 | |||
128 | Redmine::MenuManager.map :account_menu do |menu| |
|
128 | Redmine::MenuManager.map :account_menu do |menu| | |
129 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } |
|
129 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } | |
130 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } |
|
130 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } | |
131 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } |
|
131 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } | |
132 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } |
|
132 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } | |
133 | end |
|
133 | end | |
134 |
|
134 | |||
135 | Redmine::MenuManager.map :application_menu do |menu| |
|
135 | Redmine::MenuManager.map :application_menu do |menu| | |
136 | # Empty |
|
136 | # Empty | |
137 | end |
|
137 | end | |
138 |
|
138 | |||
139 | Redmine::MenuManager.map :admin_menu do |menu| |
|
139 | Redmine::MenuManager.map :admin_menu do |menu| | |
140 | # Empty |
|
140 | # Empty | |
141 | end |
|
141 | end | |
142 |
|
142 | |||
143 | Redmine::MenuManager.map :project_menu do |menu| |
|
143 | Redmine::MenuManager.map :project_menu do |menu| | |
144 | menu.push :overview, { :controller => 'projects', :action => 'show' } |
|
144 | menu.push :overview, { :controller => 'projects', :action => 'show' } | |
145 | menu.push :activity, { :controller => 'projects', :action => 'activity' } |
|
145 | menu.push :activity, { :controller => 'projects', :action => 'activity' } | |
146 | menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' }, |
|
146 | menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' }, | |
147 | :if => Proc.new { |p| p.shared_versions.any? } |
|
147 | :if => Proc.new { |p| p.shared_versions.any? } | |
148 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural |
|
148 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural | |
149 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, |
|
149 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, | |
150 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } |
|
150 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } | |
151 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
151 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural | |
152 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
152 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural | |
153 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, |
|
153 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, | |
154 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } |
|
154 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } | |
155 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, |
|
155 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, | |
156 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural |
|
156 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural | |
157 | menu.push :files, { :controller => 'projects', :action => 'list_files' }, :caption => :label_file_plural |
|
157 | menu.push :files, { :controller => 'projects', :action => 'list_files' }, :caption => :label_file_plural | |
158 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, |
|
158 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, | |
159 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } |
|
159 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } | |
160 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true |
|
160 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true | |
161 | end |
|
161 | end | |
162 |
|
162 | |||
163 | Redmine::Activity.map do |activity| |
|
163 | Redmine::Activity.map do |activity| | |
164 | activity.register :issues, :class_name => %w(Issue Journal) |
|
164 | activity.register :issues, :class_name => %w(Issue Journal) | |
165 | activity.register :changesets |
|
165 | activity.register :changesets | |
166 | activity.register :news |
|
166 | activity.register :news | |
167 | activity.register :documents, :class_name => %w(Document Attachment) |
|
167 | activity.register :documents, :class_name => %w(Document Attachment) | |
168 | activity.register :files, :class_name => 'Attachment' |
|
168 | activity.register :files, :class_name => 'Attachment' | |
169 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false |
|
169 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false | |
170 | activity.register :messages, :default => false |
|
170 | activity.register :messages, :default => false | |
171 | activity.register :time_entries, :default => false |
|
171 | activity.register :time_entries, :default => false | |
172 | end |
|
172 | end | |
173 |
|
173 | |||
174 | Redmine::WikiFormatting.map do |format| |
|
174 | Redmine::WikiFormatting.map do |format| | |
175 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper |
|
175 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper | |
176 | end |
|
176 | end |
@@ -1,59 +1,79 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2009 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2009 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'reports_controller' |
|
19 | require 'reports_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class ReportsController; def rescue_action(e) raise e end; end |
|
22 | class ReportsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | class ReportsControllerTest < ActionController::TestCase |
|
25 | class ReportsControllerTest < ActionController::TestCase | |
26 | fixtures :all |
|
26 | fixtures :all | |
27 |
|
27 | |||
28 | def setup |
|
28 | def setup | |
29 | @controller = ReportsController.new |
|
29 | @controller = ReportsController.new | |
30 | @request = ActionController::TestRequest.new |
|
30 | @request = ActionController::TestRequest.new | |
31 | @response = ActionController::TestResponse.new |
|
31 | @response = ActionController::TestResponse.new | |
32 | User.current = nil |
|
32 | User.current = nil | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | context "GET :issue_report without details" do |
|
35 | context "GET :issue_report without details" do | |
36 | setup do |
|
36 | setup do | |
37 | get :issue_report, :id => 1 |
|
37 | get :issue_report, :id => 1 | |
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | should_respond_with :success |
|
40 | should_respond_with :success | |
41 | should_render_template :issue_report |
|
41 | should_render_template :issue_report | |
42 |
|
42 | |||
43 | [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to, |
|
43 | [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to, | |
44 | :issues_by_author, :issues_by_subproject].each do |ivar| |
|
44 | :issues_by_author, :issues_by_subproject].each do |ivar| | |
45 | should_assign_to ivar |
|
45 | should_assign_to ivar | |
46 | should "set a value for #{ivar}" do |
|
46 | should "set a value for #{ivar}" do | |
47 | assert assigns[ivar.to_s].present? |
|
47 | assert assigns[ivar.to_s].present? | |
48 | end |
|
48 | end | |
49 | end |
|
49 | end | |
50 | end |
|
50 | end | |
51 |
|
51 | |||
52 |
|
|
52 | context "GET :issue_report_details" do | |
53 | %w(tracker version priority category assigned_to author subproject).each do |detail| |
|
53 | %w(tracker version priority category assigned_to author subproject).each do |detail| | |
54 | get :issue_report, :id => 1, :detail => detail |
|
54 | context "for #{detail}" do | |
55 | assert_response :success |
|
55 | setup do | |
56 | assert_template 'issue_report_details' |
|
56 | get :issue_report_details, :id => 1, :detail => detail | |
|
57 | end | |||
|
58 | ||||
|
59 | should_respond_with :success | |||
|
60 | should_render_template :issue_report_details | |||
|
61 | should_assign_to :field | |||
|
62 | should_assign_to :rows | |||
|
63 | should_assign_to :data | |||
|
64 | should_assign_to :report_title | |||
|
65 | end | |||
57 | end |
|
66 | end | |
|
67 | ||||
|
68 | context "with an invalid detail" do | |||
|
69 | setup do | |||
|
70 | get :issue_report_details, :id => 1, :detail => 'invalid' | |||
|
71 | end | |||
|
72 | ||||
|
73 | should_respond_with :redirect | |||
|
74 | should_redirect_to('the issue report') {{:controller => 'reports', :action => 'issue_report', :id => 'ecookbook'}} | |||
|
75 | end | |||
|
76 | ||||
58 | end |
|
77 | end | |
|
78 | ||||
59 | end |
|
79 | end |
@@ -1,26 +1,26 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2010 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require "test_helper" |
|
18 | require "test_helper" | |
19 |
|
19 | |||
20 | class RoutingTest < ActionController::IntegrationTest |
|
20 | class RoutingTest < ActionController::IntegrationTest | |
21 | context "issue reports" do |
|
21 | context "issue reports" do | |
22 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' |
|
22 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' | |
23 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report', :id => '567', :detail => 'assigned_to' |
|
23 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' | |
24 | end |
|
24 | end | |
25 |
|
25 | |||
26 | end |
|
26 | end |
General Comments 0
You need to be logged in to leave comments.
Login now