@@ -1,324 +1,334 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class TimelogController < ApplicationController |
|
18 | class TimelogController < ApplicationController | |
19 | menu_item :issues |
|
19 | menu_item :issues | |
20 | before_filter :find_project, :only => [:new, :create] |
|
20 | before_filter :find_project, :only => [:new, :create] | |
21 | before_filter :find_time_entry, :only => [:show, :edit, :update] |
|
21 | before_filter :find_time_entry, :only => [:show, :edit, :update] | |
22 | before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy] |
|
22 | before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy] | |
23 | before_filter :authorize, :except => [:index] |
|
23 | before_filter :authorize, :except => [:index, :report] | |
24 | before_filter :find_optional_project, :only => [:index] |
|
24 | before_filter :find_optional_project, :only => [:index, :report] | |
25 | accept_rss_auth :index |
|
25 | accept_rss_auth :index | |
26 | accept_api_auth :index, :show, :create, :update, :destroy |
|
26 | accept_api_auth :index, :show, :create, :update, :destroy | |
27 |
|
27 | |||
28 | helper :sort |
|
28 | helper :sort | |
29 | include SortHelper |
|
29 | include SortHelper | |
30 | helper :issues |
|
30 | helper :issues | |
31 | include TimelogHelper |
|
31 | include TimelogHelper | |
32 | helper :custom_fields |
|
32 | helper :custom_fields | |
33 | include CustomFieldsHelper |
|
33 | include CustomFieldsHelper | |
34 |
|
34 | |||
35 | def index |
|
35 | def index | |
36 | sort_init 'spent_on', 'desc' |
|
36 | sort_init 'spent_on', 'desc' | |
37 | sort_update 'spent_on' => 'spent_on', |
|
37 | sort_update 'spent_on' => 'spent_on', | |
38 | 'user' => 'user_id', |
|
38 | 'user' => 'user_id', | |
39 | 'activity' => 'activity_id', |
|
39 | 'activity' => 'activity_id', | |
40 | 'project' => "#{Project.table_name}.name", |
|
40 | 'project' => "#{Project.table_name}.name", | |
41 | 'issue' => 'issue_id', |
|
41 | 'issue' => 'issue_id', | |
42 | 'hours' => 'hours' |
|
42 | 'hours' => 'hours' | |
43 |
|
43 | |||
44 | cond = ARCondition.new |
|
44 | cond = ARCondition.new | |
45 | if @issue |
|
45 | if @issue | |
46 | cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" |
|
46 | cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" | |
47 | elsif @project |
|
47 | elsif @project | |
48 | cond << @project.project_condition(Setting.display_subprojects_issues?) |
|
48 | cond << @project.project_condition(Setting.display_subprojects_issues?) | |
49 | end |
|
49 | end | |
50 |
|
50 | |||
51 | retrieve_date_range |
|
51 | retrieve_date_range | |
52 | cond << ['spent_on BETWEEN ? AND ?', @from, @to] |
|
52 | cond << ['spent_on BETWEEN ? AND ?', @from, @to] | |
53 |
|
53 | |||
54 | respond_to do |format| |
|
54 | respond_to do |format| | |
55 | format.html { |
|
55 | format.html { | |
56 | # Paginate results |
|
56 | # Paginate results | |
57 | @entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions) |
|
57 | @entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions) | |
58 | @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] |
|
58 | @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] | |
59 | @entries = TimeEntry.visible.find(:all, |
|
59 | @entries = TimeEntry.visible.find(:all, | |
60 | :include => [:project, :activity, :user, {:issue => :tracker}], |
|
60 | :include => [:project, :activity, :user, {:issue => :tracker}], | |
61 | :conditions => cond.conditions, |
|
61 | :conditions => cond.conditions, | |
62 | :order => sort_clause, |
|
62 | :order => sort_clause, | |
63 | :limit => @entry_pages.items_per_page, |
|
63 | :limit => @entry_pages.items_per_page, | |
64 | :offset => @entry_pages.current.offset) |
|
64 | :offset => @entry_pages.current.offset) | |
65 | @total_hours = TimeEntry.visible.sum(:hours, :include => [:project, :issue], :conditions => cond.conditions).to_f |
|
65 | @total_hours = TimeEntry.visible.sum(:hours, :include => [:project, :issue], :conditions => cond.conditions).to_f | |
66 |
|
66 | |||
67 | render :layout => !request.xhr? |
|
67 | render :layout => !request.xhr? | |
68 | } |
|
68 | } | |
69 | format.api { |
|
69 | format.api { | |
70 | @entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions) |
|
70 | @entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions) | |
71 | @offset, @limit = api_offset_and_limit |
|
71 | @offset, @limit = api_offset_and_limit | |
72 | @entries = TimeEntry.visible.find(:all, |
|
72 | @entries = TimeEntry.visible.find(:all, | |
73 | :include => [:project, :activity, :user, {:issue => :tracker}], |
|
73 | :include => [:project, :activity, :user, {:issue => :tracker}], | |
74 | :conditions => cond.conditions, |
|
74 | :conditions => cond.conditions, | |
75 | :order => sort_clause, |
|
75 | :order => sort_clause, | |
76 | :limit => @limit, |
|
76 | :limit => @limit, | |
77 | :offset => @offset) |
|
77 | :offset => @offset) | |
78 | } |
|
78 | } | |
79 | format.atom { |
|
79 | format.atom { | |
80 | entries = TimeEntry.visible.find(:all, |
|
80 | entries = TimeEntry.visible.find(:all, | |
81 | :include => [:project, :activity, :user, {:issue => :tracker}], |
|
81 | :include => [:project, :activity, :user, {:issue => :tracker}], | |
82 | :conditions => cond.conditions, |
|
82 | :conditions => cond.conditions, | |
83 | :order => "#{TimeEntry.table_name}.created_on DESC", |
|
83 | :order => "#{TimeEntry.table_name}.created_on DESC", | |
84 | :limit => Setting.feeds_limit.to_i) |
|
84 | :limit => Setting.feeds_limit.to_i) | |
85 | render_feed(entries, :title => l(:label_spent_time)) |
|
85 | render_feed(entries, :title => l(:label_spent_time)) | |
86 | } |
|
86 | } | |
87 | format.csv { |
|
87 | format.csv { | |
88 | # Export all entries |
|
88 | # Export all entries | |
89 | @entries = TimeEntry.visible.find(:all, |
|
89 | @entries = TimeEntry.visible.find(:all, | |
90 | :include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}], |
|
90 | :include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}], | |
91 | :conditions => cond.conditions, |
|
91 | :conditions => cond.conditions, | |
92 | :order => sort_clause) |
|
92 | :order => sort_clause) | |
93 | send_data(entries_to_csv(@entries), :type => 'text/csv; header=present', :filename => 'timelog.csv') |
|
93 | send_data(entries_to_csv(@entries), :type => 'text/csv; header=present', :filename => 'timelog.csv') | |
94 | } |
|
94 | } | |
95 | end |
|
95 | end | |
96 | end |
|
96 | end | |
97 |
|
97 | |||
|
98 | def report | |||
|
99 | retrieve_date_range | |||
|
100 | @report = Redmine::Helpers::TimeReport.new(@project, @issue, params[:criteria], params[:columns], @from, @to) | |||
|
101 | ||||
|
102 | respond_to do |format| | |||
|
103 | format.html { render :layout => !request.xhr? } | |||
|
104 | format.csv { send_data(report_to_csv(@report), :type => 'text/csv; header=present', :filename => 'timelog.csv') } | |||
|
105 | end | |||
|
106 | end | |||
|
107 | ||||
98 | def show |
|
108 | def show | |
99 | respond_to do |format| |
|
109 | respond_to do |format| | |
100 | # TODO: Implement html response |
|
110 | # TODO: Implement html response | |
101 | format.html { render :nothing => true, :status => 406 } |
|
111 | format.html { render :nothing => true, :status => 406 } | |
102 | format.api |
|
112 | format.api | |
103 | end |
|
113 | end | |
104 | end |
|
114 | end | |
105 |
|
115 | |||
106 | def new |
|
116 | def new | |
107 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) |
|
117 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) | |
108 | @time_entry.attributes = params[:time_entry] |
|
118 | @time_entry.attributes = params[:time_entry] | |
109 |
|
119 | |||
110 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
|
120 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | |
111 | render :action => 'edit' |
|
121 | render :action => 'edit' | |
112 | end |
|
122 | end | |
113 |
|
123 | |||
114 | verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } |
|
124 | verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } | |
115 | def create |
|
125 | def create | |
116 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) |
|
126 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) | |
117 | @time_entry.attributes = params[:time_entry] |
|
127 | @time_entry.attributes = params[:time_entry] | |
118 |
|
128 | |||
119 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
|
129 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | |
120 |
|
130 | |||
121 | if @time_entry.save |
|
131 | if @time_entry.save | |
122 | respond_to do |format| |
|
132 | respond_to do |format| | |
123 | format.html { |
|
133 | format.html { | |
124 | flash[:notice] = l(:notice_successful_update) |
|
134 | flash[:notice] = l(:notice_successful_update) | |
125 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project |
|
135 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project | |
126 | } |
|
136 | } | |
127 | format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) } |
|
137 | format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) } | |
128 | end |
|
138 | end | |
129 | else |
|
139 | else | |
130 | respond_to do |format| |
|
140 | respond_to do |format| | |
131 | format.html { render :action => 'edit' } |
|
141 | format.html { render :action => 'edit' } | |
132 | format.api { render_validation_errors(@time_entry) } |
|
142 | format.api { render_validation_errors(@time_entry) } | |
133 | end |
|
143 | end | |
134 | end |
|
144 | end | |
135 | end |
|
145 | end | |
136 |
|
146 | |||
137 | def edit |
|
147 | def edit | |
138 | @time_entry.attributes = params[:time_entry] |
|
148 | @time_entry.attributes = params[:time_entry] | |
139 |
|
149 | |||
140 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
|
150 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | |
141 | end |
|
151 | end | |
142 |
|
152 | |||
143 | verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } |
|
153 | verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } | |
144 | def update |
|
154 | def update | |
145 | @time_entry.attributes = params[:time_entry] |
|
155 | @time_entry.attributes = params[:time_entry] | |
146 |
|
156 | |||
147 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
|
157 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | |
148 |
|
158 | |||
149 | if @time_entry.save |
|
159 | if @time_entry.save | |
150 | respond_to do |format| |
|
160 | respond_to do |format| | |
151 | format.html { |
|
161 | format.html { | |
152 | flash[:notice] = l(:notice_successful_update) |
|
162 | flash[:notice] = l(:notice_successful_update) | |
153 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project |
|
163 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project | |
154 | } |
|
164 | } | |
155 | format.api { head :ok } |
|
165 | format.api { head :ok } | |
156 | end |
|
166 | end | |
157 | else |
|
167 | else | |
158 | respond_to do |format| |
|
168 | respond_to do |format| | |
159 | format.html { render :action => 'edit' } |
|
169 | format.html { render :action => 'edit' } | |
160 | format.api { render_validation_errors(@time_entry) } |
|
170 | format.api { render_validation_errors(@time_entry) } | |
161 | end |
|
171 | end | |
162 | end |
|
172 | end | |
163 | end |
|
173 | end | |
164 |
|
174 | |||
165 | def bulk_edit |
|
175 | def bulk_edit | |
166 | @available_activities = TimeEntryActivity.shared.active |
|
176 | @available_activities = TimeEntryActivity.shared.active | |
167 | @custom_fields = TimeEntry.first.available_custom_fields |
|
177 | @custom_fields = TimeEntry.first.available_custom_fields | |
168 | end |
|
178 | end | |
169 |
|
179 | |||
170 | def bulk_update |
|
180 | def bulk_update | |
171 | attributes = parse_params_for_bulk_time_entry_attributes(params) |
|
181 | attributes = parse_params_for_bulk_time_entry_attributes(params) | |
172 |
|
182 | |||
173 | unsaved_time_entry_ids = [] |
|
183 | unsaved_time_entry_ids = [] | |
174 | @time_entries.each do |time_entry| |
|
184 | @time_entries.each do |time_entry| | |
175 | time_entry.reload |
|
185 | time_entry.reload | |
176 | time_entry.attributes = attributes |
|
186 | time_entry.attributes = attributes | |
177 | call_hook(:controller_time_entries_bulk_edit_before_save, { :params => params, :time_entry => time_entry }) |
|
187 | call_hook(:controller_time_entries_bulk_edit_before_save, { :params => params, :time_entry => time_entry }) | |
178 | unless time_entry.save |
|
188 | unless time_entry.save | |
179 | # Keep unsaved time_entry ids to display them in flash error |
|
189 | # Keep unsaved time_entry ids to display them in flash error | |
180 | unsaved_time_entry_ids << time_entry.id |
|
190 | unsaved_time_entry_ids << time_entry.id | |
181 | end |
|
191 | end | |
182 | end |
|
192 | end | |
183 | set_flash_from_bulk_time_entry_save(@time_entries, unsaved_time_entry_ids) |
|
193 | set_flash_from_bulk_time_entry_save(@time_entries, unsaved_time_entry_ids) | |
184 | redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @projects.first}) |
|
194 | redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @projects.first}) | |
185 | end |
|
195 | end | |
186 |
|
196 | |||
187 | verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed } |
|
197 | verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed } | |
188 | def destroy |
|
198 | def destroy | |
189 | @time_entries.each do |t| |
|
199 | @time_entries.each do |t| | |
190 | begin |
|
200 | begin | |
191 | unless t.destroy && t.destroyed? |
|
201 | unless t.destroy && t.destroyed? | |
192 | respond_to do |format| |
|
202 | respond_to do |format| | |
193 | format.html { |
|
203 | format.html { | |
194 | flash[:error] = l(:notice_unable_delete_time_entry) |
|
204 | flash[:error] = l(:notice_unable_delete_time_entry) | |
195 | redirect_to :back |
|
205 | redirect_to :back | |
196 | } |
|
206 | } | |
197 | format.api { render_validation_errors(t) } |
|
207 | format.api { render_validation_errors(t) } | |
198 | end |
|
208 | end | |
199 | return |
|
209 | return | |
200 | end |
|
210 | end | |
201 | rescue ::ActionController::RedirectBackError |
|
211 | rescue ::ActionController::RedirectBackError | |
202 | redirect_to :action => 'index', :project_id => @projects.first |
|
212 | redirect_to :action => 'index', :project_id => @projects.first | |
203 | return |
|
213 | return | |
204 | end |
|
214 | end | |
205 | end |
|
215 | end | |
206 |
|
216 | |||
207 | respond_to do |format| |
|
217 | respond_to do |format| | |
208 | format.html { |
|
218 | format.html { | |
209 | flash[:notice] = l(:notice_successful_delete) |
|
219 | flash[:notice] = l(:notice_successful_delete) | |
210 | redirect_back_or_default(:action => 'index', :project_id => @projects.first) |
|
220 | redirect_back_or_default(:action => 'index', :project_id => @projects.first) | |
211 | } |
|
221 | } | |
212 | format.api { head :ok } |
|
222 | format.api { head :ok } | |
213 | end |
|
223 | end | |
214 | end |
|
224 | end | |
215 |
|
225 | |||
216 | private |
|
226 | private | |
217 | def find_time_entry |
|
227 | def find_time_entry | |
218 | @time_entry = TimeEntry.find(params[:id]) |
|
228 | @time_entry = TimeEntry.find(params[:id]) | |
219 | unless @time_entry.editable_by?(User.current) |
|
229 | unless @time_entry.editable_by?(User.current) | |
220 | render_403 |
|
230 | render_403 | |
221 | return false |
|
231 | return false | |
222 | end |
|
232 | end | |
223 | @project = @time_entry.project |
|
233 | @project = @time_entry.project | |
224 | rescue ActiveRecord::RecordNotFound |
|
234 | rescue ActiveRecord::RecordNotFound | |
225 | render_404 |
|
235 | render_404 | |
226 | end |
|
236 | end | |
227 |
|
237 | |||
228 | def find_time_entries |
|
238 | def find_time_entries | |
229 | @time_entries = TimeEntry.find_all_by_id(params[:id] || params[:ids]) |
|
239 | @time_entries = TimeEntry.find_all_by_id(params[:id] || params[:ids]) | |
230 | raise ActiveRecord::RecordNotFound if @time_entries.empty? |
|
240 | raise ActiveRecord::RecordNotFound if @time_entries.empty? | |
231 | @projects = @time_entries.collect(&:project).compact.uniq |
|
241 | @projects = @time_entries.collect(&:project).compact.uniq | |
232 | @project = @projects.first if @projects.size == 1 |
|
242 | @project = @projects.first if @projects.size == 1 | |
233 | rescue ActiveRecord::RecordNotFound |
|
243 | rescue ActiveRecord::RecordNotFound | |
234 | render_404 |
|
244 | render_404 | |
235 | end |
|
245 | end | |
236 |
|
246 | |||
237 | def set_flash_from_bulk_time_entry_save(time_entries, unsaved_time_entry_ids) |
|
247 | def set_flash_from_bulk_time_entry_save(time_entries, unsaved_time_entry_ids) | |
238 | if unsaved_time_entry_ids.empty? |
|
248 | if unsaved_time_entry_ids.empty? | |
239 | flash[:notice] = l(:notice_successful_update) unless time_entries.empty? |
|
249 | flash[:notice] = l(:notice_successful_update) unless time_entries.empty? | |
240 | else |
|
250 | else | |
241 | flash[:error] = l(:notice_failed_to_save_time_entries, |
|
251 | flash[:error] = l(:notice_failed_to_save_time_entries, | |
242 | :count => unsaved_time_entry_ids.size, |
|
252 | :count => unsaved_time_entry_ids.size, | |
243 | :total => time_entries.size, |
|
253 | :total => time_entries.size, | |
244 | :ids => '#' + unsaved_time_entry_ids.join(', #')) |
|
254 | :ids => '#' + unsaved_time_entry_ids.join(', #')) | |
245 | end |
|
255 | end | |
246 | end |
|
256 | end | |
247 |
|
257 | |||
248 | def find_project |
|
258 | def find_project | |
249 | if (issue_id = (params[:issue_id] || params[:time_entry] && params[:time_entry][:issue_id])).present? |
|
259 | if (issue_id = (params[:issue_id] || params[:time_entry] && params[:time_entry][:issue_id])).present? | |
250 | @issue = Issue.find(issue_id) |
|
260 | @issue = Issue.find(issue_id) | |
251 | @project = @issue.project |
|
261 | @project = @issue.project | |
252 | elsif (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present? |
|
262 | elsif (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present? | |
253 | @project = Project.find(project_id) |
|
263 | @project = Project.find(project_id) | |
254 | else |
|
264 | else | |
255 | render_404 |
|
265 | render_404 | |
256 | return false |
|
266 | return false | |
257 | end |
|
267 | end | |
258 | rescue ActiveRecord::RecordNotFound |
|
268 | rescue ActiveRecord::RecordNotFound | |
259 | render_404 |
|
269 | render_404 | |
260 | end |
|
270 | end | |
261 |
|
271 | |||
262 | def find_optional_project |
|
272 | def find_optional_project | |
263 | if !params[:issue_id].blank? |
|
273 | if !params[:issue_id].blank? | |
264 | @issue = Issue.find(params[:issue_id]) |
|
274 | @issue = Issue.find(params[:issue_id]) | |
265 | @project = @issue.project |
|
275 | @project = @issue.project | |
266 | elsif !params[:project_id].blank? |
|
276 | elsif !params[:project_id].blank? | |
267 | @project = Project.find(params[:project_id]) |
|
277 | @project = Project.find(params[:project_id]) | |
268 | end |
|
278 | end | |
269 | deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true) |
|
279 | deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true) | |
270 | end |
|
280 | end | |
271 |
|
281 | |||
272 | # Retrieves the date range based on predefined ranges or specific from/to param dates |
|
282 | # Retrieves the date range based on predefined ranges or specific from/to param dates | |
273 | def retrieve_date_range |
|
283 | def retrieve_date_range | |
274 | @free_period = false |
|
284 | @free_period = false | |
275 | @from, @to = nil, nil |
|
285 | @from, @to = nil, nil | |
276 |
|
286 | |||
277 | if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?) |
|
287 | if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?) | |
278 | case params[:period].to_s |
|
288 | case params[:period].to_s | |
279 | when 'today' |
|
289 | when 'today' | |
280 | @from = @to = Date.today |
|
290 | @from = @to = Date.today | |
281 | when 'yesterday' |
|
291 | when 'yesterday' | |
282 | @from = @to = Date.today - 1 |
|
292 | @from = @to = Date.today - 1 | |
283 | when 'current_week' |
|
293 | when 'current_week' | |
284 | @from = Date.today - (Date.today.cwday - 1)%7 |
|
294 | @from = Date.today - (Date.today.cwday - 1)%7 | |
285 | @to = @from + 6 |
|
295 | @to = @from + 6 | |
286 | when 'last_week' |
|
296 | when 'last_week' | |
287 | @from = Date.today - 7 - (Date.today.cwday - 1)%7 |
|
297 | @from = Date.today - 7 - (Date.today.cwday - 1)%7 | |
288 | @to = @from + 6 |
|
298 | @to = @from + 6 | |
289 | when '7_days' |
|
299 | when '7_days' | |
290 | @from = Date.today - 7 |
|
300 | @from = Date.today - 7 | |
291 | @to = Date.today |
|
301 | @to = Date.today | |
292 | when 'current_month' |
|
302 | when 'current_month' | |
293 | @from = Date.civil(Date.today.year, Date.today.month, 1) |
|
303 | @from = Date.civil(Date.today.year, Date.today.month, 1) | |
294 | @to = (@from >> 1) - 1 |
|
304 | @to = (@from >> 1) - 1 | |
295 | when 'last_month' |
|
305 | when 'last_month' | |
296 | @from = Date.civil(Date.today.year, Date.today.month, 1) << 1 |
|
306 | @from = Date.civil(Date.today.year, Date.today.month, 1) << 1 | |
297 | @to = (@from >> 1) - 1 |
|
307 | @to = (@from >> 1) - 1 | |
298 | when '30_days' |
|
308 | when '30_days' | |
299 | @from = Date.today - 30 |
|
309 | @from = Date.today - 30 | |
300 | @to = Date.today |
|
310 | @to = Date.today | |
301 | when 'current_year' |
|
311 | when 'current_year' | |
302 | @from = Date.civil(Date.today.year, 1, 1) |
|
312 | @from = Date.civil(Date.today.year, 1, 1) | |
303 | @to = Date.civil(Date.today.year, 12, 31) |
|
313 | @to = Date.civil(Date.today.year, 12, 31) | |
304 | end |
|
314 | end | |
305 | elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?)) |
|
315 | elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?)) | |
306 | begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end |
|
316 | begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end | |
307 | begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end |
|
317 | begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end | |
308 | @free_period = true |
|
318 | @free_period = true | |
309 | else |
|
319 | else | |
310 | # default |
|
320 | # default | |
311 | end |
|
321 | end | |
312 |
|
322 | |||
313 | @from, @to = @to, @from if @from && @to && @from > @to |
|
323 | @from, @to = @to, @from if @from && @to && @from > @to | |
314 | @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today) |
|
324 | @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today) | |
315 | @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today) |
|
325 | @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today) | |
316 | end |
|
326 | end | |
317 |
|
327 | |||
318 | def parse_params_for_bulk_time_entry_attributes(params) |
|
328 | def parse_params_for_bulk_time_entry_attributes(params) | |
319 | attributes = (params[:time_entry] || {}).reject {|k,v| v.blank?} |
|
329 | attributes = (params[:time_entry] || {}).reject {|k,v| v.blank?} | |
320 | attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'} |
|
330 | attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'} | |
321 | attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values] |
|
331 | attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values] | |
322 | attributes |
|
332 | attributes | |
323 | end |
|
333 | end | |
324 | end |
|
334 | end |
@@ -1,80 +1,80 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <% if User.current.allowed_to?(:add_subprojects, @project) %> |
|
2 | <% if User.current.allowed_to?(:add_subprojects, @project) %> | |
3 | <%= link_to l(:label_subproject_new), {:controller => 'projects', :action => 'new', :parent_id => @project}, :class => 'icon icon-add' %> |
|
3 | <%= link_to l(:label_subproject_new), {:controller => 'projects', :action => 'new', :parent_id => @project}, :class => 'icon icon-add' %> | |
4 | <% end %> |
|
4 | <% end %> | |
5 | </div> |
|
5 | </div> | |
6 |
|
6 | |||
7 | <h2><%=l(:label_overview)%></h2> |
|
7 | <h2><%=l(:label_overview)%></h2> | |
8 |
|
8 | |||
9 | <div class="splitcontentleft"> |
|
9 | <div class="splitcontentleft"> | |
10 | <div class="wiki"> |
|
10 | <div class="wiki"> | |
11 | <%= textilizable @project.description %> |
|
11 | <%= textilizable @project.description %> | |
12 | </div> |
|
12 | </div> | |
13 | <ul> |
|
13 | <ul> | |
14 | <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %> |
|
14 | <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %> | |
15 | <% if @subprojects.any? %> |
|
15 | <% if @subprojects.any? %> | |
16 | <li><%=l(:label_subproject_plural)%>: |
|
16 | <li><%=l(:label_subproject_plural)%>: | |
17 | <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ").html_safe %></li> |
|
17 | <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ").html_safe %></li> | |
18 | <% end %> |
|
18 | <% end %> | |
19 | <% @project.visible_custom_field_values.each do |custom_value| %> |
|
19 | <% @project.visible_custom_field_values.each do |custom_value| %> | |
20 | <% if !custom_value.value.blank? %> |
|
20 | <% if !custom_value.value.blank? %> | |
21 | <li><%=h custom_value.custom_field.name %>: <%=h show_value(custom_value) %></li> |
|
21 | <li><%=h custom_value.custom_field.name %>: <%=h show_value(custom_value) %></li> | |
22 | <% end %> |
|
22 | <% end %> | |
23 | <% end %> |
|
23 | <% end %> | |
24 | </ul> |
|
24 | </ul> | |
25 |
|
25 | |||
26 | <% if User.current.allowed_to?(:view_issues, @project) %> |
|
26 | <% if User.current.allowed_to?(:view_issues, @project) %> | |
27 | <div class="issues box"> |
|
27 | <div class="issues box"> | |
28 | <h3><%=l(:label_issue_tracking)%></h3> |
|
28 | <h3><%=l(:label_issue_tracking)%></h3> | |
29 | <ul> |
|
29 | <ul> | |
30 | <% for tracker in @trackers %> |
|
30 | <% for tracker in @trackers %> | |
31 | <li><%= link_to h(tracker.name), :controller => 'issues', :action => 'index', :project_id => @project, |
|
31 | <li><%= link_to h(tracker.name), :controller => 'issues', :action => 'index', :project_id => @project, | |
32 | :set_filter => 1, |
|
32 | :set_filter => 1, | |
33 | "tracker_id" => tracker.id %>: |
|
33 | "tracker_id" => tracker.id %>: | |
34 | <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, |
|
34 | <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, | |
35 | :total => @total_issues_by_tracker[tracker].to_i) %> |
|
35 | :total => @total_issues_by_tracker[tracker].to_i) %> | |
36 | </li> |
|
36 | </li> | |
37 | <% end %> |
|
37 | <% end %> | |
38 | </ul> |
|
38 | </ul> | |
39 | <p> |
|
39 | <p> | |
40 | <%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %> |
|
40 | <%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %> | |
41 | <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %> |
|
41 | <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %> | |
42 | | <%= link_to(l(:label_calendar), :controller => 'calendars', :action => 'show', :project_id => @project) %> |
|
42 | | <%= link_to(l(:label_calendar), :controller => 'calendars', :action => 'show', :project_id => @project) %> | |
43 | <% end %> |
|
43 | <% end %> | |
44 | <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %> |
|
44 | <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %> | |
45 | | <%= link_to(l(:label_gantt), :controller => 'gantts', :action => 'show', :project_id => @project) %> |
|
45 | | <%= link_to(l(:label_gantt), :controller => 'gantts', :action => 'show', :project_id => @project) %> | |
46 | <% end %> |
|
46 | <% end %> | |
47 | </p> |
|
47 | </p> | |
48 | </div> |
|
48 | </div> | |
49 | <% end %> |
|
49 | <% end %> | |
50 | <%= call_hook(:view_projects_show_left, :project => @project) %> |
|
50 | <%= call_hook(:view_projects_show_left, :project => @project) %> | |
51 | </div> |
|
51 | </div> | |
52 |
|
52 | |||
53 | <div class="splitcontentright"> |
|
53 | <div class="splitcontentright"> | |
54 | <%= render :partial => 'members_box' %> |
|
54 | <%= render :partial => 'members_box' %> | |
55 |
|
55 | |||
56 | <% if @news.any? && authorize_for('news', 'index') %> |
|
56 | <% if @news.any? && authorize_for('news', 'index') %> | |
57 | <div class="news box"> |
|
57 | <div class="news box"> | |
58 | <h3><%=l(:label_news_latest)%></h3> |
|
58 | <h3><%=l(:label_news_latest)%></h3> | |
59 | <%= render :partial => 'news/news', :collection => @news %> |
|
59 | <%= render :partial => 'news/news', :collection => @news %> | |
60 | <p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p> |
|
60 | <p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p> | |
61 | </div> |
|
61 | </div> | |
62 | <% end %> |
|
62 | <% end %> | |
63 | <%= call_hook(:view_projects_show_right, :project => @project) %> |
|
63 | <%= call_hook(:view_projects_show_right, :project => @project) %> | |
64 | </div> |
|
64 | </div> | |
65 |
|
65 | |||
66 | <% content_for :sidebar do %> |
|
66 | <% content_for :sidebar do %> | |
67 | <% if @total_hours.present? %> |
|
67 | <% if @total_hours.present? %> | |
68 | <h3><%= l(:label_spent_time) %></h3> |
|
68 | <h3><%= l(:label_spent_time) %></h3> | |
69 | <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> |
|
69 | <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> | |
70 | <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | |
|
70 | <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | | |
71 |
<%= link_to(l(:label_report), {:controller => 'time |
|
71 | <%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project}) %></p> | |
72 | <% end %> |
|
72 | <% end %> | |
73 | <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %> |
|
73 | <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %> | |
74 | <% end %> |
|
74 | <% end %> | |
75 |
|
75 | |||
76 | <% content_for :header_tags do %> |
|
76 | <% content_for :header_tags do %> | |
77 | <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %> |
|
77 | <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %> | |
78 | <% end %> |
|
78 | <% end %> | |
79 |
|
79 | |||
80 | <% html_title(l(:label_overview)) -%> |
|
80 | <% html_title(l(:label_overview)) -%> |
@@ -1,38 +1,38 | |||||
1 | <fieldset id="date-range" class="collapsible"> |
|
1 | <fieldset id="date-range" class="collapsible"> | |
2 | <legend onclick="toggleFieldset(this);"><%= l(:label_date_range) %></legend> |
|
2 | <legend onclick="toggleFieldset(this);"><%= l(:label_date_range) %></legend> | |
3 | <div> |
|
3 | <div> | |
4 | <p> |
|
4 | <p> | |
5 | <%= label_tag "period_type_list", l(:description_date_range_list), :class => "hidden-for-sighted" %> |
|
5 | <%= label_tag "period_type_list", l(:description_date_range_list), :class => "hidden-for-sighted" %> | |
6 | <%= radio_button_tag 'period_type', '1', !@free_period, :onclick => 'Form.Element.disable("from");Form.Element.disable("to");Form.Element.enable("period");', :id => "period_type_list"%> |
|
6 | <%= radio_button_tag 'period_type', '1', !@free_period, :onclick => 'Form.Element.disable("from");Form.Element.disable("to");Form.Element.enable("period");', :id => "period_type_list"%> | |
7 | <%= select_tag 'period', options_for_period_select(params[:period]), |
|
7 | <%= select_tag 'period', options_for_period_select(params[:period]), | |
8 | :onchange => 'this.form.submit();', |
|
8 | :onchange => 'this.form.submit();', | |
9 | :onfocus => '$("period_type_1").checked = true;', |
|
9 | :onfocus => '$("period_type_1").checked = true;', | |
10 | :disabled => @free_period %> |
|
10 | :disabled => @free_period %> | |
11 | </p> |
|
11 | </p> | |
12 | <p> |
|
12 | <p> | |
13 | <%= label_tag "period_type_interval", l(:description_date_range_interval), :class => "hidden-for-sighted" %> |
|
13 | <%= label_tag "period_type_interval", l(:description_date_range_interval), :class => "hidden-for-sighted" %> | |
14 | <%= radio_button_tag 'period_type', '2', @free_period, :onclick => 'Form.Element.enable("from");Form.Element.enable("to");Form.Element.disable("period");', :id => "period_type_interval" %> |
|
14 | <%= radio_button_tag 'period_type', '2', @free_period, :onclick => 'Form.Element.enable("from");Form.Element.enable("to");Form.Element.disable("period");', :id => "period_type_interval" %> | |
15 | <span onclick="$('period_type_2').checked = true;"> |
|
15 | <span onclick="$('period_type_2').checked = true;"> | |
16 | <%= l(:label_date_from_to, |
|
16 | <%= l(:label_date_from_to, | |
17 | :start => ((label_tag "from", l(:description_date_from), :class => "hidden-for-sighted") + |
|
17 | :start => ((label_tag "from", l(:description_date_from), :class => "hidden-for-sighted") + | |
18 | text_field_tag('from', @from, :size => 10, :disabled => !@free_period) + calendar_for('from')), |
|
18 | text_field_tag('from', @from, :size => 10, :disabled => !@free_period) + calendar_for('from')), | |
19 | :end => ((label_tag "to", l(:description_date_to), :class => "hidden-for-sighted") + |
|
19 | :end => ((label_tag "to", l(:description_date_to), :class => "hidden-for-sighted") + | |
20 | text_field_tag('to', @to, :size => 10, :disabled => !@free_period) + calendar_for('to'))) %> |
|
20 | text_field_tag('to', @to, :size => 10, :disabled => !@free_period) + calendar_for('to'))) %> | |
21 | </span> |
|
21 | </span> | |
22 | </p> |
|
22 | </p> | |
23 | </div> |
|
23 | </div> | |
24 | </fieldset> |
|
24 | </fieldset> | |
25 | <p class="buttons"> |
|
25 | <p class="buttons"> | |
26 | <%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %> |
|
26 | <%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %> | |
27 | <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %> |
|
27 | <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %> | |
28 | </p> |
|
28 | </p> | |
29 |
|
29 | |||
30 | <div class="tabs"> |
|
30 | <div class="tabs"> | |
31 | <% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %> |
|
31 | <% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %> | |
32 | <ul> |
|
32 | <ul> | |
33 | <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }), |
|
33 | <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }), | |
34 | :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li> |
|
34 | :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li> | |
35 |
<li><%= link_to(l(:label_report), url_params.merge({:controller => 'time |
|
35 | <li><%= link_to(l(:label_report), url_params.merge({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}), | |
36 | :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> |
|
36 | :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> | |
37 | </ul> |
|
37 | </ul> | |
38 | </div> |
|
38 | </div> |
1 | NO CONTENT: file renamed from app/views/time_entry_reports/_report_criteria.html.erb to app/views/timelog/_report_criteria.html.erb |
|
NO CONTENT: file renamed from app/views/time_entry_reports/_report_criteria.html.erb to app/views/timelog/_report_criteria.html.erb |
@@ -1,72 +1,72 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'new', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time-add' %> |
|
2 | <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'new', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time-add' %> | |
3 | </div> |
|
3 | </div> | |
4 |
|
4 | |||
5 | <%= render_timelog_breadcrumb %> |
|
5 | <%= render_timelog_breadcrumb %> | |
6 |
|
6 | |||
7 | <h2><%= l(:label_spent_time) %></h2> |
|
7 | <h2><%= l(:label_spent_time) %></h2> | |
8 |
|
8 | |||
9 |
<% form_tag({:controller => 'time |
|
9 | <% form_tag({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> | |
10 | <% @report.criteria.each do |criterion| %> |
|
10 | <% @report.criteria.each do |criterion| %> | |
11 | <%= hidden_field_tag 'criteria[]', criterion, :id => nil %> |
|
11 | <%= hidden_field_tag 'criteria[]', criterion, :id => nil %> | |
12 | <% end %> |
|
12 | <% end %> | |
13 | <%= render :partial => 'timelog/date_range' %> |
|
13 | <%= render :partial => 'timelog/date_range' %> | |
14 |
|
14 | |||
15 | <p><label for='columns'><%= l(:label_details) %></label>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'], |
|
15 | <p><label for='columns'><%= l(:label_details) %></label>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'], | |
16 | [l(:label_month), 'month'], |
|
16 | [l(:label_month), 'month'], | |
17 | [l(:label_week), 'week'], |
|
17 | [l(:label_week), 'week'], | |
18 | [l(:label_day_plural).titleize, 'day']], @report.columns), |
|
18 | [l(:label_day_plural).titleize, 'day']], @report.columns), | |
19 | :onchange => "this.form.onsubmit();" %> |
|
19 | :onchange => "this.form.onsubmit();" %> | |
20 |
|
20 | |||
21 | <label for='criterias'><%= l(:button_add) %></label>: <%= select_tag('criteria[]', options_for_select([[]] + (@report.available_criteria.keys - @report.criteria).collect{|k| [l_or_humanize(@report.available_criteria[k][:label]), k]}), |
|
21 | <label for='criterias'><%= l(:button_add) %></label>: <%= select_tag('criteria[]', options_for_select([[]] + (@report.available_criteria.keys - @report.criteria).collect{|k| [l_or_humanize(@report.available_criteria[k][:label]), k]}), | |
22 | :onchange => "this.form.submit();", |
|
22 | :onchange => "this.form.submit();", | |
23 | :style => 'width: 200px', |
|
23 | :style => 'width: 200px', | |
24 | :id => nil, |
|
24 | :id => nil, | |
25 | :disabled => (@report.criteria.length >= 3), :id => "criterias") %> |
|
25 | :disabled => (@report.criteria.length >= 3), :id => "criterias") %> | |
26 | <%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @report.columns}, :class => 'icon icon-reload' %></p> |
|
26 | <%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @report.columns}, :class => 'icon icon-reload' %></p> | |
27 | <% end %> |
|
27 | <% end %> | |
28 |
|
28 | |||
29 | <% unless @report.criteria.empty? %> |
|
29 | <% unless @report.criteria.empty? %> | |
30 | <div class="total-hours"> |
|
30 | <div class="total-hours"> | |
31 | <p><%= l(:label_total) %>: <%= html_hours(l_hours(@report.total_hours)) %></p> |
|
31 | <p><%= l(:label_total) %>: <%= html_hours(l_hours(@report.total_hours)) %></p> | |
32 | </div> |
|
32 | </div> | |
33 |
|
33 | |||
34 | <% unless @report.hours.empty? %> |
|
34 | <% unless @report.hours.empty? %> | |
35 | <div class="autoscroll"> |
|
35 | <div class="autoscroll"> | |
36 | <table class="list" id="time-report"> |
|
36 | <table class="list" id="time-report"> | |
37 | <thead> |
|
37 | <thead> | |
38 | <tr> |
|
38 | <tr> | |
39 | <% @report.criteria.each do |criteria| %> |
|
39 | <% @report.criteria.each do |criteria| %> | |
40 | <th><%= l_or_humanize(@report.available_criteria[criteria][:label]) %></th> |
|
40 | <th><%= l_or_humanize(@report.available_criteria[criteria][:label]) %></th> | |
41 | <% end %> |
|
41 | <% end %> | |
42 | <% columns_width = (40 / (@report.periods.length+1)).to_i %> |
|
42 | <% columns_width = (40 / (@report.periods.length+1)).to_i %> | |
43 | <% @report.periods.each do |period| %> |
|
43 | <% @report.periods.each do |period| %> | |
44 | <th class="period" width="<%= columns_width %>%"><%= period %></th> |
|
44 | <th class="period" width="<%= columns_width %>%"><%= period %></th> | |
45 | <% end %> |
|
45 | <% end %> | |
46 | <th class="total" width="<%= columns_width %>%"><%= l(:label_total) %></th> |
|
46 | <th class="total" width="<%= columns_width %>%"><%= l(:label_total) %></th> | |
47 | </tr> |
|
47 | </tr> | |
48 | </thead> |
|
48 | </thead> | |
49 | <tbody> |
|
49 | <tbody> | |
50 | <%= render :partial => 'report_criteria', :locals => {:criterias => @report.criteria, :hours => @report.hours, :level => 0} %> |
|
50 | <%= render :partial => 'report_criteria', :locals => {:criterias => @report.criteria, :hours => @report.hours, :level => 0} %> | |
51 | <tr class="total"> |
|
51 | <tr class="total"> | |
52 | <td><%= l(:label_total) %></td> |
|
52 | <td><%= l(:label_total) %></td> | |
53 | <%= '<td></td>' * (@report.criteria.size - 1) %> |
|
53 | <%= '<td></td>' * (@report.criteria.size - 1) %> | |
54 | <% total = 0 -%> |
|
54 | <% total = 0 -%> | |
55 | <% @report.periods.each do |period| -%> |
|
55 | <% @report.periods.each do |period| -%> | |
56 | <% sum = sum_hours(select_hours(@report.hours, @report.columns, period.to_s)); total += sum -%> |
|
56 | <% sum = sum_hours(select_hours(@report.hours, @report.columns, period.to_s)); total += sum -%> | |
57 | <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td> |
|
57 | <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td> | |
58 | <% end -%> |
|
58 | <% end -%> | |
59 | <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td> |
|
59 | <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td> | |
60 | </tr> |
|
60 | </tr> | |
61 | </tbody> |
|
61 | </tbody> | |
62 | </table> |
|
62 | </table> | |
63 | </div> |
|
63 | </div> | |
64 |
|
64 | |||
65 | <% other_formats_links do |f| %> |
|
65 | <% other_formats_links do |f| %> | |
66 | <%= f.link_to 'CSV', :url => params %> |
|
66 | <%= f.link_to 'CSV', :url => params %> | |
67 | <% end %> |
|
67 | <% end %> | |
68 | <% end %> |
|
68 | <% end %> | |
69 | <% end %> |
|
69 | <% end %> | |
70 |
|
70 | |||
71 | <% html_title l(:label_spent_time), l(:label_report) %> |
|
71 | <% html_title l(:label_spent_time), l(:label_report) %> | |
72 |
|
72 |
@@ -1,225 +1,216 | |||||
1 | ActionController::Routing::Routes.draw do |map| |
|
1 | ActionController::Routing::Routes.draw do |map| | |
2 | # Add your own custom routes here. |
|
2 | # Add your own custom routes here. | |
3 | # The priority is based upon order of creation: first created -> highest priority. |
|
3 | # The priority is based upon order of creation: first created -> highest priority. | |
4 |
|
4 | |||
5 | # Here's a sample route: |
|
5 | # Here's a sample route: | |
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' |
|
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' | |
7 | # Keep in mind you can assign values other than :controller and :action |
|
7 | # Keep in mind you can assign values other than :controller and :action | |
8 |
|
8 | |||
9 | map.home '', :controller => 'welcome' |
|
9 | map.home '', :controller => 'welcome' | |
10 |
|
10 | |||
11 | map.signin 'login', :controller => 'account', :action => 'login' |
|
11 | map.signin 'login', :controller => 'account', :action => 'login' | |
12 | map.signout 'logout', :controller => 'account', :action => 'logout' |
|
12 | map.signout 'logout', :controller => 'account', :action => 'logout' | |
13 |
|
13 | |||
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' | |
15 | map.connect 'help/:ctrl/:page', :controller => 'help' |
|
15 | map.connect 'help/:ctrl/:page', :controller => 'help' | |
16 |
|
16 | |||
17 | map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| |
|
|||
18 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report' |
|
|||
19 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format' |
|
|||
20 | time_report.connect 'projects/:project_id/time_entries/report' |
|
|||
21 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
|||
22 | time_report.connect 'time_entries/report' |
|
|||
23 | time_report.connect 'time_entries/report.:format' |
|
|||
24 | end |
|
|||
25 |
|
||||
26 | map.bulk_edit_time_entry 'time_entries/bulk_edit', |
|
17 | map.bulk_edit_time_entry 'time_entries/bulk_edit', | |
27 | :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get } |
|
18 | :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get } | |
28 | map.bulk_update_time_entry 'time_entries/bulk_edit', |
|
19 | map.bulk_update_time_entry 'time_entries/bulk_edit', | |
29 | :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post } |
|
20 | :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post } | |
30 | map.time_entries_context_menu '/time_entries/context_menu', |
|
21 | map.time_entries_context_menu '/time_entries/context_menu', | |
31 | :controller => 'context_menus', :action => 'time_entries' |
|
22 | :controller => 'context_menus', :action => 'time_entries' | |
32 |
|
23 | |||
33 | map.resources :time_entries, :controller => 'timelog' |
|
24 | map.resources :time_entries, :controller => 'timelog', :collection => {:report => :get} | |
34 |
|
25 | |||
35 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
26 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} | |
36 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
27 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} | |
37 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} |
|
28 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} | |
38 |
|
29 | |||
39 | map.with_options :controller => 'messages' do |messages_routes| |
|
30 | map.with_options :controller => 'messages' do |messages_routes| | |
40 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
31 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| | |
41 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
32 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' | |
42 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
33 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' | |
43 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
34 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | |
44 | end |
|
35 | end | |
45 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
36 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| | |
46 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
37 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' | |
47 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
38 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' | |
48 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ |
|
39 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ | |
49 | end |
|
40 | end | |
50 | end |
|
41 | end | |
51 |
|
42 | |||
52 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' |
|
43 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' | |
53 | map.resources :queries, :except => [:show] |
|
44 | map.resources :queries, :except => [:show] | |
54 |
|
45 | |||
55 | # Misc issue routes. TODO: move into resources |
|
46 | # Misc issue routes. TODO: move into resources | |
56 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' |
|
47 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' | |
57 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview |
|
48 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview | |
58 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' |
|
49 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' | |
59 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' |
|
50 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' | |
60 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } |
|
51 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } | |
61 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } |
|
52 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } | |
62 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } |
|
53 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } | |
63 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy |
|
54 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy | |
64 |
|
55 | |||
65 | map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes| |
|
56 | map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes| | |
66 | gantts_routes.connect '/projects/:project_id/issues/gantt' |
|
57 | gantts_routes.connect '/projects/:project_id/issues/gantt' | |
67 | gantts_routes.connect '/projects/:project_id/issues/gantt.:format' |
|
58 | gantts_routes.connect '/projects/:project_id/issues/gantt.:format' | |
68 | gantts_routes.connect '/issues/gantt.:format' |
|
59 | gantts_routes.connect '/issues/gantt.:format' | |
69 | end |
|
60 | end | |
70 |
|
61 | |||
71 | map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes| |
|
62 | map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes| | |
72 | calendars_routes.connect '/projects/:project_id/issues/calendar' |
|
63 | calendars_routes.connect '/projects/:project_id/issues/calendar' | |
73 | calendars_routes.connect '/issues/calendar' |
|
64 | calendars_routes.connect '/issues/calendar' | |
74 | end |
|
65 | end | |
75 |
|
66 | |||
76 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| |
|
67 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| | |
77 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' |
|
68 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' | |
78 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' |
|
69 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' | |
79 | end |
|
70 | end | |
80 |
|
71 | |||
81 | map.resources :issues do |issues| |
|
72 | map.resources :issues do |issues| | |
82 | issues.resources :time_entries, :controller => 'timelog' |
|
73 | issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get} | |
83 | issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] |
|
74 | issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] | |
84 | end |
|
75 | end | |
85 |
|
76 | |||
86 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
77 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' | |
87 |
|
78 | |||
88 | map.with_options :controller => 'users' do |users| |
|
79 | map.with_options :controller => 'users' do |users| | |
89 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} |
|
80 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} | |
90 |
|
81 | |||
91 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
82 | users.with_options :conditions => {:method => :post} do |user_actions| | |
92 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
83 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' | |
93 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
84 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' | |
94 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
85 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' | |
95 | end |
|
86 | end | |
96 | end |
|
87 | end | |
97 |
|
88 | |||
98 | map.resources :users, :member => { |
|
89 | map.resources :users, :member => { | |
99 | :edit_membership => :post, |
|
90 | :edit_membership => :post, | |
100 | :destroy_membership => :post |
|
91 | :destroy_membership => :post | |
101 | } |
|
92 | } | |
102 |
|
93 | |||
103 | # For nice "roadmap" in the url for the index action |
|
94 | # For nice "roadmap" in the url for the index action | |
104 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' |
|
95 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' | |
105 |
|
96 | |||
106 | map.all_news 'news', :controller => 'news', :action => 'index' |
|
97 | map.all_news 'news', :controller => 'news', :action => 'index' | |
107 | map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' |
|
98 | map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' | |
108 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' |
|
99 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' | |
109 | map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} |
|
100 | map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} | |
110 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} |
|
101 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} | |
111 |
|
102 | |||
112 | map.resources :projects, :member => { |
|
103 | map.resources :projects, :member => { | |
113 | :copy => [:get, :post], |
|
104 | :copy => [:get, :post], | |
114 | :settings => :get, |
|
105 | :settings => :get, | |
115 | :modules => :post, |
|
106 | :modules => :post, | |
116 | :archive => :post, |
|
107 | :archive => :post, | |
117 | :unarchive => :post |
|
108 | :unarchive => :post | |
118 | } do |project| |
|
109 | } do |project| | |
119 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] |
|
110 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] | |
120 | project.resources :issues, :only => [:index, :new, :create] do |issues| |
|
111 | project.resources :issues, :only => [:index, :new, :create] do |issues| | |
121 | issues.resources :time_entries, :controller => 'timelog' |
|
112 | issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get} | |
122 | end |
|
113 | end | |
123 | project.resources :files, :only => [:index, :new, :create] |
|
114 | project.resources :files, :only => [:index, :new, :create] | |
124 | project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post} |
|
115 | project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post} | |
125 | project.resources :news, :shallow => true |
|
116 | project.resources :news, :shallow => true | |
126 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' |
|
117 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id', :collection => {:report => :get} | |
127 | project.resources :queries, :only => [:new, :create] |
|
118 | project.resources :queries, :only => [:new, :create] | |
128 | project.resources :issue_categories, :shallow => true |
|
119 | project.resources :issue_categories, :shallow => true | |
129 | project.resources :documents, :shallow => true, :member => {:add_attachment => :post} |
|
120 | project.resources :documents, :shallow => true, :member => {:add_attachment => :post} | |
130 | project.resources :boards |
|
121 | project.resources :boards | |
131 |
|
122 | |||
132 | project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get} |
|
123 | project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get} | |
133 | project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get} |
|
124 | project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get} | |
134 | project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil |
|
125 | project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil | |
135 | project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' |
|
126 | project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' | |
136 | project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' |
|
127 | project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' | |
137 | project.resources :wiki, :except => [:new, :create], :member => { |
|
128 | project.resources :wiki, :except => [:new, :create], :member => { | |
138 | :rename => [:get, :post], |
|
129 | :rename => [:get, :post], | |
139 | :history => :get, |
|
130 | :history => :get, | |
140 | :preview => :any, |
|
131 | :preview => :any, | |
141 | :protect => :post, |
|
132 | :protect => :post, | |
142 | :add_attachment => :post |
|
133 | :add_attachment => :post | |
143 | }, :collection => { |
|
134 | }, :collection => { | |
144 | :export => :get, |
|
135 | :export => :get, | |
145 | :date_index => :get |
|
136 | :date_index => :get | |
146 | } |
|
137 | } | |
147 |
|
138 | |||
148 | end |
|
139 | end | |
149 |
|
140 | |||
150 | # Destroy uses a get request to prompt the user before the actual DELETE request |
|
141 | # Destroy uses a get request to prompt the user before the actual DELETE request | |
151 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} |
|
142 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} | |
152 |
|
143 | |||
153 | # TODO: port to be part of the resources route(s) |
|
144 | # TODO: port to be part of the resources route(s) | |
154 | map.with_options :controller => 'projects' do |project_mapper| |
|
145 | map.with_options :controller => 'projects' do |project_mapper| | |
155 | project_mapper.with_options :conditions => {:method => :get} do |project_views| |
|
146 | project_mapper.with_options :conditions => {:method => :get} do |project_views| | |
156 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' |
|
147 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' | |
157 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' |
|
148 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' | |
158 | end |
|
149 | end | |
159 | end |
|
150 | end | |
160 |
|
151 | |||
161 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| |
|
152 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| | |
162 | activity.connect 'projects/:id/activity' |
|
153 | activity.connect 'projects/:id/activity' | |
163 | activity.connect 'projects/:id/activity.:format' |
|
154 | activity.connect 'projects/:id/activity.:format' | |
164 | activity.connect 'activity', :id => nil |
|
155 | activity.connect 'activity', :id => nil | |
165 | activity.connect 'activity.:format', :id => nil |
|
156 | activity.connect 'activity.:format', :id => nil | |
166 | end |
|
157 | end | |
167 |
|
158 | |||
168 | map.with_options :controller => 'repositories' do |repositories| |
|
159 | map.with_options :controller => 'repositories' do |repositories| | |
169 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
160 | repositories.with_options :conditions => {:method => :get} do |repository_views| | |
170 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
161 | repository_views.connect 'projects/:id/repository', :action => 'show' | |
171 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
162 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' | |
172 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
163 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' | |
173 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
164 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' | |
174 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
165 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' | |
175 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
166 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' | |
176 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
167 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' | |
177 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
168 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' | |
178 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
169 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
179 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
170 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
180 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' |
|
171 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' | |
181 | # TODO: why the following route is required? |
|
172 | # TODO: why the following route is required? | |
182 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' |
|
173 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' | |
183 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
174 | repository_views.connect 'projects/:id/repository/:action/*path' | |
184 | end |
|
175 | end | |
185 |
|
176 | |||
186 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
177 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} | |
187 | end |
|
178 | end | |
188 |
|
179 | |||
189 | map.resources :attachments, :only => [:show, :destroy] |
|
180 | map.resources :attachments, :only => [:show, :destroy] | |
190 | # additional routes for having the file name at the end of url |
|
181 | # additional routes for having the file name at the end of url | |
191 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
182 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ | |
192 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
183 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ | |
193 |
|
184 | |||
194 | map.resources :groups, :member => {:autocomplete_for_user => :get} |
|
185 | map.resources :groups, :member => {:autocomplete_for_user => :get} | |
195 | map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post} |
|
186 | map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post} | |
196 | map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete} |
|
187 | map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete} | |
197 |
|
188 | |||
198 | map.resources :trackers, :except => :show |
|
189 | map.resources :trackers, :except => :show | |
199 | map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post} |
|
190 | map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post} | |
200 |
|
191 | |||
201 | #left old routes at the bottom for backwards compat |
|
192 | #left old routes at the bottom for backwards compat | |
202 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
193 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' | |
203 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
194 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' | |
204 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
195 | map.connect 'projects/:project_id/news/:action', :controller => 'news' | |
205 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
196 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ | |
206 | map.with_options :controller => 'repositories' do |omap| |
|
197 | map.with_options :controller => 'repositories' do |omap| | |
207 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
198 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' | |
208 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
199 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' | |
209 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
200 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' | |
210 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
201 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' | |
211 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
202 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' | |
212 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
203 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' | |
213 | end |
|
204 | end | |
214 |
|
205 | |||
215 | map.with_options :controller => 'sys' do |sys| |
|
206 | map.with_options :controller => 'sys' do |sys| | |
216 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
207 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} | |
217 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
208 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} | |
218 | end |
|
209 | end | |
219 |
|
210 | |||
220 | # Install the default route as the lowest priority. |
|
211 | # Install the default route as the lowest priority. | |
221 | map.connect ':controller/:action/:id' |
|
212 | map.connect ':controller/:action/:id' | |
222 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
213 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' | |
223 | # Used for OpenID |
|
214 | # Used for OpenID | |
224 | map.root :controller => 'account', :action => 'login' |
|
215 | map.root :controller => 'account', :action => 'login' | |
225 | end |
|
216 | end |
@@ -1,237 +1,237 | |||||
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/search' |
|
4 | require 'redmine/search' | |
5 | require 'redmine/custom_field_format' |
|
5 | require 'redmine/custom_field_format' | |
6 | require 'redmine/mime_type' |
|
6 | require 'redmine/mime_type' | |
7 | require 'redmine/core_ext' |
|
7 | require 'redmine/core_ext' | |
8 | require 'redmine/themes' |
|
8 | require 'redmine/themes' | |
9 | require 'redmine/hook' |
|
9 | require 'redmine/hook' | |
10 | require 'redmine/plugin' |
|
10 | require 'redmine/plugin' | |
11 | require 'redmine/notifiable' |
|
11 | require 'redmine/notifiable' | |
12 | require 'redmine/wiki_formatting' |
|
12 | require 'redmine/wiki_formatting' | |
13 | require 'redmine/scm/base' |
|
13 | require 'redmine/scm/base' | |
14 |
|
14 | |||
15 | begin |
|
15 | begin | |
16 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) |
|
16 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) | |
17 | rescue LoadError |
|
17 | rescue LoadError | |
18 | # RMagick is not available |
|
18 | # RMagick is not available | |
19 | end |
|
19 | end | |
20 |
|
20 | |||
21 | if RUBY_VERSION < '1.9' |
|
21 | if RUBY_VERSION < '1.9' | |
22 | require 'faster_csv' |
|
22 | require 'faster_csv' | |
23 | else |
|
23 | else | |
24 | require 'csv' |
|
24 | require 'csv' | |
25 | FCSV = CSV |
|
25 | FCSV = CSV | |
26 | end |
|
26 | end | |
27 |
|
27 | |||
28 | Redmine::Scm::Base.add "Subversion" |
|
28 | Redmine::Scm::Base.add "Subversion" | |
29 | Redmine::Scm::Base.add "Darcs" |
|
29 | Redmine::Scm::Base.add "Darcs" | |
30 | Redmine::Scm::Base.add "Mercurial" |
|
30 | Redmine::Scm::Base.add "Mercurial" | |
31 | Redmine::Scm::Base.add "Cvs" |
|
31 | Redmine::Scm::Base.add "Cvs" | |
32 | Redmine::Scm::Base.add "Bazaar" |
|
32 | Redmine::Scm::Base.add "Bazaar" | |
33 | Redmine::Scm::Base.add "Git" |
|
33 | Redmine::Scm::Base.add "Git" | |
34 | Redmine::Scm::Base.add "Filesystem" |
|
34 | Redmine::Scm::Base.add "Filesystem" | |
35 |
|
35 | |||
36 | Redmine::CustomFieldFormat.map do |fields| |
|
36 | Redmine::CustomFieldFormat.map do |fields| | |
37 | fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1) |
|
37 | fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1) | |
38 | fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2) |
|
38 | fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2) | |
39 | fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3) |
|
39 | fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3) | |
40 | fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4) |
|
40 | fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4) | |
41 | fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5) |
|
41 | fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5) | |
42 | fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6) |
|
42 | fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6) | |
43 | fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7) |
|
43 | fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7) | |
44 | fields.register Redmine::CustomFieldFormat.new('user', :label => :label_user, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 8) |
|
44 | fields.register Redmine::CustomFieldFormat.new('user', :label => :label_user, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 8) | |
45 | fields.register Redmine::CustomFieldFormat.new('version', :label => :label_version, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 9) |
|
45 | fields.register Redmine::CustomFieldFormat.new('version', :label => :label_version, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 9) | |
46 | end |
|
46 | end | |
47 |
|
47 | |||
48 | # Permissions |
|
48 | # Permissions | |
49 | Redmine::AccessControl.map do |map| |
|
49 | Redmine::AccessControl.map do |map| | |
50 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true |
|
50 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true | |
51 | map.permission :search_project, {:search => :index}, :public => true |
|
51 | map.permission :search_project, {:search => :index}, :public => true | |
52 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
|
52 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin | |
53 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
53 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member | |
54 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
54 | map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
55 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
55 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member | |
56 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member |
|
56 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member | |
57 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
57 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member | |
58 |
|
58 | |||
59 | map.project_module :issue_tracking do |map| |
|
59 | map.project_module :issue_tracking do |map| | |
60 | # Issue categories |
|
60 | # Issue categories | |
61 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member |
|
61 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member | |
62 | # Issues |
|
62 | # Issues | |
63 | map.permission :view_issues, {:issues => [:index, :show], |
|
63 | map.permission :view_issues, {:issues => [:index, :show], | |
64 | :auto_complete => [:issues], |
|
64 | :auto_complete => [:issues], | |
65 | :context_menus => [:issues], |
|
65 | :context_menus => [:issues], | |
66 | :versions => [:index, :show, :status_by], |
|
66 | :versions => [:index, :show, :status_by], | |
67 | :journals => [:index, :diff], |
|
67 | :journals => [:index, :diff], | |
68 | :queries => :index, |
|
68 | :queries => :index, | |
69 | :reports => [:issue_report, :issue_report_details]} |
|
69 | :reports => [:issue_report, :issue_report_details]} | |
70 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} |
|
70 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} | |
71 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} |
|
71 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} | |
72 | map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]} |
|
72 | map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]} | |
73 | map.permission :manage_subtasks, {} |
|
73 | map.permission :manage_subtasks, {} | |
74 | map.permission :set_issues_private, {} |
|
74 | map.permission :set_issues_private, {} | |
75 | map.permission :set_own_issues_private, {}, :require => :loggedin |
|
75 | map.permission :set_own_issues_private, {}, :require => :loggedin | |
76 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} |
|
76 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} | |
77 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin |
|
77 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin | |
78 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin |
|
78 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin | |
79 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin |
|
79 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin | |
80 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
80 | map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
81 | # Queries |
|
81 | # Queries | |
82 | map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member |
|
82 | map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member | |
83 | map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin |
|
83 | map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin | |
84 | # Watchers |
|
84 | # Watchers | |
85 | map.permission :view_issue_watchers, {} |
|
85 | map.permission :view_issue_watchers, {} | |
86 | map.permission :add_issue_watchers, {:watchers => :new} |
|
86 | map.permission :add_issue_watchers, {:watchers => :new} | |
87 | map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
87 | map.permission :delete_issue_watchers, {:watchers => :destroy} | |
88 | end |
|
88 | end | |
89 |
|
89 | |||
90 | map.project_module :time_tracking do |map| |
|
90 | map.project_module :time_tracking do |map| | |
91 | map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin |
|
91 | map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin | |
92 |
map.permission :view_time_entries, :timelog => [:index, :show] |
|
92 | map.permission :view_time_entries, :timelog => [:index, :report, :show] | |
93 | map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member |
|
93 | map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member | |
94 | map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin |
|
94 | map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin | |
95 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member |
|
95 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member | |
96 | end |
|
96 | end | |
97 |
|
97 | |||
98 | map.project_module :news do |map| |
|
98 | map.project_module :news do |map| | |
99 | map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member |
|
99 | map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member | |
100 | map.permission :view_news, {:news => [:index, :show]}, :public => true |
|
100 | map.permission :view_news, {:news => [:index, :show]}, :public => true | |
101 | map.permission :comment_news, {:comments => :create} |
|
101 | map.permission :comment_news, {:comments => :create} | |
102 | end |
|
102 | end | |
103 |
|
103 | |||
104 | map.project_module :documents do |map| |
|
104 | map.project_module :documents do |map| | |
105 | map.permission :manage_documents, {:documents => [:new, :create, :edit, :update, :destroy, :add_attachment]}, :require => :loggedin |
|
105 | map.permission :manage_documents, {:documents => [:new, :create, :edit, :update, :destroy, :add_attachment]}, :require => :loggedin | |
106 | map.permission :view_documents, :documents => [:index, :show, :download] |
|
106 | map.permission :view_documents, :documents => [:index, :show, :download] | |
107 | end |
|
107 | end | |
108 |
|
108 | |||
109 | map.project_module :files do |map| |
|
109 | map.project_module :files do |map| | |
110 | map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin |
|
110 | map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin | |
111 | map.permission :view_files, :files => :index, :versions => :download |
|
111 | map.permission :view_files, :files => :index, :versions => :download | |
112 | end |
|
112 | end | |
113 |
|
113 | |||
114 | map.project_module :wiki do |map| |
|
114 | map.project_module :wiki do |map| | |
115 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
|
115 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |
116 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
116 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |
117 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
117 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member | |
118 | map.permission :view_wiki_pages, :wiki => [:index, :show, :special, :date_index] |
|
118 | map.permission :view_wiki_pages, :wiki => [:index, :show, :special, :date_index] | |
119 | map.permission :export_wiki_pages, :wiki => [:export] |
|
119 | map.permission :export_wiki_pages, :wiki => [:export] | |
120 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] |
|
120 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] | |
121 | map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment] |
|
121 | map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment] | |
122 | map.permission :delete_wiki_pages_attachments, {} |
|
122 | map.permission :delete_wiki_pages_attachments, {} | |
123 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
123 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member | |
124 | end |
|
124 | end | |
125 |
|
125 | |||
126 | map.project_module :repository do |map| |
|
126 | map.project_module :repository do |map| | |
127 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member |
|
127 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member | |
128 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] |
|
128 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] | |
129 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
129 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] | |
130 | map.permission :commit_access, {} |
|
130 | map.permission :commit_access, {} | |
131 | end |
|
131 | end | |
132 |
|
132 | |||
133 | map.project_module :boards do |map| |
|
133 | map.project_module :boards do |map| | |
134 | map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member |
|
134 | map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member | |
135 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
135 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true | |
136 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} |
|
136 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} | |
137 | map.permission :edit_messages, {:messages => :edit}, :require => :member |
|
137 | map.permission :edit_messages, {:messages => :edit}, :require => :member | |
138 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin |
|
138 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin | |
139 | map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
139 | map.permission :delete_messages, {:messages => :destroy}, :require => :member | |
140 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
140 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin | |
141 | end |
|
141 | end | |
142 |
|
142 | |||
143 | map.project_module :calendar do |map| |
|
143 | map.project_module :calendar do |map| | |
144 | map.permission :view_calendar, :calendars => [:show, :update] |
|
144 | map.permission :view_calendar, :calendars => [:show, :update] | |
145 | end |
|
145 | end | |
146 |
|
146 | |||
147 | map.project_module :gantt do |map| |
|
147 | map.project_module :gantt do |map| | |
148 | map.permission :view_gantt, :gantts => [:show, :update] |
|
148 | map.permission :view_gantt, :gantts => [:show, :update] | |
149 | end |
|
149 | end | |
150 | end |
|
150 | end | |
151 |
|
151 | |||
152 | Redmine::MenuManager.map :top_menu do |menu| |
|
152 | Redmine::MenuManager.map :top_menu do |menu| | |
153 | menu.push :home, :home_path |
|
153 | menu.push :home, :home_path | |
154 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } |
|
154 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } | |
155 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural |
|
155 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural | |
156 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true |
|
156 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true | |
157 | menu.push :help, Redmine::Info.help_url, :last => true |
|
157 | menu.push :help, Redmine::Info.help_url, :last => true | |
158 | end |
|
158 | end | |
159 |
|
159 | |||
160 | Redmine::MenuManager.map :account_menu do |menu| |
|
160 | Redmine::MenuManager.map :account_menu do |menu| | |
161 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } |
|
161 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } | |
162 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } |
|
162 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } | |
163 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } |
|
163 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } | |
164 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } |
|
164 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } | |
165 | end |
|
165 | end | |
166 |
|
166 | |||
167 | Redmine::MenuManager.map :application_menu do |menu| |
|
167 | Redmine::MenuManager.map :application_menu do |menu| | |
168 | # Empty |
|
168 | # Empty | |
169 | end |
|
169 | end | |
170 |
|
170 | |||
171 | Redmine::MenuManager.map :admin_menu do |menu| |
|
171 | Redmine::MenuManager.map :admin_menu do |menu| | |
172 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural |
|
172 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural | |
173 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural |
|
173 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural | |
174 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural |
|
174 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural | |
175 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions |
|
175 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions | |
176 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural |
|
176 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural | |
177 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, |
|
177 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, | |
178 | :html => {:class => 'issue_statuses'} |
|
178 | :html => {:class => 'issue_statuses'} | |
179 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow |
|
179 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow | |
180 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, |
|
180 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, | |
181 | :html => {:class => 'custom_fields'} |
|
181 | :html => {:class => 'custom_fields'} | |
182 | menu.push :enumerations, {:controller => 'enumerations'} |
|
182 | menu.push :enumerations, {:controller => 'enumerations'} | |
183 | menu.push :settings, {:controller => 'settings'} |
|
183 | menu.push :settings, {:controller => 'settings'} | |
184 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, |
|
184 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, | |
185 | :html => {:class => 'server_authentication'} |
|
185 | :html => {:class => 'server_authentication'} | |
186 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true |
|
186 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true | |
187 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true |
|
187 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true | |
188 | end |
|
188 | end | |
189 |
|
189 | |||
190 | Redmine::MenuManager.map :project_menu do |menu| |
|
190 | Redmine::MenuManager.map :project_menu do |menu| | |
191 | menu.push :overview, { :controller => 'projects', :action => 'show' } |
|
191 | menu.push :overview, { :controller => 'projects', :action => 'show' } | |
192 | menu.push :activity, { :controller => 'activities', :action => 'index' } |
|
192 | menu.push :activity, { :controller => 'activities', :action => 'index' } | |
193 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, |
|
193 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, | |
194 | :if => Proc.new { |p| p.shared_versions.any? } |
|
194 | :if => Proc.new { |p| p.shared_versions.any? } | |
195 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural |
|
195 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural | |
196 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, |
|
196 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, | |
197 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } |
|
197 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } | |
198 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt |
|
198 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt | |
199 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar |
|
199 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar | |
200 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
200 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural | |
201 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
201 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural | |
202 | menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id, |
|
202 | menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id, | |
203 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } |
|
203 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } | |
204 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, |
|
204 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, | |
205 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural |
|
205 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural | |
206 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id |
|
206 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id | |
207 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, |
|
207 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, | |
208 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } |
|
208 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } | |
209 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true |
|
209 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true | |
210 | end |
|
210 | end | |
211 |
|
211 | |||
212 | Redmine::Activity.map do |activity| |
|
212 | Redmine::Activity.map do |activity| | |
213 | activity.register :issues, :class_name => %w(Issue Journal) |
|
213 | activity.register :issues, :class_name => %w(Issue Journal) | |
214 | activity.register :changesets |
|
214 | activity.register :changesets | |
215 | activity.register :news |
|
215 | activity.register :news | |
216 | activity.register :documents, :class_name => %w(Document Attachment) |
|
216 | activity.register :documents, :class_name => %w(Document Attachment) | |
217 | activity.register :files, :class_name => 'Attachment' |
|
217 | activity.register :files, :class_name => 'Attachment' | |
218 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false |
|
218 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false | |
219 | activity.register :messages, :default => false |
|
219 | activity.register :messages, :default => false | |
220 | activity.register :time_entries, :default => false |
|
220 | activity.register :time_entries, :default => false | |
221 | end |
|
221 | end | |
222 |
|
222 | |||
223 | Redmine::Search.map do |search| |
|
223 | Redmine::Search.map do |search| | |
224 | search.register :issues |
|
224 | search.register :issues | |
225 | search.register :news |
|
225 | search.register :news | |
226 | search.register :documents |
|
226 | search.register :documents | |
227 | search.register :changesets |
|
227 | search.register :changesets | |
228 | search.register :wiki_pages |
|
228 | search.register :wiki_pages | |
229 | search.register :messages |
|
229 | search.register :messages | |
230 | search.register :projects |
|
230 | search.register :projects | |
231 | end |
|
231 | end | |
232 |
|
232 | |||
233 | Redmine::WikiFormatting.map do |format| |
|
233 | Redmine::WikiFormatting.map do |format| | |
234 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper |
|
234 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper | |
235 | end |
|
235 | end | |
236 |
|
236 | |||
237 | ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler |
|
237 | ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler |
@@ -1,297 +1,299 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | require File.expand_path('../../test_helper', __FILE__) |
|
2 | require File.expand_path('../../test_helper', __FILE__) | |
3 |
|
3 | |||
4 | class TimeEntryReportsControllerTest < ActionController::TestCase |
|
4 | class TimeEntryReportsControllerTest < ActionController::TestCase | |
|
5 | tests TimelogController | |||
|
6 | ||||
5 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, |
|
7 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, | |
6 | :issues, :time_entries, :users, :trackers, :enumerations, |
|
8 | :issues, :time_entries, :users, :trackers, :enumerations, | |
7 | :issue_statuses, :custom_fields, :custom_values |
|
9 | :issue_statuses, :custom_fields, :custom_values | |
8 |
|
10 | |||
9 | include Redmine::I18n |
|
11 | include Redmine::I18n | |
10 |
|
12 | |||
11 | def setup |
|
13 | def setup | |
12 | Setting.default_language = "en" |
|
14 | Setting.default_language = "en" | |
13 | end |
|
15 | end | |
14 |
|
16 | |||
15 | def test_report_at_project_level |
|
17 | def test_report_at_project_level | |
16 | get :report, :project_id => 'ecookbook' |
|
18 | get :report, :project_id => 'ecookbook' | |
17 | assert_response :success |
|
19 | assert_response :success | |
18 | assert_template 'report' |
|
20 | assert_template 'report' | |
19 | assert_tag :form, |
|
21 | assert_tag :form, | |
20 | :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'} |
|
22 | :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'} | |
21 | end |
|
23 | end | |
22 |
|
24 | |||
23 | def test_report_all_projects |
|
25 | def test_report_all_projects | |
24 | get :report |
|
26 | get :report | |
25 | assert_response :success |
|
27 | assert_response :success | |
26 | assert_template 'report' |
|
28 | assert_template 'report' | |
27 | assert_tag :form, |
|
29 | assert_tag :form, | |
28 | :attributes => {:action => "/time_entries/report", :id => 'query_form'} |
|
30 | :attributes => {:action => "/time_entries/report", :id => 'query_form'} | |
29 | end |
|
31 | end | |
30 |
|
32 | |||
31 | def test_report_all_projects_denied |
|
33 | def test_report_all_projects_denied | |
32 | r = Role.anonymous |
|
34 | r = Role.anonymous | |
33 | r.permissions.delete(:view_time_entries) |
|
35 | r.permissions.delete(:view_time_entries) | |
34 | r.permissions_will_change! |
|
36 | r.permissions_will_change! | |
35 | r.save |
|
37 | r.save | |
36 | get :report |
|
38 | get :report | |
37 | assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftime_entries%2Freport' |
|
39 | assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftime_entries%2Freport' | |
38 | end |
|
40 | end | |
39 |
|
41 | |||
40 | def test_report_all_projects_one_criteria |
|
42 | def test_report_all_projects_one_criteria | |
41 | get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project'] |
|
43 | get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project'] | |
42 | assert_response :success |
|
44 | assert_response :success | |
43 | assert_template 'report' |
|
45 | assert_template 'report' | |
44 | assert_not_nil assigns(:report) |
|
46 | assert_not_nil assigns(:report) | |
45 | assert_equal "8.65", "%.2f" % assigns(:report).total_hours |
|
47 | assert_equal "8.65", "%.2f" % assigns(:report).total_hours | |
46 | end |
|
48 | end | |
47 |
|
49 | |||
48 | def test_report_all_time |
|
50 | def test_report_all_time | |
49 | get :report, :project_id => 1, :criteria => ['project', 'issue'] |
|
51 | get :report, :project_id => 1, :criteria => ['project', 'issue'] | |
50 | assert_response :success |
|
52 | assert_response :success | |
51 | assert_template 'report' |
|
53 | assert_template 'report' | |
52 | assert_not_nil assigns(:report) |
|
54 | assert_not_nil assigns(:report) | |
53 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours |
|
55 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours | |
54 | end |
|
56 | end | |
55 |
|
57 | |||
56 | def test_report_all_time_by_day |
|
58 | def test_report_all_time_by_day | |
57 | get :report, :project_id => 1, :criteria => ['project', 'issue'], :columns => 'day' |
|
59 | get :report, :project_id => 1, :criteria => ['project', 'issue'], :columns => 'day' | |
58 | assert_response :success |
|
60 | assert_response :success | |
59 | assert_template 'report' |
|
61 | assert_template 'report' | |
60 | assert_not_nil assigns(:report) |
|
62 | assert_not_nil assigns(:report) | |
61 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours |
|
63 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours | |
62 | assert_tag :tag => 'th', :content => '2007-03-12' |
|
64 | assert_tag :tag => 'th', :content => '2007-03-12' | |
63 | end |
|
65 | end | |
64 |
|
66 | |||
65 | def test_report_one_criteria |
|
67 | def test_report_one_criteria | |
66 | get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project'] |
|
68 | get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project'] | |
67 | assert_response :success |
|
69 | assert_response :success | |
68 | assert_template 'report' |
|
70 | assert_template 'report' | |
69 | assert_not_nil assigns(:report) |
|
71 | assert_not_nil assigns(:report) | |
70 | assert_equal "8.65", "%.2f" % assigns(:report).total_hours |
|
72 | assert_equal "8.65", "%.2f" % assigns(:report).total_hours | |
71 | end |
|
73 | end | |
72 |
|
74 | |||
73 | def test_report_two_criteria |
|
75 | def test_report_two_criteria | |
74 | get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["member", "activity"] |
|
76 | get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["member", "activity"] | |
75 | assert_response :success |
|
77 | assert_response :success | |
76 | assert_template 'report' |
|
78 | assert_template 'report' | |
77 | assert_not_nil assigns(:report) |
|
79 | assert_not_nil assigns(:report) | |
78 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours |
|
80 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours | |
79 | end |
|
81 | end | |
80 |
|
82 | |||
81 | def test_report_one_day |
|
83 | def test_report_one_day | |
82 | get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["member", "activity"] |
|
84 | get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["member", "activity"] | |
83 | assert_response :success |
|
85 | assert_response :success | |
84 | assert_template 'report' |
|
86 | assert_template 'report' | |
85 | assert_not_nil assigns(:report) |
|
87 | assert_not_nil assigns(:report) | |
86 | assert_equal "4.25", "%.2f" % assigns(:report).total_hours |
|
88 | assert_equal "4.25", "%.2f" % assigns(:report).total_hours | |
87 | end |
|
89 | end | |
88 |
|
90 | |||
89 | def test_report_at_issue_level |
|
91 | def test_report_at_issue_level | |
90 | get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["member", "activity"] |
|
92 | get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["member", "activity"] | |
91 | assert_response :success |
|
93 | assert_response :success | |
92 | assert_template 'report' |
|
94 | assert_template 'report' | |
93 | assert_not_nil assigns(:report) |
|
95 | assert_not_nil assigns(:report) | |
94 | assert_equal "154.25", "%.2f" % assigns(:report).total_hours |
|
96 | assert_equal "154.25", "%.2f" % assigns(:report).total_hours | |
95 | assert_tag :form, |
|
97 | assert_tag :form, | |
96 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} |
|
98 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} | |
97 | end |
|
99 | end | |
98 |
|
100 | |||
99 | def test_report_custom_field_criteria |
|
101 | def test_report_custom_field_criteria | |
100 | get :report, :project_id => 1, :criteria => ['project', 'cf_1', 'cf_7'] |
|
102 | get :report, :project_id => 1, :criteria => ['project', 'cf_1', 'cf_7'] | |
101 | assert_response :success |
|
103 | assert_response :success | |
102 | assert_template 'report' |
|
104 | assert_template 'report' | |
103 | assert_not_nil assigns(:report) |
|
105 | assert_not_nil assigns(:report) | |
104 | assert_equal 3, assigns(:report).criteria.size |
|
106 | assert_equal 3, assigns(:report).criteria.size | |
105 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours |
|
107 | assert_equal "162.90", "%.2f" % assigns(:report).total_hours | |
106 | # Custom field column |
|
108 | # Custom field column | |
107 | assert_tag :tag => 'th', :content => 'Database' |
|
109 | assert_tag :tag => 'th', :content => 'Database' | |
108 | # Custom field row |
|
110 | # Custom field row | |
109 | assert_tag :tag => 'td', :content => 'MySQL', |
|
111 | assert_tag :tag => 'td', :content => 'MySQL', | |
110 | :sibling => { :tag => 'td', :attributes => { :class => 'hours' }, |
|
112 | :sibling => { :tag => 'td', :attributes => { :class => 'hours' }, | |
111 | :child => { :tag => 'span', :attributes => { :class => 'hours hours-int' }, |
|
113 | :child => { :tag => 'span', :attributes => { :class => 'hours hours-int' }, | |
112 | :content => '1' }} |
|
114 | :content => '1' }} | |
113 | # Second custom field column |
|
115 | # Second custom field column | |
114 | assert_tag :tag => 'th', :content => 'Billable' |
|
116 | assert_tag :tag => 'th', :content => 'Billable' | |
115 | end |
|
117 | end | |
116 |
|
118 | |||
117 | def test_report_one_criteria_no_result |
|
119 | def test_report_one_criteria_no_result | |
118 | get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criteria => ['project'] |
|
120 | get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criteria => ['project'] | |
119 | assert_response :success |
|
121 | assert_response :success | |
120 | assert_template 'report' |
|
122 | assert_template 'report' | |
121 | assert_not_nil assigns(:report) |
|
123 | assert_not_nil assigns(:report) | |
122 | assert_equal "0.00", "%.2f" % assigns(:report).total_hours |
|
124 | assert_equal "0.00", "%.2f" % assigns(:report).total_hours | |
123 | end |
|
125 | end | |
124 |
|
126 | |||
125 | def test_report_all_projects_csv_export |
|
127 | def test_report_all_projects_csv_export | |
126 | get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", |
|
128 | get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", | |
127 | :criteria => ["project", "member", "activity"], :format => "csv" |
|
129 | :criteria => ["project", "member", "activity"], :format => "csv" | |
128 | assert_response :success |
|
130 | assert_response :success | |
129 | assert_equal 'text/csv', @response.content_type |
|
131 | assert_equal 'text/csv', @response.content_type | |
130 | lines = @response.body.chomp.split("\n") |
|
132 | lines = @response.body.chomp.split("\n") | |
131 | # Headers |
|
133 | # Headers | |
132 | assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', |
|
134 | assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', | |
133 | lines.first |
|
135 | lines.first | |
134 | # Total row |
|
136 | # Total row | |
135 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last |
|
137 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last | |
136 | end |
|
138 | end | |
137 |
|
139 | |||
138 | def test_report_csv_export |
|
140 | def test_report_csv_export | |
139 | get :report, :project_id => 1, :columns => 'month', |
|
141 | get :report, :project_id => 1, :columns => 'month', | |
140 | :from => "2007-01-01", :to => "2007-06-30", |
|
142 | :from => "2007-01-01", :to => "2007-06-30", | |
141 | :criteria => ["project", "member", "activity"], :format => "csv" |
|
143 | :criteria => ["project", "member", "activity"], :format => "csv" | |
142 | assert_response :success |
|
144 | assert_response :success | |
143 | assert_equal 'text/csv', @response.content_type |
|
145 | assert_equal 'text/csv', @response.content_type | |
144 | lines = @response.body.chomp.split("\n") |
|
146 | lines = @response.body.chomp.split("\n") | |
145 | # Headers |
|
147 | # Headers | |
146 | assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', |
|
148 | assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', | |
147 | lines.first |
|
149 | lines.first | |
148 | # Total row |
|
150 | # Total row | |
149 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last |
|
151 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last | |
150 | end |
|
152 | end | |
151 |
|
153 | |||
152 | def test_csv_big_5 |
|
154 | def test_csv_big_5 | |
153 | Setting.default_language = "zh-TW" |
|
155 | Setting.default_language = "zh-TW" | |
154 | str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88" |
|
156 | str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88" | |
155 | str_big5 = "\xa4@\xa4\xeb" |
|
157 | str_big5 = "\xa4@\xa4\xeb" | |
156 | if str_utf8.respond_to?(:force_encoding) |
|
158 | if str_utf8.respond_to?(:force_encoding) | |
157 | str_utf8.force_encoding('UTF-8') |
|
159 | str_utf8.force_encoding('UTF-8') | |
158 | str_big5.force_encoding('Big5') |
|
160 | str_big5.force_encoding('Big5') | |
159 | end |
|
161 | end | |
160 | user = User.find_by_id(3) |
|
162 | user = User.find_by_id(3) | |
161 | user.firstname = str_utf8 |
|
163 | user.firstname = str_utf8 | |
162 | user.lastname = "test-lastname" |
|
164 | user.lastname = "test-lastname" | |
163 | assert user.save |
|
165 | assert user.save | |
164 | comments = "test_csv_big_5" |
|
166 | comments = "test_csv_big_5" | |
165 | te1 = TimeEntry.create(:spent_on => '2011-11-11', |
|
167 | te1 = TimeEntry.create(:spent_on => '2011-11-11', | |
166 | :hours => 7.3, |
|
168 | :hours => 7.3, | |
167 | :project => Project.find(1), |
|
169 | :project => Project.find(1), | |
168 | :user => user, |
|
170 | :user => user, | |
169 | :activity => TimeEntryActivity.find_by_name('Design'), |
|
171 | :activity => TimeEntryActivity.find_by_name('Design'), | |
170 | :comments => comments) |
|
172 | :comments => comments) | |
171 |
|
173 | |||
172 | te2 = TimeEntry.find_by_comments(comments) |
|
174 | te2 = TimeEntry.find_by_comments(comments) | |
173 | assert_not_nil te2 |
|
175 | assert_not_nil te2 | |
174 | assert_equal 7.3, te2.hours |
|
176 | assert_equal 7.3, te2.hours | |
175 | assert_equal 3, te2.user_id |
|
177 | assert_equal 3, te2.user_id | |
176 |
|
178 | |||
177 | get :report, :project_id => 1, :columns => 'day', |
|
179 | get :report, :project_id => 1, :columns => 'day', | |
178 | :from => "2011-11-11", :to => "2011-11-11", |
|
180 | :from => "2011-11-11", :to => "2011-11-11", | |
179 | :criteria => ["member"], :format => "csv" |
|
181 | :criteria => ["member"], :format => "csv" | |
180 | assert_response :success |
|
182 | assert_response :success | |
181 | assert_equal 'text/csv', @response.content_type |
|
183 | assert_equal 'text/csv', @response.content_type | |
182 | lines = @response.body.chomp.split("\n") |
|
184 | lines = @response.body.chomp.split("\n") | |
183 | # Headers |
|
185 | # Headers | |
184 | s1 = "\xa6\xa8\xad\xfb,2011-11-11,\xc1`\xadp" |
|
186 | s1 = "\xa6\xa8\xad\xfb,2011-11-11,\xc1`\xadp" | |
185 | s2 = "\xc1`\xadp" |
|
187 | s2 = "\xc1`\xadp" | |
186 | if s1.respond_to?(:force_encoding) |
|
188 | if s1.respond_to?(:force_encoding) | |
187 | s1.force_encoding('Big5') |
|
189 | s1.force_encoding('Big5') | |
188 | s2.force_encoding('Big5') |
|
190 | s2.force_encoding('Big5') | |
189 | end |
|
191 | end | |
190 | assert_equal s1, lines.first |
|
192 | assert_equal s1, lines.first | |
191 | # Total row |
|
193 | # Total row | |
192 | assert_equal "#{str_big5} #{user.lastname},7.30,7.30", lines[1] |
|
194 | assert_equal "#{str_big5} #{user.lastname},7.30,7.30", lines[1] | |
193 | assert_equal "#{s2},7.30,7.30", lines[2] |
|
195 | assert_equal "#{s2},7.30,7.30", lines[2] | |
194 |
|
196 | |||
195 | str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)" |
|
197 | str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)" | |
196 | if str_tw.respond_to?(:force_encoding) |
|
198 | if str_tw.respond_to?(:force_encoding) | |
197 | str_tw.force_encoding('UTF-8') |
|
199 | str_tw.force_encoding('UTF-8') | |
198 | end |
|
200 | end | |
199 | assert_equal str_tw, l(:general_lang_name) |
|
201 | assert_equal str_tw, l(:general_lang_name) | |
200 | assert_equal 'Big5', l(:general_csv_encoding) |
|
202 | assert_equal 'Big5', l(:general_csv_encoding) | |
201 | assert_equal ',', l(:general_csv_separator) |
|
203 | assert_equal ',', l(:general_csv_separator) | |
202 | assert_equal '.', l(:general_csv_decimal_separator) |
|
204 | assert_equal '.', l(:general_csv_decimal_separator) | |
203 | end |
|
205 | end | |
204 |
|
206 | |||
205 | def test_csv_cannot_convert_should_be_replaced_big_5 |
|
207 | def test_csv_cannot_convert_should_be_replaced_big_5 | |
206 | Setting.default_language = "zh-TW" |
|
208 | Setting.default_language = "zh-TW" | |
207 | str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85" |
|
209 | str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85" | |
208 | if str_utf8.respond_to?(:force_encoding) |
|
210 | if str_utf8.respond_to?(:force_encoding) | |
209 | str_utf8.force_encoding('UTF-8') |
|
211 | str_utf8.force_encoding('UTF-8') | |
210 | end |
|
212 | end | |
211 | user = User.find_by_id(3) |
|
213 | user = User.find_by_id(3) | |
212 | user.firstname = str_utf8 |
|
214 | user.firstname = str_utf8 | |
213 | user.lastname = "test-lastname" |
|
215 | user.lastname = "test-lastname" | |
214 | assert user.save |
|
216 | assert user.save | |
215 | comments = "test_replaced" |
|
217 | comments = "test_replaced" | |
216 | te1 = TimeEntry.create(:spent_on => '2011-11-11', |
|
218 | te1 = TimeEntry.create(:spent_on => '2011-11-11', | |
217 | :hours => 7.3, |
|
219 | :hours => 7.3, | |
218 | :project => Project.find(1), |
|
220 | :project => Project.find(1), | |
219 | :user => user, |
|
221 | :user => user, | |
220 | :activity => TimeEntryActivity.find_by_name('Design'), |
|
222 | :activity => TimeEntryActivity.find_by_name('Design'), | |
221 | :comments => comments) |
|
223 | :comments => comments) | |
222 |
|
224 | |||
223 | te2 = TimeEntry.find_by_comments(comments) |
|
225 | te2 = TimeEntry.find_by_comments(comments) | |
224 | assert_not_nil te2 |
|
226 | assert_not_nil te2 | |
225 | assert_equal 7.3, te2.hours |
|
227 | assert_equal 7.3, te2.hours | |
226 | assert_equal 3, te2.user_id |
|
228 | assert_equal 3, te2.user_id | |
227 |
|
229 | |||
228 | get :report, :project_id => 1, :columns => 'day', |
|
230 | get :report, :project_id => 1, :columns => 'day', | |
229 | :from => "2011-11-11", :to => "2011-11-11", |
|
231 | :from => "2011-11-11", :to => "2011-11-11", | |
230 | :criteria => ["member"], :format => "csv" |
|
232 | :criteria => ["member"], :format => "csv" | |
231 | assert_response :success |
|
233 | assert_response :success | |
232 | assert_equal 'text/csv', @response.content_type |
|
234 | assert_equal 'text/csv', @response.content_type | |
233 | lines = @response.body.chomp.split("\n") |
|
235 | lines = @response.body.chomp.split("\n") | |
234 | # Headers |
|
236 | # Headers | |
235 | s1 = "\xa6\xa8\xad\xfb,2011-11-11,\xc1`\xadp" |
|
237 | s1 = "\xa6\xa8\xad\xfb,2011-11-11,\xc1`\xadp" | |
236 | if s1.respond_to?(:force_encoding) |
|
238 | if s1.respond_to?(:force_encoding) | |
237 | s1.force_encoding('Big5') |
|
239 | s1.force_encoding('Big5') | |
238 | end |
|
240 | end | |
239 | assert_equal s1, lines.first |
|
241 | assert_equal s1, lines.first | |
240 | # Total row |
|
242 | # Total row | |
241 | s2 = "" |
|
243 | s2 = "" | |
242 | if s2.respond_to?(:force_encoding) |
|
244 | if s2.respond_to?(:force_encoding) | |
243 | s2 = "\xa5H?" |
|
245 | s2 = "\xa5H?" | |
244 | s2.force_encoding('Big5') |
|
246 | s2.force_encoding('Big5') | |
245 | elsif RUBY_PLATFORM == 'java' |
|
247 | elsif RUBY_PLATFORM == 'java' | |
246 | s2 = "??" |
|
248 | s2 = "??" | |
247 | else |
|
249 | else | |
248 | s2 = "\xa5H???" |
|
250 | s2 = "\xa5H???" | |
249 | end |
|
251 | end | |
250 | assert_equal "#{s2} #{user.lastname},7.30,7.30", lines[1] |
|
252 | assert_equal "#{s2} #{user.lastname},7.30,7.30", lines[1] | |
251 | end |
|
253 | end | |
252 |
|
254 | |||
253 | def test_csv_fr |
|
255 | def test_csv_fr | |
254 | with_settings :default_language => "fr" do |
|
256 | with_settings :default_language => "fr" do | |
255 | str1 = "test_csv_fr" |
|
257 | str1 = "test_csv_fr" | |
256 | user = User.find_by_id(3) |
|
258 | user = User.find_by_id(3) | |
257 | te1 = TimeEntry.create(:spent_on => '2011-11-11', |
|
259 | te1 = TimeEntry.create(:spent_on => '2011-11-11', | |
258 | :hours => 7.3, |
|
260 | :hours => 7.3, | |
259 | :project => Project.find(1), |
|
261 | :project => Project.find(1), | |
260 | :user => user, |
|
262 | :user => user, | |
261 | :activity => TimeEntryActivity.find_by_name('Design'), |
|
263 | :activity => TimeEntryActivity.find_by_name('Design'), | |
262 | :comments => str1) |
|
264 | :comments => str1) | |
263 |
|
265 | |||
264 | te2 = TimeEntry.find_by_comments(str1) |
|
266 | te2 = TimeEntry.find_by_comments(str1) | |
265 | assert_not_nil te2 |
|
267 | assert_not_nil te2 | |
266 | assert_equal 7.3, te2.hours |
|
268 | assert_equal 7.3, te2.hours | |
267 | assert_equal 3, te2.user_id |
|
269 | assert_equal 3, te2.user_id | |
268 |
|
270 | |||
269 | get :report, :project_id => 1, :columns => 'day', |
|
271 | get :report, :project_id => 1, :columns => 'day', | |
270 | :from => "2011-11-11", :to => "2011-11-11", |
|
272 | :from => "2011-11-11", :to => "2011-11-11", | |
271 | :criteria => ["member"], :format => "csv" |
|
273 | :criteria => ["member"], :format => "csv" | |
272 | assert_response :success |
|
274 | assert_response :success | |
273 | assert_equal 'text/csv', @response.content_type |
|
275 | assert_equal 'text/csv', @response.content_type | |
274 | lines = @response.body.chomp.split("\n") |
|
276 | lines = @response.body.chomp.split("\n") | |
275 | # Headers |
|
277 | # Headers | |
276 | s1 = "Membre;2011-11-11;Total" |
|
278 | s1 = "Membre;2011-11-11;Total" | |
277 | s2 = "Total" |
|
279 | s2 = "Total" | |
278 | if s1.respond_to?(:force_encoding) |
|
280 | if s1.respond_to?(:force_encoding) | |
279 | s1.force_encoding('ISO-8859-1') |
|
281 | s1.force_encoding('ISO-8859-1') | |
280 | s2.force_encoding('ISO-8859-1') |
|
282 | s2.force_encoding('ISO-8859-1') | |
281 | end |
|
283 | end | |
282 | assert_equal s1, lines.first |
|
284 | assert_equal s1, lines.first | |
283 | # Total row |
|
285 | # Total row | |
284 | assert_equal "#{user.firstname} #{user.lastname};7,30;7,30", lines[1] |
|
286 | assert_equal "#{user.firstname} #{user.lastname};7,30;7,30", lines[1] | |
285 | assert_equal "#{s2};7,30;7,30", lines[2] |
|
287 | assert_equal "#{s2};7,30;7,30", lines[2] | |
286 |
|
288 | |||
287 | str_fr = "Fran\xc3\xa7ais" |
|
289 | str_fr = "Fran\xc3\xa7ais" | |
288 | if str_fr.respond_to?(:force_encoding) |
|
290 | if str_fr.respond_to?(:force_encoding) | |
289 | str_fr.force_encoding('UTF-8') |
|
291 | str_fr.force_encoding('UTF-8') | |
290 | end |
|
292 | end | |
291 | assert_equal str_fr, l(:general_lang_name) |
|
293 | assert_equal str_fr, l(:general_lang_name) | |
292 | assert_equal 'ISO-8859-1', l(:general_csv_encoding) |
|
294 | assert_equal 'ISO-8859-1', l(:general_csv_encoding) | |
293 | assert_equal ';', l(:general_csv_separator) |
|
295 | assert_equal ';', l(:general_csv_separator) | |
294 | assert_equal ',', l(:general_csv_decimal_separator) |
|
296 | assert_equal ',', l(:general_csv_decimal_separator) | |
295 | end |
|
297 | end | |
296 | end |
|
298 | end | |
297 | end |
|
299 | end |
@@ -1,427 +1,425 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../test_helper', __FILE__) | |
19 |
|
19 | |||
20 | class RoutingTest < ActionController::IntegrationTest |
|
20 | class RoutingTest < ActionController::IntegrationTest | |
21 | context "activities" do |
|
21 | context "activities" do | |
22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil |
|
22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil | |
23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' |
|
23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' | |
24 | end |
|
24 | end | |
25 |
|
25 | |||
26 | context "attachments" do |
|
26 | context "attachments" do | |
27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' |
|
27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' | |
28 | should_route :get, "/attachments/1.xml", :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml' |
|
28 | should_route :get, "/attachments/1.xml", :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml' | |
29 | should_route :get, "/attachments/1.json", :controller => 'attachments', :action => 'show', :id => '1', :format => 'json' |
|
29 | should_route :get, "/attachments/1.json", :controller => 'attachments', :action => 'show', :id => '1', :format => 'json' | |
30 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' |
|
30 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' | |
31 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' |
|
31 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' | |
32 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' |
|
32 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | context "boards" do |
|
35 | context "boards" do | |
36 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' |
|
36 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' | |
37 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
37 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |
38 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' |
|
38 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' | |
39 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' |
|
39 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' | |
40 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
40 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' | |
41 |
|
41 | |||
42 | should_route :post, "/projects/world_domination/boards", :controller => 'boards', :action => 'create', :project_id => 'world_domination' |
|
42 | should_route :post, "/projects/world_domination/boards", :controller => 'boards', :action => 'create', :project_id => 'world_domination' | |
43 | should_route :put, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44' |
|
43 | should_route :put, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44' | |
44 | should_route :delete, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' |
|
44 | should_route :delete, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' | |
45 |
|
45 | |||
46 | end |
|
46 | end | |
47 |
|
47 | |||
48 | context "documents" do |
|
48 | context "documents" do | |
49 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' |
|
49 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' | |
50 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
50 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' | |
51 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' |
|
51 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' | |
52 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' |
|
52 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' | |
53 |
|
53 | |||
54 | should_route :post, "/projects/567/documents", :controller => 'documents', :action => 'create', :project_id => '567' |
|
54 | should_route :post, "/projects/567/documents", :controller => 'documents', :action => 'create', :project_id => '567' | |
55 | should_route :put, "/documents/22", :controller => 'documents', :action => 'update', :id => '22' |
|
55 | should_route :put, "/documents/22", :controller => 'documents', :action => 'update', :id => '22' | |
56 | should_route :delete, "/documents/22", :controller => 'documents', :action => 'destroy', :id => '22' |
|
56 | should_route :delete, "/documents/22", :controller => 'documents', :action => 'destroy', :id => '22' | |
57 |
|
57 | |||
58 | should_route :post, "/documents/22/add_attachment", :controller => 'documents', :action => 'add_attachment', :id => '22' |
|
58 | should_route :post, "/documents/22/add_attachment", :controller => 'documents', :action => 'add_attachment', :id => '22' | |
59 | end |
|
59 | end | |
60 |
|
60 | |||
61 | context "groups" do |
|
61 | context "groups" do | |
62 | should_route :post, "/groups/567/users", :controller => 'groups', :action => 'add_users', :id => '567' |
|
62 | should_route :post, "/groups/567/users", :controller => 'groups', :action => 'add_users', :id => '567' | |
63 | should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12' |
|
63 | should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12' | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | context "issues" do |
|
66 | context "issues" do | |
67 | # REST actions |
|
67 | # REST actions | |
68 | should_route :get, "/issues", :controller => 'issues', :action => 'index' |
|
68 | should_route :get, "/issues", :controller => 'issues', :action => 'index' | |
69 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' |
|
69 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' | |
70 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' |
|
70 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' | |
71 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' |
|
71 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' | |
72 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' |
|
72 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' | |
73 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' |
|
73 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' | |
74 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' |
|
74 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' | |
75 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' |
|
75 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' | |
76 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' |
|
76 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' | |
77 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' |
|
77 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' | |
78 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' |
|
78 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' | |
79 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' |
|
79 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' | |
80 |
|
80 | |||
81 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' |
|
81 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' | |
82 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' |
|
82 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' | |
83 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' |
|
83 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' | |
84 |
|
84 | |||
85 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
85 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' | |
86 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' |
|
86 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' | |
87 |
|
87 | |||
88 | # TODO: Should use DELETE |
|
88 | # TODO: Should use DELETE | |
89 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' |
|
89 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' | |
90 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' |
|
90 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' | |
91 |
|
91 | |||
92 | # Extra actions |
|
92 | # Extra actions | |
93 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' |
|
93 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' | |
94 |
|
94 | |||
95 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' |
|
95 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' | |
96 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' |
|
96 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' | |
97 |
|
97 | |||
98 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' |
|
98 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' | |
99 |
|
99 | |||
100 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' |
|
100 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' | |
101 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' |
|
101 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' | |
102 |
|
102 | |||
103 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' |
|
103 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' | |
104 | should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf' |
|
104 | should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf' | |
105 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' |
|
105 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' | |
106 | should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf' |
|
106 | should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf' | |
107 |
|
107 | |||
108 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' |
|
108 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' | |
109 |
|
109 | |||
110 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
110 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' | |
111 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
111 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' | |
112 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
112 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' | |
113 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
113 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' | |
114 |
|
114 | |||
115 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' |
|
115 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' | |
116 |
|
116 | |||
117 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' |
|
117 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' | |
118 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' |
|
118 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' | |
119 | end |
|
119 | end | |
120 |
|
120 | |||
121 | context "issue categories" do |
|
121 | context "issue categories" do | |
122 | should_route :get, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'index', :project_id => 'foo' |
|
122 | should_route :get, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'index', :project_id => 'foo' | |
123 | should_route :get, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'xml' |
|
123 | should_route :get, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'xml' | |
124 | should_route :get, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'json' |
|
124 | should_route :get, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'json' | |
125 |
|
125 | |||
126 | should_route :get, "/projects/foo/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'foo' |
|
126 | should_route :get, "/projects/foo/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'foo' | |
127 |
|
127 | |||
128 | should_route :post, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'create', :project_id => 'foo' |
|
128 | should_route :post, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'create', :project_id => 'foo' | |
129 | should_route :post, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'xml' |
|
129 | should_route :post, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'xml' | |
130 | should_route :post, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'json' |
|
130 | should_route :post, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'json' | |
131 |
|
131 | |||
132 | should_route :get, "/issue_categories/1", :controller => 'issue_categories', :action => 'show', :id => '1' |
|
132 | should_route :get, "/issue_categories/1", :controller => 'issue_categories', :action => 'show', :id => '1' | |
133 | should_route :get, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'xml' |
|
133 | should_route :get, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'xml' | |
134 | should_route :get, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'json' |
|
134 | should_route :get, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'json' | |
135 |
|
135 | |||
136 | should_route :get, "/issue_categories/1/edit", :controller => 'issue_categories', :action => 'edit', :id => '1' |
|
136 | should_route :get, "/issue_categories/1/edit", :controller => 'issue_categories', :action => 'edit', :id => '1' | |
137 |
|
137 | |||
138 | should_route :put, "/issue_categories/1", :controller => 'issue_categories', :action => 'update', :id => '1' |
|
138 | should_route :put, "/issue_categories/1", :controller => 'issue_categories', :action => 'update', :id => '1' | |
139 | should_route :put, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'xml' |
|
139 | should_route :put, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'xml' | |
140 | should_route :put, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'json' |
|
140 | should_route :put, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'json' | |
141 |
|
141 | |||
142 | should_route :delete, "/issue_categories/1", :controller => 'issue_categories', :action => 'destroy', :id => '1' |
|
142 | should_route :delete, "/issue_categories/1", :controller => 'issue_categories', :action => 'destroy', :id => '1' | |
143 | should_route :delete, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'xml' |
|
143 | should_route :delete, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'xml' | |
144 | should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json' |
|
144 | should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json' | |
145 | end |
|
145 | end | |
146 |
|
146 | |||
147 | context "issue relations" do |
|
147 | context "issue relations" do | |
148 | should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1' |
|
148 | should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1' | |
149 | should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml' |
|
149 | should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml' | |
150 | should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json' |
|
150 | should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json' | |
151 |
|
151 | |||
152 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1' |
|
152 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1' | |
153 | should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml' |
|
153 | should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml' | |
154 | should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json' |
|
154 | should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json' | |
155 |
|
155 | |||
156 | should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23' |
|
156 | should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23' | |
157 | should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml' |
|
157 | should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml' | |
158 | should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json' |
|
158 | should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json' | |
159 |
|
159 | |||
160 | should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23' |
|
160 | should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23' | |
161 | should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml' |
|
161 | should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml' | |
162 | should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json' |
|
162 | should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json' | |
163 | end |
|
163 | end | |
164 |
|
164 | |||
165 | context "issue reports" do |
|
165 | context "issue reports" do | |
166 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' |
|
166 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' | |
167 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' |
|
167 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' | |
168 | end |
|
168 | end | |
169 |
|
169 | |||
170 | context "members" do |
|
170 | context "members" do | |
171 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' |
|
171 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' | |
172 | end |
|
172 | end | |
173 |
|
173 | |||
174 | context "messages" do |
|
174 | context "messages" do | |
175 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' |
|
175 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' | |
176 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
176 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |
177 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
177 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |
178 |
|
178 | |||
179 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
179 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |
180 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
180 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |
181 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' |
|
181 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' | |
182 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' |
|
182 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' | |
183 | end |
|
183 | end | |
184 |
|
184 | |||
185 | context "news" do |
|
185 | context "news" do | |
186 | should_route :get, "/news", :controller => 'news', :action => 'index' |
|
186 | should_route :get, "/news", :controller => 'news', :action => 'index' | |
187 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' |
|
187 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' | |
188 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' |
|
188 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' | |
189 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' |
|
189 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' | |
190 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' |
|
190 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' | |
191 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' |
|
191 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' | |
192 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' |
|
192 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' | |
193 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' |
|
193 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' | |
194 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' |
|
194 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' | |
195 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
195 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' | |
196 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' |
|
196 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' | |
197 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' |
|
197 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' | |
198 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' |
|
198 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' | |
199 |
|
199 | |||
200 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' |
|
200 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' | |
201 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' |
|
201 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' | |
202 |
|
202 | |||
203 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' |
|
203 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' | |
204 |
|
204 | |||
205 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' |
|
205 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' | |
206 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' |
|
206 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' | |
207 | end |
|
207 | end | |
208 |
|
208 | |||
209 | context "projects" do |
|
209 | context "projects" do | |
210 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
210 | should_route :get, "/projects", :controller => 'projects', :action => 'index' | |
211 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
211 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' | |
212 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
212 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' | |
213 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' |
|
213 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' | |
214 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
214 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' | |
215 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
215 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' | |
216 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
216 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' | |
217 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' |
|
217 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' | |
218 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' |
|
218 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' | |
219 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' |
|
219 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' | |
220 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' |
|
220 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' | |
221 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' |
|
221 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' | |
222 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' |
|
222 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' | |
223 |
|
223 | |||
224 | should_route :post, "/projects", :controller => 'projects', :action => 'create' |
|
224 | should_route :post, "/projects", :controller => 'projects', :action => 'create' | |
225 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' |
|
225 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' | |
226 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' |
|
226 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' | |
227 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' |
|
227 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' | |
228 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' |
|
228 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' | |
229 |
|
229 | |||
230 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' |
|
230 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' | |
231 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' |
|
231 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' | |
232 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' |
|
232 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' | |
233 |
|
233 | |||
234 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' |
|
234 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' | |
235 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' |
|
235 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' | |
236 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' |
|
236 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' | |
237 | end |
|
237 | end | |
238 |
|
238 | |||
239 | context "queries" do |
|
239 | context "queries" do | |
240 | should_route :get, "/queries.xml", :controller => 'queries', :action => 'index', :format => 'xml' |
|
240 | should_route :get, "/queries.xml", :controller => 'queries', :action => 'index', :format => 'xml' | |
241 | should_route :get, "/queries.json", :controller => 'queries', :action => 'index', :format => 'json' |
|
241 | should_route :get, "/queries.json", :controller => 'queries', :action => 'index', :format => 'json' | |
242 |
|
242 | |||
243 | should_route :get, "/queries/new", :controller => 'queries', :action => 'new' |
|
243 | should_route :get, "/queries/new", :controller => 'queries', :action => 'new' | |
244 | should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine' |
|
244 | should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine' | |
245 |
|
245 | |||
246 | should_route :post, "/queries", :controller => 'queries', :action => 'create' |
|
246 | should_route :post, "/queries", :controller => 'queries', :action => 'create' | |
247 | should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine' |
|
247 | should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine' | |
248 |
|
248 | |||
249 | should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1' |
|
249 | should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1' | |
250 |
|
250 | |||
251 | should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1' |
|
251 | should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1' | |
252 |
|
252 | |||
253 | should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1' |
|
253 | should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1' | |
254 | end |
|
254 | end | |
255 |
|
255 | |||
256 | context "repositories" do |
|
256 | context "repositories" do | |
257 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' |
|
257 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' | |
258 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
258 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
259 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' |
|
259 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' | |
260 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' |
|
260 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' | |
261 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' |
|
261 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' | |
262 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' |
|
262 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' | |
263 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' |
|
263 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' | |
264 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] |
|
264 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] | |
265 | 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' |
|
265 | 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' | |
266 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] |
|
266 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] | |
267 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] |
|
267 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] | |
268 | 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' |
|
268 | 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' | |
269 | 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' |
|
269 | 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' | |
270 | 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' |
|
270 | 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' | |
271 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] |
|
271 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] | |
272 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] |
|
272 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] | |
273 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' |
|
273 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' | |
274 |
|
274 | |||
275 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
275 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
276 | end |
|
276 | end | |
277 |
|
277 | |||
278 | context "timelogs (global)" do |
|
278 | context "timelogs (global)" do | |
279 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'index' |
|
279 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'index' | |
280 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv' |
|
280 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv' | |
281 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom' |
|
281 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom' | |
282 | should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new' |
|
282 | should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new' | |
283 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' |
|
283 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' | |
284 |
|
284 | |||
285 | should_route :post, "/time_entries", :controller => 'timelog', :action => 'create' |
|
285 | should_route :post, "/time_entries", :controller => 'timelog', :action => 'create' | |
286 |
|
286 | |||
287 | should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22' |
|
287 | should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22' | |
288 |
|
288 | |||
289 | should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55' |
|
289 | should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55' | |
290 | end |
|
290 | end | |
291 |
|
291 | |||
292 | context "timelogs (scoped under project)" do |
|
292 | context "timelogs (scoped under project)" do | |
293 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' |
|
293 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' | |
294 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' |
|
294 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' | |
295 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom' |
|
295 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom' | |
296 | should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567' |
|
296 | should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567' | |
297 | should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567' |
|
297 | should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567' | |
298 |
|
298 | |||
299 | should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567' |
|
299 | should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567' | |
300 |
|
300 | |||
301 | should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567' |
|
301 | should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567' | |
302 |
|
302 | |||
303 | should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567' |
|
303 | should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567' | |
304 | end |
|
304 | end | |
305 |
|
305 | |||
306 | context "timelogs (scoped under issues)" do |
|
306 | context "timelogs (scoped under issues)" do | |
307 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234' |
|
307 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234' | |
308 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv' |
|
308 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv' | |
309 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom' |
|
309 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom' | |
310 | should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234' |
|
310 | should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234' | |
311 | should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234' |
|
311 | should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234' | |
312 |
|
312 | |||
313 | should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234' |
|
313 | should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234' | |
314 |
|
314 | |||
315 | should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234' |
|
315 | should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234' | |
316 |
|
316 | |||
317 | should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234' |
|
317 | should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234' | |
318 | end |
|
318 | end | |
319 |
|
319 | |||
320 | context "timelogs (scoped under project and issues)" do |
|
320 | context "timelogs (scoped under project and issues)" do | |
321 | should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook' |
|
321 | should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook' | |
322 | should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' |
|
322 | should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' | |
323 | should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' |
|
323 | should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' | |
324 | should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook' |
|
324 | should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook' | |
325 | should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
325 | should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook' | |
326 |
|
326 | |||
327 | should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook' |
|
327 | should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook' | |
328 |
|
328 | |||
329 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
329 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' | |
330 |
|
330 | |||
331 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' |
|
331 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' | |
332 | end |
|
|||
333 |
|
332 | |||
334 | context "time_entry_reports" do |
|
333 | should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report' | |
335 |
should_route :get, "/time_entries/report", :controller => 'time |
|
334 | should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567' | |
336 |
should_route :get, "/projects/567/time_entries/report", :controller => 'time |
|
335 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv' | |
337 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' |
|
|||
338 | end |
|
336 | end | |
339 |
|
337 | |||
340 | context "users" do |
|
338 | context "users" do | |
341 | should_route :get, "/users", :controller => 'users', :action => 'index' |
|
339 | should_route :get, "/users", :controller => 'users', :action => 'index' | |
342 | should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml' |
|
340 | should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml' | |
343 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' |
|
341 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' | |
344 | should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml' |
|
342 | should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml' | |
345 | should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current' |
|
343 | should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current' | |
346 | should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml' |
|
344 | should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml' | |
347 | should_route :get, "/users/new", :controller => 'users', :action => 'new' |
|
345 | should_route :get, "/users/new", :controller => 'users', :action => 'new' | |
348 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
346 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' | |
349 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' |
|
347 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' | |
350 |
|
348 | |||
351 | should_route :post, "/users", :controller => 'users', :action => 'create' |
|
349 | should_route :post, "/users", :controller => 'users', :action => 'create' | |
352 | should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml' |
|
350 | should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml' | |
353 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' |
|
351 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' | |
354 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' |
|
352 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' | |
355 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
353 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' | |
356 |
|
354 | |||
357 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' |
|
355 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' | |
358 | should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml' |
|
356 | should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml' | |
359 |
|
357 | |||
360 | should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44' |
|
358 | should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44' | |
361 | should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml' |
|
359 | should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml' | |
362 | end |
|
360 | end | |
363 |
|
361 | |||
364 | context "versions" do |
|
362 | context "versions" do | |
365 | # /projects/foo/versions is /projects/foo/roadmap |
|
363 | # /projects/foo/versions is /projects/foo/roadmap | |
366 | should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml' |
|
364 | should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml' | |
367 | should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json' |
|
365 | should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json' | |
368 |
|
366 | |||
369 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
367 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' | |
370 |
|
368 | |||
371 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' |
|
369 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' | |
372 | should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml' |
|
370 | should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml' | |
373 | should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json' |
|
371 | should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json' | |
374 |
|
372 | |||
375 | should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1' |
|
373 | should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1' | |
376 | should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml' |
|
374 | should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml' | |
377 | should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json' |
|
375 | should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json' | |
378 |
|
376 | |||
379 | should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1' |
|
377 | should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1' | |
380 |
|
378 | |||
381 | should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1' |
|
379 | should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1' | |
382 | should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml' |
|
380 | should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml' | |
383 | should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json' |
|
381 | should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json' | |
384 |
|
382 | |||
385 | should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1' |
|
383 | should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1' | |
386 | should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml' |
|
384 | should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml' | |
387 | should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json' |
|
385 | should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json' | |
388 |
|
386 | |||
389 | should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo' |
|
387 | should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo' | |
390 | should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1' |
|
388 | should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1' | |
391 | end |
|
389 | end | |
392 |
|
390 | |||
393 | context "wiki (singular, project's pages)" do |
|
391 | context "wiki (singular, project's pages)" do | |
394 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' |
|
392 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' | |
395 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala' |
|
393 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala' | |
396 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page' |
|
394 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page' | |
397 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation' |
|
395 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation' | |
398 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation' |
|
396 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation' | |
399 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2' |
|
397 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2' | |
400 | 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' |
|
398 | 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' | |
401 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2' |
|
399 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2' | |
402 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' |
|
400 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' | |
403 | should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' |
|
401 | should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' | |
404 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' |
|
402 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' | |
405 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' |
|
403 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' | |
406 |
|
404 | |||
407 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation' |
|
405 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation' | |
408 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' |
|
406 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' | |
409 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida' |
|
407 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida' | |
410 | should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida' |
|
408 | should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida' | |
411 |
|
409 | |||
412 | should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page' |
|
410 | should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page' | |
413 |
|
411 | |||
414 | should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida' |
|
412 | should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida' | |
415 | end |
|
413 | end | |
416 |
|
414 | |||
417 | context "wikis (plural, admin setup)" do |
|
415 | context "wikis (plural, admin setup)" do | |
418 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
416 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
419 |
|
417 | |||
420 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' |
|
418 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' | |
421 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
419 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
422 | end |
|
420 | end | |
423 |
|
421 | |||
424 | context "administration panel" do |
|
422 | context "administration panel" do | |
425 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' |
|
423 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' | |
426 | end |
|
424 | end | |
427 | end |
|
425 | end |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now