@@ -1,190 +1,190 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 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, :authorize, :only => [:edit, :destroy] |
|
20 | before_filter :find_project, :authorize, :only => [:edit, :destroy] | |
21 |
before_filter :find_optional_project, :only => [: |
|
21 | before_filter :find_optional_project, :only => [:index] | |
22 |
|
22 | |||
23 |
verify :method => :post, :only => :destroy, :redirect_to => { :action => : |
|
23 | verify :method => :post, :only => :destroy, :redirect_to => { :action => :index } | |
24 |
|
24 | |||
25 | helper :sort |
|
25 | helper :sort | |
26 | include SortHelper |
|
26 | include SortHelper | |
27 | helper :issues |
|
27 | helper :issues | |
28 | include TimelogHelper |
|
28 | include TimelogHelper | |
29 | helper :custom_fields |
|
29 | helper :custom_fields | |
30 | include CustomFieldsHelper |
|
30 | include CustomFieldsHelper | |
31 |
|
31 | |||
32 |
def |
|
32 | def index | |
33 | sort_init 'spent_on', 'desc' |
|
33 | sort_init 'spent_on', 'desc' | |
34 | sort_update 'spent_on' => 'spent_on', |
|
34 | sort_update 'spent_on' => 'spent_on', | |
35 | 'user' => 'user_id', |
|
35 | 'user' => 'user_id', | |
36 | 'activity' => 'activity_id', |
|
36 | 'activity' => 'activity_id', | |
37 | 'project' => "#{Project.table_name}.name", |
|
37 | 'project' => "#{Project.table_name}.name", | |
38 | 'issue' => 'issue_id', |
|
38 | 'issue' => 'issue_id', | |
39 | 'hours' => 'hours' |
|
39 | 'hours' => 'hours' | |
40 |
|
40 | |||
41 | cond = ARCondition.new |
|
41 | cond = ARCondition.new | |
42 | if @project.nil? |
|
42 | if @project.nil? | |
43 | cond << Project.allowed_to_condition(User.current, :view_time_entries) |
|
43 | cond << Project.allowed_to_condition(User.current, :view_time_entries) | |
44 | elsif @issue.nil? |
|
44 | elsif @issue.nil? | |
45 | cond << @project.project_condition(Setting.display_subprojects_issues?) |
|
45 | cond << @project.project_condition(Setting.display_subprojects_issues?) | |
46 | else |
|
46 | else | |
47 | cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" |
|
47 | cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" | |
48 | end |
|
48 | end | |
49 |
|
49 | |||
50 | retrieve_date_range |
|
50 | retrieve_date_range | |
51 | cond << ['spent_on BETWEEN ? AND ?', @from, @to] |
|
51 | cond << ['spent_on BETWEEN ? AND ?', @from, @to] | |
52 |
|
52 | |||
53 | TimeEntry.visible_by(User.current) do |
|
53 | TimeEntry.visible_by(User.current) do | |
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.count(:include => [:project, :issue], :conditions => cond.conditions) |
|
57 | @entry_count = TimeEntry.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.find(:all, |
|
59 | @entries = TimeEntry.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.sum(:hours, :include => [:project, :issue], :conditions => cond.conditions).to_f |
|
65 | @total_hours = TimeEntry.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.atom { |
|
69 | format.atom { | |
70 | entries = TimeEntry.find(:all, |
|
70 | entries = TimeEntry.find(:all, | |
71 | :include => [:project, :activity, :user, {:issue => :tracker}], |
|
71 | :include => [:project, :activity, :user, {:issue => :tracker}], | |
72 | :conditions => cond.conditions, |
|
72 | :conditions => cond.conditions, | |
73 | :order => "#{TimeEntry.table_name}.created_on DESC", |
|
73 | :order => "#{TimeEntry.table_name}.created_on DESC", | |
74 | :limit => Setting.feeds_limit.to_i) |
|
74 | :limit => Setting.feeds_limit.to_i) | |
75 | render_feed(entries, :title => l(:label_spent_time)) |
|
75 | render_feed(entries, :title => l(:label_spent_time)) | |
76 | } |
|
76 | } | |
77 | format.csv { |
|
77 | format.csv { | |
78 | # Export all entries |
|
78 | # Export all entries | |
79 | @entries = TimeEntry.find(:all, |
|
79 | @entries = TimeEntry.find(:all, | |
80 | :include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}], |
|
80 | :include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}], | |
81 | :conditions => cond.conditions, |
|
81 | :conditions => cond.conditions, | |
82 | :order => sort_clause) |
|
82 | :order => sort_clause) | |
83 | send_data(entries_to_csv(@entries), :type => 'text/csv; header=present', :filename => 'timelog.csv') |
|
83 | send_data(entries_to_csv(@entries), :type => 'text/csv; header=present', :filename => 'timelog.csv') | |
84 | } |
|
84 | } | |
85 | end |
|
85 | end | |
86 | end |
|
86 | end | |
87 | end |
|
87 | end | |
88 |
|
88 | |||
89 | def edit |
|
89 | def edit | |
90 | (render_403; return) if @time_entry && !@time_entry.editable_by?(User.current) |
|
90 | (render_403; return) if @time_entry && !@time_entry.editable_by?(User.current) | |
91 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) |
|
91 | @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) | |
92 | @time_entry.attributes = params[:time_entry] |
|
92 | @time_entry.attributes = params[:time_entry] | |
93 |
|
93 | |||
94 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
|
94 | call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | |
95 |
|
95 | |||
96 | if request.post? and @time_entry.save |
|
96 | if request.post? and @time_entry.save | |
97 | flash[:notice] = l(:notice_successful_update) |
|
97 | flash[:notice] = l(:notice_successful_update) | |
98 |
redirect_back_or_default :action => ' |
|
98 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project | |
99 | return |
|
99 | return | |
100 | end |
|
100 | end | |
101 | end |
|
101 | end | |
102 |
|
102 | |||
103 | def destroy |
|
103 | def destroy | |
104 | (render_404; return) unless @time_entry |
|
104 | (render_404; return) unless @time_entry | |
105 | (render_403; return) unless @time_entry.editable_by?(User.current) |
|
105 | (render_403; return) unless @time_entry.editable_by?(User.current) | |
106 | if @time_entry.destroy && @time_entry.destroyed? |
|
106 | if @time_entry.destroy && @time_entry.destroyed? | |
107 | flash[:notice] = l(:notice_successful_delete) |
|
107 | flash[:notice] = l(:notice_successful_delete) | |
108 | else |
|
108 | else | |
109 | flash[:error] = l(:notice_unable_delete_time_entry) |
|
109 | flash[:error] = l(:notice_unable_delete_time_entry) | |
110 | end |
|
110 | end | |
111 | redirect_to :back |
|
111 | redirect_to :back | |
112 | rescue ::ActionController::RedirectBackError |
|
112 | rescue ::ActionController::RedirectBackError | |
113 |
redirect_to :action => ' |
|
113 | redirect_to :action => 'index', :project_id => @time_entry.project | |
114 | end |
|
114 | end | |
115 |
|
115 | |||
116 | private |
|
116 | private | |
117 | def find_project |
|
117 | def find_project | |
118 | if params[:id] |
|
118 | if params[:id] | |
119 | @time_entry = TimeEntry.find(params[:id]) |
|
119 | @time_entry = TimeEntry.find(params[:id]) | |
120 | @project = @time_entry.project |
|
120 | @project = @time_entry.project | |
121 | elsif params[:issue_id] |
|
121 | elsif params[:issue_id] | |
122 | @issue = Issue.find(params[:issue_id]) |
|
122 | @issue = Issue.find(params[:issue_id]) | |
123 | @project = @issue.project |
|
123 | @project = @issue.project | |
124 | elsif params[:project_id] |
|
124 | elsif params[:project_id] | |
125 | @project = Project.find(params[:project_id]) |
|
125 | @project = Project.find(params[:project_id]) | |
126 | else |
|
126 | else | |
127 | render_404 |
|
127 | render_404 | |
128 | return false |
|
128 | return false | |
129 | end |
|
129 | end | |
130 | rescue ActiveRecord::RecordNotFound |
|
130 | rescue ActiveRecord::RecordNotFound | |
131 | render_404 |
|
131 | render_404 | |
132 | end |
|
132 | end | |
133 |
|
133 | |||
134 | def find_optional_project |
|
134 | def find_optional_project | |
135 | if !params[:issue_id].blank? |
|
135 | if !params[:issue_id].blank? | |
136 | @issue = Issue.find(params[:issue_id]) |
|
136 | @issue = Issue.find(params[:issue_id]) | |
137 | @project = @issue.project |
|
137 | @project = @issue.project | |
138 | elsif !params[:project_id].blank? |
|
138 | elsif !params[:project_id].blank? | |
139 | @project = Project.find(params[:project_id]) |
|
139 | @project = Project.find(params[:project_id]) | |
140 | end |
|
140 | end | |
141 | deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true) |
|
141 | deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true) | |
142 | end |
|
142 | end | |
143 |
|
143 | |||
144 | # Retrieves the date range based on predefined ranges or specific from/to param dates |
|
144 | # Retrieves the date range based on predefined ranges or specific from/to param dates | |
145 | def retrieve_date_range |
|
145 | def retrieve_date_range | |
146 | @free_period = false |
|
146 | @free_period = false | |
147 | @from, @to = nil, nil |
|
147 | @from, @to = nil, nil | |
148 |
|
148 | |||
149 | if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?) |
|
149 | if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?) | |
150 | case params[:period].to_s |
|
150 | case params[:period].to_s | |
151 | when 'today' |
|
151 | when 'today' | |
152 | @from = @to = Date.today |
|
152 | @from = @to = Date.today | |
153 | when 'yesterday' |
|
153 | when 'yesterday' | |
154 | @from = @to = Date.today - 1 |
|
154 | @from = @to = Date.today - 1 | |
155 | when 'current_week' |
|
155 | when 'current_week' | |
156 | @from = Date.today - (Date.today.cwday - 1)%7 |
|
156 | @from = Date.today - (Date.today.cwday - 1)%7 | |
157 | @to = @from + 6 |
|
157 | @to = @from + 6 | |
158 | when 'last_week' |
|
158 | when 'last_week' | |
159 | @from = Date.today - 7 - (Date.today.cwday - 1)%7 |
|
159 | @from = Date.today - 7 - (Date.today.cwday - 1)%7 | |
160 | @to = @from + 6 |
|
160 | @to = @from + 6 | |
161 | when '7_days' |
|
161 | when '7_days' | |
162 | @from = Date.today - 7 |
|
162 | @from = Date.today - 7 | |
163 | @to = Date.today |
|
163 | @to = Date.today | |
164 | when 'current_month' |
|
164 | when 'current_month' | |
165 | @from = Date.civil(Date.today.year, Date.today.month, 1) |
|
165 | @from = Date.civil(Date.today.year, Date.today.month, 1) | |
166 | @to = (@from >> 1) - 1 |
|
166 | @to = (@from >> 1) - 1 | |
167 | when 'last_month' |
|
167 | when 'last_month' | |
168 | @from = Date.civil(Date.today.year, Date.today.month, 1) << 1 |
|
168 | @from = Date.civil(Date.today.year, Date.today.month, 1) << 1 | |
169 | @to = (@from >> 1) - 1 |
|
169 | @to = (@from >> 1) - 1 | |
170 | when '30_days' |
|
170 | when '30_days' | |
171 | @from = Date.today - 30 |
|
171 | @from = Date.today - 30 | |
172 | @to = Date.today |
|
172 | @to = Date.today | |
173 | when 'current_year' |
|
173 | when 'current_year' | |
174 | @from = Date.civil(Date.today.year, 1, 1) |
|
174 | @from = Date.civil(Date.today.year, 1, 1) | |
175 | @to = Date.civil(Date.today.year, 12, 31) |
|
175 | @to = Date.civil(Date.today.year, 12, 31) | |
176 | end |
|
176 | end | |
177 | elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?)) |
|
177 | elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?)) | |
178 | begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end |
|
178 | begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end | |
179 | begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end |
|
179 | begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end | |
180 | @free_period = true |
|
180 | @free_period = true | |
181 | else |
|
181 | else | |
182 | # default |
|
182 | # default | |
183 | end |
|
183 | end | |
184 |
|
184 | |||
185 | @from, @to = @to, @from if @from && @to && @from > @to |
|
185 | @from, @to = @to, @from if @from && @to && @from > @to | |
186 | @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today) |
|
186 | @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today) | |
187 | @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today) |
|
187 | @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today) | |
188 | end |
|
188 | end | |
189 |
|
189 | |||
190 | end |
|
190 | end |
@@ -1,134 +1,134 | |||||
1 | <%= render :partial => 'action_menu' %> |
|
1 | <%= render :partial => 'action_menu' %> | |
2 |
|
2 | |||
3 | <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> |
|
3 | <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> | |
4 |
|
4 | |||
5 | <div class="<%= @issue.css_classes %> details"> |
|
5 | <div class="<%= @issue.css_classes %> details"> | |
6 | <%= avatar(@issue.author, :size => "50") %> |
|
6 | <%= avatar(@issue.author, :size => "50") %> | |
7 |
|
7 | |||
8 | <div class="subject"> |
|
8 | <div class="subject"> | |
9 | <%= render_issue_subject_with_tree(@issue) %> |
|
9 | <%= render_issue_subject_with_tree(@issue) %> | |
10 | </div> |
|
10 | </div> | |
11 | <p class="author"> |
|
11 | <p class="author"> | |
12 | <%= authoring @issue.created_on, @issue.author %>. |
|
12 | <%= authoring @issue.created_on, @issue.author %>. | |
13 | <% if @issue.created_on != @issue.updated_on %> |
|
13 | <% if @issue.created_on != @issue.updated_on %> | |
14 | <%= l(:label_updated_time, time_tag(@issue.updated_on)) %>. |
|
14 | <%= l(:label_updated_time, time_tag(@issue.updated_on)) %>. | |
15 | <% end %> |
|
15 | <% end %> | |
16 | </p> |
|
16 | </p> | |
17 |
|
17 | |||
18 | <table class="attributes"> |
|
18 | <table class="attributes"> | |
19 | <tr> |
|
19 | <tr> | |
20 | <th class="status"><%=l(:field_status)%>:</th><td class="status"><%= @issue.status.name %></td> |
|
20 | <th class="status"><%=l(:field_status)%>:</th><td class="status"><%= @issue.status.name %></td> | |
21 | <th class="start-date"><%=l(:field_start_date)%>:</th><td class="start-date"><%= format_date(@issue.start_date) %></td> |
|
21 | <th class="start-date"><%=l(:field_start_date)%>:</th><td class="start-date"><%= format_date(@issue.start_date) %></td> | |
22 | </tr> |
|
22 | </tr> | |
23 | <tr> |
|
23 | <tr> | |
24 | <th class="priority"><%=l(:field_priority)%>:</th><td class="priority"><%= @issue.priority.name %></td> |
|
24 | <th class="priority"><%=l(:field_priority)%>:</th><td class="priority"><%= @issue.priority.name %></td> | |
25 | <th class="due-date"><%=l(:field_due_date)%>:</th><td class="due-date"><%= format_date(@issue.due_date) %></td> |
|
25 | <th class="due-date"><%=l(:field_due_date)%>:</th><td class="due-date"><%= format_date(@issue.due_date) %></td> | |
26 | </tr> |
|
26 | </tr> | |
27 | <tr> |
|
27 | <tr> | |
28 | <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> |
|
28 | <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> | |
29 | <th class="progress"><%=l(:field_done_ratio)%>:</th><td class="progress"><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td> |
|
29 | <th class="progress"><%=l(:field_done_ratio)%>:</th><td class="progress"><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td> | |
30 | </tr> |
|
30 | </tr> | |
31 | <tr> |
|
31 | <tr> | |
32 | <th class="category"><%=l(:field_category)%>:</th><td class="category"><%=h @issue.category ? @issue.category.name : "-" %></td> |
|
32 | <th class="category"><%=l(:field_category)%>:</th><td class="category"><%=h @issue.category ? @issue.category.name : "-" %></td> | |
33 | <% if User.current.allowed_to?(:view_time_entries, @project) %> |
|
33 | <% if User.current.allowed_to?(:view_time_entries, @project) %> | |
34 | <th class="spent-time"><%=l(:label_spent_time)%>:</th> |
|
34 | <th class="spent-time"><%=l(:label_spent_time)%>:</th> | |
35 |
<td class="spent-time"><%= @issue.spent_hours > 0 ? (link_to l_hours(@issue.spent_hours), {:controller => 'timelog', :action => ' |
|
35 | <td class="spent-time"><%= @issue.spent_hours > 0 ? (link_to l_hours(@issue.spent_hours), {:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}) : "-" %></td> | |
36 | <% end %> |
|
36 | <% end %> | |
37 | </tr> |
|
37 | </tr> | |
38 | <tr> |
|
38 | <tr> | |
39 | <th class="fixed-version"><%=l(:field_fixed_version)%>:</th><td class="fixed-version"><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> |
|
39 | <th class="fixed-version"><%=l(:field_fixed_version)%>:</th><td class="fixed-version"><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> | |
40 | <% if @issue.estimated_hours %> |
|
40 | <% if @issue.estimated_hours %> | |
41 | <th class="estimated-hours"><%=l(:field_estimated_hours)%>:</th><td class="estimated-hours"><%= l_hours(@issue.estimated_hours) %></td> |
|
41 | <th class="estimated-hours"><%=l(:field_estimated_hours)%>:</th><td class="estimated-hours"><%= l_hours(@issue.estimated_hours) %></td> | |
42 | <% end %> |
|
42 | <% end %> | |
43 | </tr> |
|
43 | </tr> | |
44 | <%= render_custom_fields_rows(@issue) %> |
|
44 | <%= render_custom_fields_rows(@issue) %> | |
45 | <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> |
|
45 | <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> | |
46 | </table> |
|
46 | </table> | |
47 | <hr /> |
|
47 | <hr /> | |
48 |
|
48 | |||
49 | <div class="contextual"> |
|
49 | <div class="contextual"> | |
50 | <%= link_to_remote_if_authorized(l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment') unless @issue.description.blank? %> |
|
50 | <%= link_to_remote_if_authorized(l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment') unless @issue.description.blank? %> | |
51 | </div> |
|
51 | </div> | |
52 |
|
52 | |||
53 | <p><strong><%=l(:field_description)%></strong></p> |
|
53 | <p><strong><%=l(:field_description)%></strong></p> | |
54 | <div class="wiki"> |
|
54 | <div class="wiki"> | |
55 | <%= textilizable @issue, :description, :attachments => @issue.attachments %> |
|
55 | <%= textilizable @issue, :description, :attachments => @issue.attachments %> | |
56 | </div> |
|
56 | </div> | |
57 |
|
57 | |||
58 | <%= link_to_attachments @issue %> |
|
58 | <%= link_to_attachments @issue %> | |
59 |
|
59 | |||
60 | <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> |
|
60 | <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> | |
61 |
|
61 | |||
62 | <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> |
|
62 | <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> | |
63 | <hr /> |
|
63 | <hr /> | |
64 | <div id="issue_tree"> |
|
64 | <div id="issue_tree"> | |
65 | <div class="contextual"> |
|
65 | <div class="contextual"> | |
66 | <%= link_to(l(:button_add), {:controller => 'issues', :action => 'new', :project_id => @project, :issue => {:parent_issue_id => @issue}}) if User.current.allowed_to?(:manage_subtasks, @project) %> |
|
66 | <%= link_to(l(:button_add), {:controller => 'issues', :action => 'new', :project_id => @project, :issue => {:parent_issue_id => @issue}}) if User.current.allowed_to?(:manage_subtasks, @project) %> | |
67 | </div> |
|
67 | </div> | |
68 | <p><strong><%=l(:label_subtask_plural)%></strong></p> |
|
68 | <p><strong><%=l(:label_subtask_plural)%></strong></p> | |
69 | <%= render_descendants_tree(@issue) unless @issue.leaf? %> |
|
69 | <%= render_descendants_tree(@issue) unless @issue.leaf? %> | |
70 | </div> |
|
70 | </div> | |
71 | <% end %> |
|
71 | <% end %> | |
72 |
|
72 | |||
73 | <% if authorize_for('issue_relations', 'new') || @issue.relations.present? %> |
|
73 | <% if authorize_for('issue_relations', 'new') || @issue.relations.present? %> | |
74 | <hr /> |
|
74 | <hr /> | |
75 | <div id="relations"> |
|
75 | <div id="relations"> | |
76 | <%= render :partial => 'relations' %> |
|
76 | <%= render :partial => 'relations' %> | |
77 | </div> |
|
77 | </div> | |
78 | <% end %> |
|
78 | <% end %> | |
79 |
|
79 | |||
80 | </div> |
|
80 | </div> | |
81 |
|
81 | |||
82 | <% if @changesets.present? %> |
|
82 | <% if @changesets.present? %> | |
83 | <div id="issue-changesets"> |
|
83 | <div id="issue-changesets"> | |
84 | <h3><%=l(:label_associated_revisions)%></h3> |
|
84 | <h3><%=l(:label_associated_revisions)%></h3> | |
85 | <%= render :partial => 'changesets', :locals => { :changesets => @changesets} %> |
|
85 | <%= render :partial => 'changesets', :locals => { :changesets => @changesets} %> | |
86 | </div> |
|
86 | </div> | |
87 | <% end %> |
|
87 | <% end %> | |
88 |
|
88 | |||
89 | <% if @journals.present? %> |
|
89 | <% if @journals.present? %> | |
90 | <div id="history"> |
|
90 | <div id="history"> | |
91 | <h3><%=l(:label_history)%></h3> |
|
91 | <h3><%=l(:label_history)%></h3> | |
92 | <%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %> |
|
92 | <%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %> | |
93 | </div> |
|
93 | </div> | |
94 | <% end %> |
|
94 | <% end %> | |
95 |
|
95 | |||
96 |
|
96 | |||
97 | <div style="clear: both;"></div> |
|
97 | <div style="clear: both;"></div> | |
98 | <%= render :partial => 'action_menu', :locals => {:replace_watcher => 'watcher2' } %> |
|
98 | <%= render :partial => 'action_menu', :locals => {:replace_watcher => 'watcher2' } %> | |
99 |
|
99 | |||
100 | <div style="clear: both;"></div> |
|
100 | <div style="clear: both;"></div> | |
101 | <% if authorize_for('issues', 'edit') %> |
|
101 | <% if authorize_for('issues', 'edit') %> | |
102 | <div id="update" style="display:none;"> |
|
102 | <div id="update" style="display:none;"> | |
103 | <h3><%= l(:button_update) %></h3> |
|
103 | <h3><%= l(:button_update) %></h3> | |
104 | <%= render :partial => 'edit' %> |
|
104 | <%= render :partial => 'edit' %> | |
105 | </div> |
|
105 | </div> | |
106 | <% end %> |
|
106 | <% end %> | |
107 |
|
107 | |||
108 | <% other_formats_links do |f| %> |
|
108 | <% other_formats_links do |f| %> | |
109 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> |
|
109 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> | |
110 | <%= f.link_to 'PDF' %> |
|
110 | <%= f.link_to 'PDF' %> | |
111 | <% end %> |
|
111 | <% end %> | |
112 |
|
112 | |||
113 | <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
113 | <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> | |
114 |
|
114 | |||
115 | <% content_for :sidebar do %> |
|
115 | <% content_for :sidebar do %> | |
116 | <%= render :partial => 'issues/sidebar' %> |
|
116 | <%= render :partial => 'issues/sidebar' %> | |
117 |
|
117 | |||
118 | <% if User.current.allowed_to?(:add_issue_watchers, @project) || |
|
118 | <% if User.current.allowed_to?(:add_issue_watchers, @project) || | |
119 | (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %> |
|
119 | (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %> | |
120 | <div id="watchers"> |
|
120 | <div id="watchers"> | |
121 | <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> |
|
121 | <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> | |
122 | </div> |
|
122 | </div> | |
123 | <% end %> |
|
123 | <% end %> | |
124 | <% end %> |
|
124 | <% end %> | |
125 |
|
125 | |||
126 | <% content_for :header_tags do %> |
|
126 | <% content_for :header_tags do %> | |
127 | <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> |
|
127 | <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> | |
128 | <%= stylesheet_link_tag 'scm' %> |
|
128 | <%= stylesheet_link_tag 'scm' %> | |
129 | <%= javascript_include_tag 'context_menu' %> |
|
129 | <%= javascript_include_tag 'context_menu' %> | |
130 | <%= stylesheet_link_tag 'context_menu' %> |
|
130 | <%= stylesheet_link_tag 'context_menu' %> | |
131 | <%= stylesheet_link_tag 'context_menu_rtl' if l(:direction) == 'rtl' %> |
|
131 | <%= stylesheet_link_tag 'context_menu_rtl' if l(:direction) == 'rtl' %> | |
132 | <% end %> |
|
132 | <% end %> | |
133 | <div id="context-menu" style="display: none;"></div> |
|
133 | <div id="context-menu" style="display: none;"></div> | |
134 | <%= javascript_tag "new ContextMenu('#{issues_context_menu_path}')" %> |
|
134 | <%= javascript_tag "new ContextMenu('#{issues_context_menu_path}')" %> |
@@ -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(", ") %></li> |
|
17 | <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li> | |
18 | <% end %> |
|
18 | <% end %> | |
19 | <% @project.custom_values.each do |custom_value| %> |
|
19 | <% @project.custom_values.each do |custom_value| %> | |
20 | <% if !custom_value.value.blank? %> |
|
20 | <% if !custom_value.value.blank? %> | |
21 | <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li> |
|
21 | <li><%= 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 tracker.name, :controller => 'issues', :action => 'index', :project_id => @project, |
|
31 | <li><%= link_to 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 && User.current.allowed_to?(:view_time_entries, @project) %> |
|
67 | <% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %> | |
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 => ' |
|
70 | <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | | |
71 | <%= link_to(l(:label_report), {:controller => 'time_entry_reports', :action => 'report', :project_id => @project}) %></p> |
|
71 | <%= link_to(l(:label_report), {:controller => 'time_entry_reports', :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,36 +1,36 | |||||
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 | <%= radio_button_tag 'period_type', '1', !@free_period %> |
|
5 | <%= radio_button_tag 'period_type', '1', !@free_period %> | |
6 | <%= select_tag 'period', options_for_period_select(params[:period]), |
|
6 | <%= select_tag 'period', options_for_period_select(params[:period]), | |
7 | :onchange => 'this.form.onsubmit();', |
|
7 | :onchange => 'this.form.onsubmit();', | |
8 | :onfocus => '$("period_type_1").checked = true;' %> |
|
8 | :onfocus => '$("period_type_1").checked = true;' %> | |
9 | </p> |
|
9 | </p> | |
10 | <p> |
|
10 | <p> | |
11 | <%= radio_button_tag 'period_type', '2', @free_period %> |
|
11 | <%= radio_button_tag 'period_type', '2', @free_period %> | |
12 | <span onclick="$('period_type_2').checked = true;"> |
|
12 | <span onclick="$('period_type_2').checked = true;"> | |
13 | <%= l(:label_date_from_to, :start => (text_field_tag('from', @from, :size => 10) + calendar_for('from')), |
|
13 | <%= l(:label_date_from_to, :start => (text_field_tag('from', @from, :size => 10) + calendar_for('from')), | |
14 | :end => (text_field_tag('to', @to, :size => 10) + calendar_for('to'))) %> |
|
14 | :end => (text_field_tag('to', @to, :size => 10) + calendar_for('to'))) %> | |
15 | </span> |
|
15 | </span> | |
16 | </p> |
|
16 | </p> | |
17 | </div> |
|
17 | </div> | |
18 | </fieldset> |
|
18 | </fieldset> | |
19 | <p class="buttons"> |
|
19 | <p class="buttons"> | |
20 | <%= link_to_remote l(:button_apply), |
|
20 | <%= link_to_remote l(:button_apply), | |
21 | { :url => { }, |
|
21 | { :url => { }, | |
22 | :update => "content", |
|
22 | :update => "content", | |
23 | :with => "Form.serialize('query_form')", |
|
23 | :with => "Form.serialize('query_form')", | |
24 | :method => :get |
|
24 | :method => :get | |
25 | }, :class => 'icon icon-checked' %> |
|
25 | }, :class => 'icon icon-checked' %> | |
26 | </p> |
|
26 | </p> | |
27 |
|
27 | |||
28 | <div class="tabs"> |
|
28 | <div class="tabs"> | |
29 | <% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %> |
|
29 | <% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %> | |
30 | <ul> |
|
30 | <ul> | |
31 |
<li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => ' |
|
31 | <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }), | |
32 |
:class => (@controller.action_name == ' |
|
32 | :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li> | |
33 | <li><%= link_to(l(:label_report), url_params.merge({:controller => 'time_entry_reports', :action => 'report', :project_id => @project, :issue_id => @issue}), |
|
33 | <li><%= link_to(l(:label_report), url_params.merge({:controller => 'time_entry_reports', :action => 'report', :project_id => @project, :issue_id => @issue}), | |
34 | :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> |
|
34 | :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> | |
35 | </ul> |
|
35 | </ul> | |
36 | </div> |
|
36 | </div> |
1 | NO CONTENT: file renamed from app/views/timelog/details.rhtml to app/views/timelog/index.html.erb |
|
NO CONTENT: file renamed from app/views/timelog/details.rhtml to app/views/timelog/index.html.erb |
@@ -1,258 +1,258 | |||||
1 | ActionController::Routing::Routes.draw do |map| |
|
1 | ActionController::Routing::Routes.draw do |map| | |
2 | # Add your own custom routes here. |
|
2 | # Add your own custom routes here. | |
3 | # The priority is based upon order of creation: first created -> highest priority. |
|
3 | # The priority is based upon order of creation: first created -> highest priority. | |
4 |
|
4 | |||
5 | # Here's a sample route: |
|
5 | # Here's a sample route: | |
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' |
|
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' | |
7 | # Keep in mind you can assign values other than :controller and :action |
|
7 | # Keep in mind you can assign values other than :controller and :action | |
8 |
|
8 | |||
9 | map.home '', :controller => 'welcome' |
|
9 | map.home '', :controller => 'welcome' | |
10 |
|
10 | |||
11 | map.signin 'login', :controller => 'account', :action => 'login' |
|
11 | map.signin 'login', :controller => 'account', :action => 'login' | |
12 | map.signout 'logout', :controller => 'account', :action => 'logout' |
|
12 | map.signout 'logout', :controller => 'account', :action => 'logout' | |
13 |
|
13 | |||
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' | |
15 | map.connect 'help/:ctrl/:page', :controller => 'help' |
|
15 | map.connect 'help/:ctrl/:page', :controller => 'help' | |
16 |
|
16 | |||
17 | map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog' |
|
17 | map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog' | |
18 | map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
18 | map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog' | |
19 | map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
19 | map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog' | |
20 |
|
20 | |||
21 | map.with_options :controller => 'timelog' do |timelog| |
|
21 | map.with_options :controller => 'timelog' do |timelog| | |
22 |
timelog.connect 'projects/:project_id/time_entries', :action => ' |
|
22 | timelog.connect 'projects/:project_id/time_entries', :action => 'index' | |
23 |
|
23 | |||
24 |
timelog.with_options :action => ' |
|
24 | timelog.with_options :action => 'index', :conditions => {:method => :get} do |time_details| | |
25 | time_details.connect 'time_entries' |
|
25 | time_details.connect 'time_entries' | |
26 | time_details.connect 'time_entries.:format' |
|
26 | time_details.connect 'time_entries.:format' | |
27 | time_details.connect 'issues/:issue_id/time_entries' |
|
27 | time_details.connect 'issues/:issue_id/time_entries' | |
28 | time_details.connect 'issues/:issue_id/time_entries.:format' |
|
28 | time_details.connect 'issues/:issue_id/time_entries.:format' | |
29 | time_details.connect 'projects/:project_id/time_entries.:format' |
|
29 | time_details.connect 'projects/:project_id/time_entries.:format' | |
30 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries' |
|
30 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries' | |
31 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format' |
|
31 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format' | |
32 | end |
|
32 | end | |
33 | timelog.connect 'projects/:project_id/time_entries/report', :controller => 'time_entry_reports', :action => 'report' |
|
33 | timelog.connect 'projects/:project_id/time_entries/report', :controller => 'time_entry_reports', :action => 'report' | |
34 | timelog.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| |
|
34 | timelog.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| | |
35 | time_report.connect 'time_entries/report' |
|
35 | time_report.connect 'time_entries/report' | |
36 | time_report.connect 'time_entries/report.:format' |
|
36 | time_report.connect 'time_entries/report.:format' | |
37 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
37 | time_report.connect 'projects/:project_id/time_entries/report.:format' | |
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit| |
|
40 | timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit| | |
41 | time_edit.connect 'issues/:issue_id/time_entries/new' |
|
41 | time_edit.connect 'issues/:issue_id/time_entries/new' | |
42 | end |
|
42 | end | |
43 |
|
43 | |||
44 | timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post} |
|
44 | timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post} | |
45 | end |
|
45 | end | |
46 |
|
46 | |||
47 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
47 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} | |
48 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
48 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} | |
49 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} |
|
49 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} | |
50 | map.with_options :controller => 'wiki' do |wiki_routes| |
|
50 | map.with_options :controller => 'wiki' do |wiki_routes| | |
51 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| |
|
51 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| | |
52 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i |
|
52 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i | |
53 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil |
|
53 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil | |
54 | wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' |
|
54 | wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' | |
55 | wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' |
|
55 | wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' | |
56 | wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' |
|
56 | wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' | |
57 | wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' |
|
57 | wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' | |
58 | wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' |
|
58 | wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' | |
59 | end |
|
59 | end | |
60 |
|
60 | |||
61 | wiki_routes.connect 'projects/:id/wiki/:page/:action', |
|
61 | wiki_routes.connect 'projects/:id/wiki/:page/:action', | |
62 | :action => /edit|rename|destroy|preview|protect/, |
|
62 | :action => /edit|rename|destroy|preview|protect/, | |
63 | :conditions => {:method => :post} |
|
63 | :conditions => {:method => :post} | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | map.with_options :controller => 'messages' do |messages_routes| |
|
66 | map.with_options :controller => 'messages' do |messages_routes| | |
67 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
67 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| | |
68 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
68 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' | |
69 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
69 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' | |
70 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
70 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | |
71 | end |
|
71 | end | |
72 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
72 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| | |
73 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
73 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' | |
74 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
74 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' | |
75 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ |
|
75 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ | |
76 | end |
|
76 | end | |
77 | end |
|
77 | end | |
78 |
|
78 | |||
79 | map.with_options :controller => 'boards' do |board_routes| |
|
79 | map.with_options :controller => 'boards' do |board_routes| | |
80 | board_routes.with_options :conditions => {:method => :get} do |board_views| |
|
80 | board_routes.with_options :conditions => {:method => :get} do |board_views| | |
81 | board_views.connect 'projects/:project_id/boards', :action => 'index' |
|
81 | board_views.connect 'projects/:project_id/boards', :action => 'index' | |
82 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' |
|
82 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' | |
83 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' |
|
83 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' | |
84 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' |
|
84 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' | |
85 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' |
|
85 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' | |
86 | end |
|
86 | end | |
87 | board_routes.with_options :conditions => {:method => :post} do |board_actions| |
|
87 | board_routes.with_options :conditions => {:method => :post} do |board_actions| | |
88 | board_actions.connect 'projects/:project_id/boards', :action => 'new' |
|
88 | board_actions.connect 'projects/:project_id/boards', :action => 'new' | |
89 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ |
|
89 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ | |
90 | end |
|
90 | end | |
91 | end |
|
91 | end | |
92 |
|
92 | |||
93 | map.with_options :controller => 'documents' do |document_routes| |
|
93 | map.with_options :controller => 'documents' do |document_routes| | |
94 | document_routes.with_options :conditions => {:method => :get} do |document_views| |
|
94 | document_routes.with_options :conditions => {:method => :get} do |document_views| | |
95 | document_views.connect 'projects/:project_id/documents', :action => 'index' |
|
95 | document_views.connect 'projects/:project_id/documents', :action => 'index' | |
96 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' |
|
96 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' | |
97 | document_views.connect 'documents/:id', :action => 'show' |
|
97 | document_views.connect 'documents/:id', :action => 'show' | |
98 | document_views.connect 'documents/:id/edit', :action => 'edit' |
|
98 | document_views.connect 'documents/:id/edit', :action => 'edit' | |
99 | end |
|
99 | end | |
100 | document_routes.with_options :conditions => {:method => :post} do |document_actions| |
|
100 | document_routes.with_options :conditions => {:method => :post} do |document_actions| | |
101 | document_actions.connect 'projects/:project_id/documents', :action => 'new' |
|
101 | document_actions.connect 'projects/:project_id/documents', :action => 'new' | |
102 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ |
|
102 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ | |
103 | end |
|
103 | end | |
104 | end |
|
104 | end | |
105 |
|
105 | |||
106 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' |
|
106 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' | |
107 |
|
107 | |||
108 | # Misc issue routes. TODO: move into resources |
|
108 | # Misc issue routes. TODO: move into resources | |
109 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' |
|
109 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' | |
110 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview |
|
110 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview | |
111 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' |
|
111 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' | |
112 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' |
|
112 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' | |
113 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } |
|
113 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } | |
114 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } |
|
114 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } | |
115 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } |
|
115 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } | |
116 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy |
|
116 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy | |
117 |
|
117 | |||
118 | map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update] |
|
118 | map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update] | |
119 | map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update] |
|
119 | map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update] | |
120 | map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update] |
|
120 | map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update] | |
121 | map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update] |
|
121 | map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update] | |
122 |
|
122 | |||
123 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| |
|
123 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| | |
124 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' |
|
124 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' | |
125 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' |
|
125 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' | |
126 | end |
|
126 | end | |
127 |
|
127 | |||
128 | # Following two routes conflict with the resources because #index allows POST |
|
128 | # Following two routes conflict with the resources because #index allows POST | |
129 | map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
129 | map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } | |
130 | map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
130 | map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } | |
131 |
|
131 | |||
132 | map.resources :issues, :member => { :edit => :post }, :collection => {} |
|
132 | map.resources :issues, :member => { :edit => :post }, :collection => {} | |
133 | map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } |
|
133 | map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } | |
134 |
|
134 | |||
135 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| |
|
135 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| | |
136 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' |
|
136 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' | |
137 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' |
|
137 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' | |
138 | end |
|
138 | end | |
139 |
|
139 | |||
140 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
140 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' | |
141 |
|
141 | |||
142 | map.with_options :controller => 'users' do |users| |
|
142 | map.with_options :controller => 'users' do |users| | |
143 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} |
|
143 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} | |
144 |
|
144 | |||
145 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
145 | users.with_options :conditions => {:method => :post} do |user_actions| | |
146 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
146 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' | |
147 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
147 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' | |
148 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
148 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' | |
149 | end |
|
149 | end | |
150 | end |
|
150 | end | |
151 |
|
151 | |||
152 | map.resources :users, :member => { |
|
152 | map.resources :users, :member => { | |
153 | :edit_membership => :post, |
|
153 | :edit_membership => :post, | |
154 | :destroy_membership => :post |
|
154 | :destroy_membership => :post | |
155 | }, |
|
155 | }, | |
156 | :except => [:destroy] |
|
156 | :except => [:destroy] | |
157 |
|
157 | |||
158 | # For nice "roadmap" in the url for the index action |
|
158 | # For nice "roadmap" in the url for the index action | |
159 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' |
|
159 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' | |
160 |
|
160 | |||
161 | map.all_news 'news', :controller => 'news', :action => 'index' |
|
161 | map.all_news 'news', :controller => 'news', :action => 'index' | |
162 | map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' |
|
162 | map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' | |
163 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' |
|
163 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' | |
164 | map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} |
|
164 | map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} | |
165 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} |
|
165 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} | |
166 |
|
166 | |||
167 | map.resources :projects, :member => { |
|
167 | map.resources :projects, :member => { | |
168 | :copy => [:get, :post], |
|
168 | :copy => [:get, :post], | |
169 | :settings => :get, |
|
169 | :settings => :get, | |
170 | :modules => :post, |
|
170 | :modules => :post, | |
171 | :archive => :post, |
|
171 | :archive => :post, | |
172 | :unarchive => :post |
|
172 | :unarchive => :post | |
173 | } do |project| |
|
173 | } do |project| | |
174 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] |
|
174 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] | |
175 | project.resources :files, :only => [:index, :new, :create] |
|
175 | project.resources :files, :only => [:index, :new, :create] | |
176 | project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post} |
|
176 | project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post} | |
177 | project.resources :news, :shallow => true |
|
177 | project.resources :news, :shallow => true | |
178 | end |
|
178 | end | |
179 |
|
179 | |||
180 | # Destroy uses a get request to prompt the user before the actual DELETE request |
|
180 | # Destroy uses a get request to prompt the user before the actual DELETE request | |
181 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} |
|
181 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} | |
182 |
|
182 | |||
183 | # TODO: port to be part of the resources route(s) |
|
183 | # TODO: port to be part of the resources route(s) | |
184 | map.with_options :controller => 'projects' do |project_mapper| |
|
184 | map.with_options :controller => 'projects' do |project_mapper| | |
185 | project_mapper.with_options :conditions => {:method => :get} do |project_views| |
|
185 | project_mapper.with_options :conditions => {:method => :get} do |project_views| | |
186 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' |
|
186 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' | |
187 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' |
|
187 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' | |
188 | end |
|
188 | end | |
189 | end |
|
189 | end | |
190 |
|
190 | |||
191 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| |
|
191 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| | |
192 | activity.connect 'projects/:id/activity' |
|
192 | activity.connect 'projects/:id/activity' | |
193 | activity.connect 'projects/:id/activity.:format' |
|
193 | activity.connect 'projects/:id/activity.:format' | |
194 | activity.connect 'activity', :id => nil |
|
194 | activity.connect 'activity', :id => nil | |
195 | activity.connect 'activity.:format', :id => nil |
|
195 | activity.connect 'activity.:format', :id => nil | |
196 | end |
|
196 | end | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | map.with_options :controller => 'issue_categories' do |categories| |
|
199 | map.with_options :controller => 'issue_categories' do |categories| | |
200 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' |
|
200 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' | |
201 | end |
|
201 | end | |
202 |
|
202 | |||
203 | map.with_options :controller => 'repositories' do |repositories| |
|
203 | map.with_options :controller => 'repositories' do |repositories| | |
204 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
204 | repositories.with_options :conditions => {:method => :get} do |repository_views| | |
205 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
205 | repository_views.connect 'projects/:id/repository', :action => 'show' | |
206 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
206 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' | |
207 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
207 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' | |
208 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
208 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' | |
209 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
209 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' | |
210 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
210 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' | |
211 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
211 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' | |
212 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
212 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' | |
213 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
213 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
214 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
214 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
215 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' |
|
215 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' | |
216 | # TODO: why the following route is required? |
|
216 | # TODO: why the following route is required? | |
217 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' |
|
217 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' | |
218 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
218 | repository_views.connect 'projects/:id/repository/:action/*path' | |
219 | end |
|
219 | end | |
220 |
|
220 | |||
221 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
221 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} | |
222 | end |
|
222 | end | |
223 |
|
223 | |||
224 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ |
|
224 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ | |
225 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
225 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ | |
226 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
226 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ | |
227 |
|
227 | |||
228 | map.resources :groups |
|
228 | map.resources :groups | |
229 |
|
229 | |||
230 | #left old routes at the bottom for backwards compat |
|
230 | #left old routes at the bottom for backwards compat | |
231 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' |
|
231 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' | |
232 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' |
|
232 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' | |
233 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' |
|
233 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' | |
234 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
234 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' | |
235 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
235 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' | |
236 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' |
|
236 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' | |
237 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
237 | map.connect 'projects/:project_id/news/:action', :controller => 'news' | |
238 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
238 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ | |
239 | map.with_options :controller => 'repositories' do |omap| |
|
239 | map.with_options :controller => 'repositories' do |omap| | |
240 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
240 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' | |
241 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
241 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' | |
242 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
242 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' | |
243 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
243 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' | |
244 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
244 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' | |
245 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
245 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' | |
246 | end |
|
246 | end | |
247 |
|
247 | |||
248 | map.with_options :controller => 'sys' do |sys| |
|
248 | map.with_options :controller => 'sys' do |sys| | |
249 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
249 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} | |
250 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
250 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} | |
251 | end |
|
251 | end | |
252 |
|
252 | |||
253 | # Install the default route as the lowest priority. |
|
253 | # Install the default route as the lowest priority. | |
254 | map.connect ':controller/:action/:id' |
|
254 | map.connect ':controller/:action/:id' | |
255 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
255 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' | |
256 | # Used for OpenID |
|
256 | # Used for OpenID | |
257 | map.root :controller => 'account', :action => 'login' |
|
257 | map.root :controller => 'account', :action => 'login' | |
258 | end |
|
258 | end |
@@ -1,231 +1,231 | |||||
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 | end |
|
44 | end | |
45 |
|
45 | |||
46 | # Permissions |
|
46 | # Permissions | |
47 | Redmine::AccessControl.map do |map| |
|
47 | Redmine::AccessControl.map do |map| | |
48 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true |
|
48 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true | |
49 | map.permission :search_project, {:search => :index}, :public => true |
|
49 | map.permission :search_project, {:search => :index}, :public => true | |
50 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
|
50 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin | |
51 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
51 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member | |
52 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
52 | map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
53 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
53 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member | |
54 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member |
|
54 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member | |
55 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
55 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member | |
56 |
|
56 | |||
57 | map.project_module :issue_tracking do |map| |
|
57 | map.project_module :issue_tracking do |map| | |
58 | # Issue categories |
|
58 | # Issue categories | |
59 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member |
|
59 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member | |
60 | # Issues |
|
60 | # Issues | |
61 | map.permission :view_issues, {:issues => [:index, :show], |
|
61 | map.permission :view_issues, {:issues => [:index, :show], | |
62 | :auto_complete => [:issues], |
|
62 | :auto_complete => [:issues], | |
63 | :context_menus => [:issues], |
|
63 | :context_menus => [:issues], | |
64 | :versions => [:index, :show, :status_by], |
|
64 | :versions => [:index, :show, :status_by], | |
65 | :journals => :index, |
|
65 | :journals => :index, | |
66 | :queries => :index, |
|
66 | :queries => :index, | |
67 | :reports => [:issue_report, :issue_report_details]} |
|
67 | :reports => [:issue_report, :issue_report_details]} | |
68 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} |
|
68 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} | |
69 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} |
|
69 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} | |
70 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} |
|
70 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} | |
71 | map.permission :manage_subtasks, {} |
|
71 | map.permission :manage_subtasks, {} | |
72 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} |
|
72 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} | |
73 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin |
|
73 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin | |
74 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin |
|
74 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin | |
75 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin |
|
75 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin | |
76 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
76 | map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
77 | # Queries |
|
77 | # Queries | |
78 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member |
|
78 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member | |
79 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin |
|
79 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin | |
80 | # Watchers |
|
80 | # Watchers | |
81 | map.permission :view_issue_watchers, {} |
|
81 | map.permission :view_issue_watchers, {} | |
82 | map.permission :add_issue_watchers, {:watchers => :new} |
|
82 | map.permission :add_issue_watchers, {:watchers => :new} | |
83 | map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
83 | map.permission :delete_issue_watchers, {:watchers => :destroy} | |
84 | end |
|
84 | end | |
85 |
|
85 | |||
86 | map.project_module :time_tracking do |map| |
|
86 | map.project_module :time_tracking do |map| | |
87 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin |
|
87 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin | |
88 |
map.permission :view_time_entries, :timelog => [: |
|
88 | map.permission :view_time_entries, :timelog => [:index], :time_entry_reports => [:report] | |
89 | map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member |
|
89 | map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member | |
90 | map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin |
|
90 | map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin | |
91 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member |
|
91 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member | |
92 | end |
|
92 | end | |
93 |
|
93 | |||
94 | map.project_module :news do |map| |
|
94 | map.project_module :news do |map| | |
95 | map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member |
|
95 | map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member | |
96 | map.permission :view_news, {:news => [:index, :show]}, :public => true |
|
96 | map.permission :view_news, {:news => [:index, :show]}, :public => true | |
97 | map.permission :comment_news, {:comments => :create} |
|
97 | map.permission :comment_news, {:comments => :create} | |
98 | end |
|
98 | end | |
99 |
|
99 | |||
100 | map.project_module :documents do |map| |
|
100 | map.project_module :documents do |map| | |
101 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin |
|
101 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin | |
102 | map.permission :view_documents, :documents => [:index, :show, :download] |
|
102 | map.permission :view_documents, :documents => [:index, :show, :download] | |
103 | end |
|
103 | end | |
104 |
|
104 | |||
105 | map.project_module :files do |map| |
|
105 | map.project_module :files do |map| | |
106 | map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin |
|
106 | map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin | |
107 | map.permission :view_files, :files => :index, :versions => :download |
|
107 | map.permission :view_files, :files => :index, :versions => :download | |
108 | end |
|
108 | end | |
109 |
|
109 | |||
110 | map.project_module :wiki do |map| |
|
110 | map.project_module :wiki do |map| | |
111 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
|
111 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |
112 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
112 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |
113 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
113 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member | |
114 | map.permission :view_wiki_pages, :wiki => [:index, :special] |
|
114 | map.permission :view_wiki_pages, :wiki => [:index, :special] | |
115 | map.permission :export_wiki_pages, {} |
|
115 | map.permission :export_wiki_pages, {} | |
116 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] |
|
116 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] | |
117 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] |
|
117 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] | |
118 | map.permission :delete_wiki_pages_attachments, {} |
|
118 | map.permission :delete_wiki_pages_attachments, {} | |
119 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
119 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member | |
120 | end |
|
120 | end | |
121 |
|
121 | |||
122 | map.project_module :repository do |map| |
|
122 | map.project_module :repository do |map| | |
123 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member |
|
123 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member | |
124 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] |
|
124 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] | |
125 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
125 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] | |
126 | map.permission :commit_access, {} |
|
126 | map.permission :commit_access, {} | |
127 | end |
|
127 | end | |
128 |
|
128 | |||
129 | map.project_module :boards do |map| |
|
129 | map.project_module :boards do |map| | |
130 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member |
|
130 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member | |
131 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
131 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true | |
132 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} |
|
132 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} | |
133 | map.permission :edit_messages, {:messages => :edit}, :require => :member |
|
133 | map.permission :edit_messages, {:messages => :edit}, :require => :member | |
134 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin |
|
134 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin | |
135 | map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
135 | map.permission :delete_messages, {:messages => :destroy}, :require => :member | |
136 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
136 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin | |
137 | end |
|
137 | end | |
138 |
|
138 | |||
139 | map.project_module :calendar do |map| |
|
139 | map.project_module :calendar do |map| | |
140 | map.permission :view_calendar, :calendars => [:show, :update] |
|
140 | map.permission :view_calendar, :calendars => [:show, :update] | |
141 | end |
|
141 | end | |
142 |
|
142 | |||
143 | map.project_module :gantt do |map| |
|
143 | map.project_module :gantt do |map| | |
144 | map.permission :view_gantt, :gantts => [:show, :update] |
|
144 | map.permission :view_gantt, :gantts => [:show, :update] | |
145 | end |
|
145 | end | |
146 | end |
|
146 | end | |
147 |
|
147 | |||
148 | Redmine::MenuManager.map :top_menu do |menu| |
|
148 | Redmine::MenuManager.map :top_menu do |menu| | |
149 | menu.push :home, :home_path |
|
149 | menu.push :home, :home_path | |
150 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } |
|
150 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } | |
151 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural |
|
151 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural | |
152 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true |
|
152 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true | |
153 | menu.push :help, Redmine::Info.help_url, :last => true |
|
153 | menu.push :help, Redmine::Info.help_url, :last => true | |
154 | end |
|
154 | end | |
155 |
|
155 | |||
156 | Redmine::MenuManager.map :account_menu do |menu| |
|
156 | Redmine::MenuManager.map :account_menu do |menu| | |
157 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } |
|
157 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } | |
158 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } |
|
158 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } | |
159 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } |
|
159 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } | |
160 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } |
|
160 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } | |
161 | end |
|
161 | end | |
162 |
|
162 | |||
163 | Redmine::MenuManager.map :application_menu do |menu| |
|
163 | Redmine::MenuManager.map :application_menu do |menu| | |
164 | # Empty |
|
164 | # Empty | |
165 | end |
|
165 | end | |
166 |
|
166 | |||
167 | Redmine::MenuManager.map :admin_menu do |menu| |
|
167 | Redmine::MenuManager.map :admin_menu do |menu| | |
168 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural |
|
168 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural | |
169 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural |
|
169 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural | |
170 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural |
|
170 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural | |
171 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions |
|
171 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions | |
172 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural |
|
172 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural | |
173 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, |
|
173 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, | |
174 | :html => {:class => 'issue_statuses'} |
|
174 | :html => {:class => 'issue_statuses'} | |
175 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow |
|
175 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow | |
176 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, |
|
176 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, | |
177 | :html => {:class => 'custom_fields'} |
|
177 | :html => {:class => 'custom_fields'} | |
178 | menu.push :enumerations, {:controller => 'enumerations'} |
|
178 | menu.push :enumerations, {:controller => 'enumerations'} | |
179 | menu.push :settings, {:controller => 'settings'} |
|
179 | menu.push :settings, {:controller => 'settings'} | |
180 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, |
|
180 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, | |
181 | :html => {:class => 'server_authentication'} |
|
181 | :html => {:class => 'server_authentication'} | |
182 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true |
|
182 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true | |
183 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true |
|
183 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true | |
184 | end |
|
184 | end | |
185 |
|
185 | |||
186 | Redmine::MenuManager.map :project_menu do |menu| |
|
186 | Redmine::MenuManager.map :project_menu do |menu| | |
187 | menu.push :overview, { :controller => 'projects', :action => 'show' } |
|
187 | menu.push :overview, { :controller => 'projects', :action => 'show' } | |
188 | menu.push :activity, { :controller => 'activities', :action => 'index' } |
|
188 | menu.push :activity, { :controller => 'activities', :action => 'index' } | |
189 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, |
|
189 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, | |
190 | :if => Proc.new { |p| p.shared_versions.any? } |
|
190 | :if => Proc.new { |p| p.shared_versions.any? } | |
191 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural |
|
191 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural | |
192 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, |
|
192 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, | |
193 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } |
|
193 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } | |
194 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt |
|
194 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt | |
195 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar |
|
195 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar | |
196 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
196 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural | |
197 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
197 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural | |
198 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, |
|
198 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, | |
199 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } |
|
199 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } | |
200 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, |
|
200 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, | |
201 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural |
|
201 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural | |
202 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id |
|
202 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id | |
203 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, |
|
203 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, | |
204 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } |
|
204 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } | |
205 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true |
|
205 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true | |
206 | end |
|
206 | end | |
207 |
|
207 | |||
208 | Redmine::Activity.map do |activity| |
|
208 | Redmine::Activity.map do |activity| | |
209 | activity.register :issues, :class_name => %w(Issue Journal) |
|
209 | activity.register :issues, :class_name => %w(Issue Journal) | |
210 | activity.register :changesets |
|
210 | activity.register :changesets | |
211 | activity.register :news |
|
211 | activity.register :news | |
212 | activity.register :documents, :class_name => %w(Document Attachment) |
|
212 | activity.register :documents, :class_name => %w(Document Attachment) | |
213 | activity.register :files, :class_name => 'Attachment' |
|
213 | activity.register :files, :class_name => 'Attachment' | |
214 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false |
|
214 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false | |
215 | activity.register :messages, :default => false |
|
215 | activity.register :messages, :default => false | |
216 | activity.register :time_entries, :default => false |
|
216 | activity.register :time_entries, :default => false | |
217 | end |
|
217 | end | |
218 |
|
218 | |||
219 | Redmine::Search.map do |search| |
|
219 | Redmine::Search.map do |search| | |
220 | search.register :issues |
|
220 | search.register :issues | |
221 | search.register :news |
|
221 | search.register :news | |
222 | search.register :documents |
|
222 | search.register :documents | |
223 | search.register :changesets |
|
223 | search.register :changesets | |
224 | search.register :wiki_pages |
|
224 | search.register :wiki_pages | |
225 | search.register :messages |
|
225 | search.register :messages | |
226 | search.register :projects |
|
226 | search.register :projects | |
227 | end |
|
227 | end | |
228 |
|
228 | |||
229 | Redmine::WikiFormatting.map do |format| |
|
229 | Redmine::WikiFormatting.map do |format| | |
230 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper |
|
230 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper | |
231 | end |
|
231 | end |
@@ -1,231 +1,231 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | # redMine - project management software |
|
2 | # redMine - project management software | |
3 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
4 | # |
|
4 | # | |
5 | # This program is free software; you can redistribute it and/or |
|
5 | # This program is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU General Public License |
|
6 | # modify it under the terms of the GNU General Public License | |
7 | # as published by the Free Software Foundation; either version 2 |
|
7 | # as published by the Free Software Foundation; either version 2 | |
8 | # of the License, or (at your option) any later version. |
|
8 | # of the License, or (at your option) any later version. | |
9 | # |
|
9 | # | |
10 | # This program is distributed in the hope that it will be useful, |
|
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. |
|
13 | # GNU General Public License for more details. | |
14 | # |
|
14 | # | |
15 | # You should have received a copy of the GNU General Public License |
|
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program; if not, write to the Free Software |
|
16 | # along with this program; if not, write to the Free Software | |
17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
18 |
|
18 | |||
19 | require File.dirname(__FILE__) + '/../test_helper' |
|
19 | require File.dirname(__FILE__) + '/../test_helper' | |
20 | require 'timelog_controller' |
|
20 | require 'timelog_controller' | |
21 |
|
21 | |||
22 | # Re-raise errors caught by the controller. |
|
22 | # Re-raise errors caught by the controller. | |
23 | class TimelogController; def rescue_action(e) raise e end; end |
|
23 | class TimelogController; def rescue_action(e) raise e end; end | |
24 |
|
24 | |||
25 | class TimelogControllerTest < ActionController::TestCase |
|
25 | class TimelogControllerTest < ActionController::TestCase | |
26 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values |
|
26 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values | |
27 |
|
27 | |||
28 | def setup |
|
28 | def setup | |
29 | @controller = TimelogController.new |
|
29 | @controller = TimelogController.new | |
30 | @request = ActionController::TestRequest.new |
|
30 | @request = ActionController::TestRequest.new | |
31 | @response = ActionController::TestResponse.new |
|
31 | @response = ActionController::TestResponse.new | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def test_get_edit |
|
34 | def test_get_edit | |
35 | @request.session[:user_id] = 3 |
|
35 | @request.session[:user_id] = 3 | |
36 | get :edit, :project_id => 1 |
|
36 | get :edit, :project_id => 1 | |
37 | assert_response :success |
|
37 | assert_response :success | |
38 | assert_template 'edit' |
|
38 | assert_template 'edit' | |
39 | # Default activity selected |
|
39 | # Default activity selected | |
40 | assert_tag :tag => 'option', :attributes => { :selected => 'selected' }, |
|
40 | assert_tag :tag => 'option', :attributes => { :selected => 'selected' }, | |
41 | :content => 'Development' |
|
41 | :content => 'Development' | |
42 | end |
|
42 | end | |
43 |
|
43 | |||
44 | def test_get_edit_existing_time |
|
44 | def test_get_edit_existing_time | |
45 | @request.session[:user_id] = 2 |
|
45 | @request.session[:user_id] = 2 | |
46 | get :edit, :id => 2, :project_id => nil |
|
46 | get :edit, :id => 2, :project_id => nil | |
47 | assert_response :success |
|
47 | assert_response :success | |
48 | assert_template 'edit' |
|
48 | assert_template 'edit' | |
49 | # Default activity selected |
|
49 | # Default activity selected | |
50 | assert_tag :tag => 'form', :attributes => { :action => '/projects/ecookbook/timelog/edit/2' } |
|
50 | assert_tag :tag => 'form', :attributes => { :action => '/projects/ecookbook/timelog/edit/2' } | |
51 | end |
|
51 | end | |
52 |
|
52 | |||
53 | def test_get_edit_should_only_show_active_time_entry_activities |
|
53 | def test_get_edit_should_only_show_active_time_entry_activities | |
54 | @request.session[:user_id] = 3 |
|
54 | @request.session[:user_id] = 3 | |
55 | get :edit, :project_id => 1 |
|
55 | get :edit, :project_id => 1 | |
56 | assert_response :success |
|
56 | assert_response :success | |
57 | assert_template 'edit' |
|
57 | assert_template 'edit' | |
58 | assert_no_tag :tag => 'option', :content => 'Inactive Activity' |
|
58 | assert_no_tag :tag => 'option', :content => 'Inactive Activity' | |
59 |
|
59 | |||
60 | end |
|
60 | end | |
61 |
|
61 | |||
62 | def test_get_edit_with_an_existing_time_entry_with_inactive_activity |
|
62 | def test_get_edit_with_an_existing_time_entry_with_inactive_activity | |
63 | te = TimeEntry.find(1) |
|
63 | te = TimeEntry.find(1) | |
64 | te.activity = TimeEntryActivity.find_by_name("Inactive Activity") |
|
64 | te.activity = TimeEntryActivity.find_by_name("Inactive Activity") | |
65 | te.save! |
|
65 | te.save! | |
66 |
|
66 | |||
67 | @request.session[:user_id] = 1 |
|
67 | @request.session[:user_id] = 1 | |
68 | get :edit, :project_id => 1, :id => 1 |
|
68 | get :edit, :project_id => 1, :id => 1 | |
69 | assert_response :success |
|
69 | assert_response :success | |
70 | assert_template 'edit' |
|
70 | assert_template 'edit' | |
71 | # Blank option since nothing is pre-selected |
|
71 | # Blank option since nothing is pre-selected | |
72 | assert_tag :tag => 'option', :content => '--- Please select ---' |
|
72 | assert_tag :tag => 'option', :content => '--- Please select ---' | |
73 | end |
|
73 | end | |
74 |
|
74 | |||
75 | def test_post_edit |
|
75 | def test_post_edit | |
76 | # TODO: should POST to issuesβ time log instead of project. change form |
|
76 | # TODO: should POST to issuesβ time log instead of project. change form | |
77 | # and routing |
|
77 | # and routing | |
78 | @request.session[:user_id] = 3 |
|
78 | @request.session[:user_id] = 3 | |
79 | post :edit, :project_id => 1, |
|
79 | post :edit, :project_id => 1, | |
80 | :time_entry => {:comments => 'Some work on TimelogControllerTest', |
|
80 | :time_entry => {:comments => 'Some work on TimelogControllerTest', | |
81 | # Not the default activity |
|
81 | # Not the default activity | |
82 | :activity_id => '11', |
|
82 | :activity_id => '11', | |
83 | :spent_on => '2008-03-14', |
|
83 | :spent_on => '2008-03-14', | |
84 | :issue_id => '1', |
|
84 | :issue_id => '1', | |
85 | :hours => '7.3'} |
|
85 | :hours => '7.3'} | |
86 |
assert_redirected_to :action => ' |
|
86 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
87 |
|
87 | |||
88 | i = Issue.find(1) |
|
88 | i = Issue.find(1) | |
89 | t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') |
|
89 | t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') | |
90 | assert_not_nil t |
|
90 | assert_not_nil t | |
91 | assert_equal 11, t.activity_id |
|
91 | assert_equal 11, t.activity_id | |
92 | assert_equal 7.3, t.hours |
|
92 | assert_equal 7.3, t.hours | |
93 | assert_equal 3, t.user_id |
|
93 | assert_equal 3, t.user_id | |
94 | assert_equal i, t.issue |
|
94 | assert_equal i, t.issue | |
95 | assert_equal i.project, t.project |
|
95 | assert_equal i.project, t.project | |
96 | end |
|
96 | end | |
97 |
|
97 | |||
98 | def test_update |
|
98 | def test_update | |
99 | entry = TimeEntry.find(1) |
|
99 | entry = TimeEntry.find(1) | |
100 | assert_equal 1, entry.issue_id |
|
100 | assert_equal 1, entry.issue_id | |
101 | assert_equal 2, entry.user_id |
|
101 | assert_equal 2, entry.user_id | |
102 |
|
102 | |||
103 | @request.session[:user_id] = 1 |
|
103 | @request.session[:user_id] = 1 | |
104 | post :edit, :id => 1, |
|
104 | post :edit, :id => 1, | |
105 | :time_entry => {:issue_id => '2', |
|
105 | :time_entry => {:issue_id => '2', | |
106 | :hours => '8'} |
|
106 | :hours => '8'} | |
107 |
assert_redirected_to :action => ' |
|
107 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
108 | entry.reload |
|
108 | entry.reload | |
109 |
|
109 | |||
110 | assert_equal 8, entry.hours |
|
110 | assert_equal 8, entry.hours | |
111 | assert_equal 2, entry.issue_id |
|
111 | assert_equal 2, entry.issue_id | |
112 | assert_equal 2, entry.user_id |
|
112 | assert_equal 2, entry.user_id | |
113 | end |
|
113 | end | |
114 |
|
114 | |||
115 | def test_destroy |
|
115 | def test_destroy | |
116 | @request.session[:user_id] = 2 |
|
116 | @request.session[:user_id] = 2 | |
117 | post :destroy, :id => 1 |
|
117 | post :destroy, :id => 1 | |
118 |
assert_redirected_to :action => ' |
|
118 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
119 | assert_equal I18n.t(:notice_successful_delete), flash[:notice] |
|
119 | assert_equal I18n.t(:notice_successful_delete), flash[:notice] | |
120 | assert_nil TimeEntry.find_by_id(1) |
|
120 | assert_nil TimeEntry.find_by_id(1) | |
121 | end |
|
121 | end | |
122 |
|
122 | |||
123 | def test_destroy_should_fail |
|
123 | def test_destroy_should_fail | |
124 | # simulate that this fails (e.g. due to a plugin), see #5700 |
|
124 | # simulate that this fails (e.g. due to a plugin), see #5700 | |
125 | TimeEntry.class_eval do |
|
125 | TimeEntry.class_eval do | |
126 | before_destroy :stop_callback_chain |
|
126 | before_destroy :stop_callback_chain | |
127 | def stop_callback_chain ; return false ; end |
|
127 | def stop_callback_chain ; return false ; end | |
128 | end |
|
128 | end | |
129 |
|
129 | |||
130 | @request.session[:user_id] = 2 |
|
130 | @request.session[:user_id] = 2 | |
131 | post :destroy, :id => 1 |
|
131 | post :destroy, :id => 1 | |
132 |
assert_redirected_to :action => ' |
|
132 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
133 | assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] |
|
133 | assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] | |
134 | assert_not_nil TimeEntry.find_by_id(1) |
|
134 | assert_not_nil TimeEntry.find_by_id(1) | |
135 |
|
135 | |||
136 | # remove the simulation |
|
136 | # remove the simulation | |
137 | TimeEntry.before_destroy.reject! {|callback| callback.method == :stop_callback_chain } |
|
137 | TimeEntry.before_destroy.reject! {|callback| callback.method == :stop_callback_chain } | |
138 | end |
|
138 | end | |
139 |
|
139 | |||
140 |
def test_ |
|
140 | def test_index_all_projects | |
141 |
get : |
|
141 | get :index | |
142 | assert_response :success |
|
142 | assert_response :success | |
143 |
assert_template ' |
|
143 | assert_template 'index' | |
144 | assert_not_nil assigns(:total_hours) |
|
144 | assert_not_nil assigns(:total_hours) | |
145 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
145 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
146 | end |
|
146 | end | |
147 |
|
147 | |||
148 |
def test_ |
|
148 | def test_index_at_project_level | |
149 |
get : |
|
149 | get :index, :project_id => 1 | |
150 | assert_response :success |
|
150 | assert_response :success | |
151 |
assert_template ' |
|
151 | assert_template 'index' | |
152 | assert_not_nil assigns(:entries) |
|
152 | assert_not_nil assigns(:entries) | |
153 | assert_equal 4, assigns(:entries).size |
|
153 | assert_equal 4, assigns(:entries).size | |
154 | # project and subproject |
|
154 | # project and subproject | |
155 | assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort |
|
155 | assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort | |
156 | assert_not_nil assigns(:total_hours) |
|
156 | assert_not_nil assigns(:total_hours) | |
157 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
157 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
158 | # display all time by default |
|
158 | # display all time by default | |
159 | assert_equal '2007-03-12'.to_date, assigns(:from) |
|
159 | assert_equal '2007-03-12'.to_date, assigns(:from) | |
160 | assert_equal '2007-04-22'.to_date, assigns(:to) |
|
160 | assert_equal '2007-04-22'.to_date, assigns(:to) | |
161 | end |
|
161 | end | |
162 |
|
162 | |||
163 |
def test_ |
|
163 | def test_index_at_project_level_with_date_range | |
164 |
get : |
|
164 | get :index, :project_id => 1, :from => '2007-03-20', :to => '2007-04-30' | |
165 | assert_response :success |
|
165 | assert_response :success | |
166 |
assert_template ' |
|
166 | assert_template 'index' | |
167 | assert_not_nil assigns(:entries) |
|
167 | assert_not_nil assigns(:entries) | |
168 | assert_equal 3, assigns(:entries).size |
|
168 | assert_equal 3, assigns(:entries).size | |
169 | assert_not_nil assigns(:total_hours) |
|
169 | assert_not_nil assigns(:total_hours) | |
170 | assert_equal "12.90", "%.2f" % assigns(:total_hours) |
|
170 | assert_equal "12.90", "%.2f" % assigns(:total_hours) | |
171 | assert_equal '2007-03-20'.to_date, assigns(:from) |
|
171 | assert_equal '2007-03-20'.to_date, assigns(:from) | |
172 | assert_equal '2007-04-30'.to_date, assigns(:to) |
|
172 | assert_equal '2007-04-30'.to_date, assigns(:to) | |
173 | end |
|
173 | end | |
174 |
|
174 | |||
175 |
def test_ |
|
175 | def test_index_at_project_level_with_period | |
176 |
get : |
|
176 | get :index, :project_id => 1, :period => '7_days' | |
177 | assert_response :success |
|
177 | assert_response :success | |
178 |
assert_template ' |
|
178 | assert_template 'index' | |
179 | assert_not_nil assigns(:entries) |
|
179 | assert_not_nil assigns(:entries) | |
180 | assert_not_nil assigns(:total_hours) |
|
180 | assert_not_nil assigns(:total_hours) | |
181 | assert_equal Date.today - 7, assigns(:from) |
|
181 | assert_equal Date.today - 7, assigns(:from) | |
182 | assert_equal Date.today, assigns(:to) |
|
182 | assert_equal Date.today, assigns(:to) | |
183 | end |
|
183 | end | |
184 |
|
184 | |||
185 |
def test_ |
|
185 | def test_index_one_day | |
186 |
get : |
|
186 | get :index, :project_id => 1, :from => "2007-03-23", :to => "2007-03-23" | |
187 | assert_response :success |
|
187 | assert_response :success | |
188 |
assert_template ' |
|
188 | assert_template 'index' | |
189 | assert_not_nil assigns(:total_hours) |
|
189 | assert_not_nil assigns(:total_hours) | |
190 | assert_equal "4.25", "%.2f" % assigns(:total_hours) |
|
190 | assert_equal "4.25", "%.2f" % assigns(:total_hours) | |
191 | end |
|
191 | end | |
192 |
|
192 | |||
193 |
def test_ |
|
193 | def test_index_at_issue_level | |
194 |
get : |
|
194 | get :index, :issue_id => 1 | |
195 | assert_response :success |
|
195 | assert_response :success | |
196 |
assert_template ' |
|
196 | assert_template 'index' | |
197 | assert_not_nil assigns(:entries) |
|
197 | assert_not_nil assigns(:entries) | |
198 | assert_equal 2, assigns(:entries).size |
|
198 | assert_equal 2, assigns(:entries).size | |
199 | assert_not_nil assigns(:total_hours) |
|
199 | assert_not_nil assigns(:total_hours) | |
200 | assert_equal 154.25, assigns(:total_hours) |
|
200 | assert_equal 154.25, assigns(:total_hours) | |
201 | # display all time based on what's been logged |
|
201 | # display all time based on what's been logged | |
202 | assert_equal '2007-03-12'.to_date, assigns(:from) |
|
202 | assert_equal '2007-03-12'.to_date, assigns(:from) | |
203 | assert_equal '2007-04-22'.to_date, assigns(:to) |
|
203 | assert_equal '2007-04-22'.to_date, assigns(:to) | |
204 | end |
|
204 | end | |
205 |
|
205 | |||
206 |
def test_ |
|
206 | def test_index_atom_feed | |
207 |
get : |
|
207 | get :index, :project_id => 1, :format => 'atom' | |
208 | assert_response :success |
|
208 | assert_response :success | |
209 | assert_equal 'application/atom+xml', @response.content_type |
|
209 | assert_equal 'application/atom+xml', @response.content_type | |
210 | assert_not_nil assigns(:items) |
|
210 | assert_not_nil assigns(:items) | |
211 | assert assigns(:items).first.is_a?(TimeEntry) |
|
211 | assert assigns(:items).first.is_a?(TimeEntry) | |
212 | end |
|
212 | end | |
213 |
|
213 | |||
214 |
def test_ |
|
214 | def test_index_all_projects_csv_export | |
215 | Setting.date_format = '%m/%d/%Y' |
|
215 | Setting.date_format = '%m/%d/%Y' | |
216 |
get : |
|
216 | get :index, :format => 'csv' | |
217 | assert_response :success |
|
217 | assert_response :success | |
218 | assert_equal 'text/csv', @response.content_type |
|
218 | assert_equal 'text/csv', @response.content_type | |
219 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment\n") |
|
219 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment\n") | |
220 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\"\n") |
|
220 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\"\n") | |
221 | end |
|
221 | end | |
222 |
|
222 | |||
223 |
def test_ |
|
223 | def test_index_csv_export | |
224 | Setting.date_format = '%m/%d/%Y' |
|
224 | Setting.date_format = '%m/%d/%Y' | |
225 |
get : |
|
225 | get :index, :project_id => 1, :format => 'csv' | |
226 | assert_response :success |
|
226 | assert_response :success | |
227 | assert_equal 'text/csv', @response.content_type |
|
227 | assert_equal 'text/csv', @response.content_type | |
228 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment\n") |
|
228 | assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment\n") | |
229 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\"\n") |
|
229 | assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\"\n") | |
230 | end |
|
230 | end | |
231 | end |
|
231 | end |
@@ -1,308 +1,307 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2010 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require "#{File.dirname(__FILE__)}/../test_helper" |
|
18 | require "#{File.dirname(__FILE__)}/../test_helper" | |
19 |
|
19 | |||
20 | class RoutingTest < ActionController::IntegrationTest |
|
20 | class RoutingTest < ActionController::IntegrationTest | |
21 | context "activities" do |
|
21 | context "activities" do | |
22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil |
|
22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil | |
23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' |
|
23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' | |
24 | end |
|
24 | end | |
25 |
|
25 | |||
26 | context "attachments" do |
|
26 | context "attachments" do | |
27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' |
|
27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' | |
28 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' |
|
28 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' | |
29 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' |
|
29 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' | |
30 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' |
|
30 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' | |
31 | end |
|
31 | end | |
32 |
|
32 | |||
33 | context "boards" do |
|
33 | context "boards" do | |
34 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' |
|
34 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' | |
35 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
35 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |
36 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' |
|
36 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' | |
37 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' |
|
37 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' | |
38 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
38 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' | |
39 |
|
39 | |||
40 | should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
40 | should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |
41 | should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
41 | should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' | |
42 | should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' |
|
42 | should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' | |
43 |
|
43 | |||
44 | end |
|
44 | end | |
45 |
|
45 | |||
46 | context "documents" do |
|
46 | context "documents" do | |
47 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' |
|
47 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' | |
48 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
48 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' | |
49 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' |
|
49 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' | |
50 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' |
|
50 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' | |
51 |
|
51 | |||
52 | should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
52 | should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' | |
53 | should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' |
|
53 | should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' | |
54 | should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' |
|
54 | should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' | |
55 | end |
|
55 | end | |
56 |
|
56 | |||
57 | context "issues" do |
|
57 | context "issues" do | |
58 | # REST actions |
|
58 | # REST actions | |
59 | should_route :get, "/issues", :controller => 'issues', :action => 'index' |
|
59 | should_route :get, "/issues", :controller => 'issues', :action => 'index' | |
60 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' |
|
60 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' | |
61 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' |
|
61 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' | |
62 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' |
|
62 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' | |
63 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' |
|
63 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' | |
64 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' |
|
64 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' | |
65 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' |
|
65 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' | |
66 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' |
|
66 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' | |
67 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' |
|
67 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' | |
68 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' |
|
68 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' | |
69 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' |
|
69 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' | |
70 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' |
|
70 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' | |
71 |
|
71 | |||
72 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' |
|
72 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' | |
73 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' |
|
73 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' | |
74 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' |
|
74 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' | |
75 |
|
75 | |||
76 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
76 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' | |
77 | # TODO: Should use PUT |
|
77 | # TODO: Should use PUT | |
78 | should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
78 | should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' | |
79 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' |
|
79 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' | |
80 |
|
80 | |||
81 | # TODO: Should use DELETE |
|
81 | # TODO: Should use DELETE | |
82 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' |
|
82 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' | |
83 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' |
|
83 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' | |
84 |
|
84 | |||
85 | # Extra actions |
|
85 | # Extra actions | |
86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' |
|
86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' | |
87 |
|
87 | |||
88 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' |
|
88 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' | |
89 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' |
|
89 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' | |
90 |
|
90 | |||
91 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' |
|
91 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' | |
92 |
|
92 | |||
93 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' |
|
93 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' | |
94 | should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update' |
|
94 | should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update' | |
95 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' |
|
95 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' | |
96 | should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name' |
|
96 | should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name' | |
97 |
|
97 | |||
98 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' |
|
98 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' | |
99 | should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update' |
|
99 | should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update' | |
100 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' |
|
100 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' | |
101 | should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name' |
|
101 | should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name' | |
102 |
|
102 | |||
103 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' |
|
103 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' | |
104 |
|
104 | |||
105 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
105 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' | |
106 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
106 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' | |
107 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
107 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' | |
108 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
108 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' | |
109 |
|
109 | |||
110 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' |
|
110 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' | |
111 |
|
111 | |||
112 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' |
|
112 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' | |
113 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' |
|
113 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' | |
114 | end |
|
114 | end | |
115 |
|
115 | |||
116 | context "issue categories" do |
|
116 | context "issue categories" do | |
117 | should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
117 | should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' | |
118 |
|
118 | |||
119 | should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
119 | should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' | |
120 | end |
|
120 | end | |
121 |
|
121 | |||
122 | context "issue relations" do |
|
122 | context "issue relations" do | |
123 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' |
|
123 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' | |
124 | should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' |
|
124 | should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' | |
125 | end |
|
125 | end | |
126 |
|
126 | |||
127 | context "issue reports" do |
|
127 | context "issue reports" do | |
128 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' |
|
128 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' | |
129 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' |
|
129 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' | |
130 | end |
|
130 | end | |
131 |
|
131 | |||
132 | context "members" do |
|
132 | context "members" do | |
133 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' |
|
133 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' | |
134 | end |
|
134 | end | |
135 |
|
135 | |||
136 | context "messages" do |
|
136 | context "messages" do | |
137 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' |
|
137 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' | |
138 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
138 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |
139 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
139 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |
140 |
|
140 | |||
141 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
141 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |
142 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
142 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |
143 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' |
|
143 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' | |
144 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' |
|
144 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' | |
145 | end |
|
145 | end | |
146 |
|
146 | |||
147 | context "news" do |
|
147 | context "news" do | |
148 | should_route :get, "/news", :controller => 'news', :action => 'index' |
|
148 | should_route :get, "/news", :controller => 'news', :action => 'index' | |
149 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' |
|
149 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' | |
150 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' |
|
150 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' | |
151 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' |
|
151 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' | |
152 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' |
|
152 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' | |
153 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' |
|
153 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' | |
154 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' |
|
154 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' | |
155 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' |
|
155 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' | |
156 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' |
|
156 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' | |
157 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
157 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' | |
158 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' |
|
158 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' | |
159 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' |
|
159 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' | |
160 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' |
|
160 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' | |
161 |
|
161 | |||
162 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' |
|
162 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' | |
163 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' |
|
163 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' | |
164 |
|
164 | |||
165 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' |
|
165 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' | |
166 |
|
166 | |||
167 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' |
|
167 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' | |
168 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' |
|
168 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' | |
169 | end |
|
169 | end | |
170 |
|
170 | |||
171 | context "projects" do |
|
171 | context "projects" do | |
172 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
172 | should_route :get, "/projects", :controller => 'projects', :action => 'index' | |
173 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
173 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' | |
174 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
174 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' | |
175 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' |
|
175 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' | |
176 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
176 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' | |
177 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
177 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' | |
178 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
178 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' | |
179 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' |
|
179 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' | |
180 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' |
|
180 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' | |
181 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' |
|
181 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' | |
182 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' |
|
182 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' | |
183 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' |
|
183 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' | |
184 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' |
|
184 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' | |
185 |
|
185 | |||
186 | should_route :post, "/projects", :controller => 'projects', :action => 'create' |
|
186 | should_route :post, "/projects", :controller => 'projects', :action => 'create' | |
187 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' |
|
187 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' | |
188 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' |
|
188 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' | |
189 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' |
|
189 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' | |
190 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' |
|
190 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' | |
191 |
|
191 | |||
192 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' |
|
192 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' | |
193 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' |
|
193 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' | |
194 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' |
|
194 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' | |
195 |
|
195 | |||
196 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' |
|
196 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' | |
197 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' |
|
197 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' | |
198 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' |
|
198 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' | |
199 | end |
|
199 | end | |
200 |
|
200 | |||
201 | context "repositories" do |
|
201 | context "repositories" do | |
202 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' |
|
202 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' | |
203 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
203 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
204 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' |
|
204 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' | |
205 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' |
|
205 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' | |
206 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' |
|
206 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' | |
207 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' |
|
207 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' | |
208 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' |
|
208 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' | |
209 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] |
|
209 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] | |
210 | 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' |
|
210 | 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' | |
211 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] |
|
211 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] | |
212 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] |
|
212 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] | |
213 | 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' |
|
213 | 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' | |
214 | 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' |
|
214 | 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' | |
215 | 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' |
|
215 | 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' | |
216 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] |
|
216 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] | |
217 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] |
|
217 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] | |
218 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' |
|
218 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' | |
219 |
|
219 | |||
220 |
|
220 | |||
221 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
221 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
222 | end |
|
222 | end | |
223 |
|
223 | |||
224 | context "timelogs" do |
|
224 | context "timelogs" do | |
|
225 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'index' | |||
|
226 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv' | |||
|
227 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom' | |||
|
228 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' | |||
|
229 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' | |||
|
230 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom' | |||
|
231 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234' | |||
|
232 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv' | |||
|
233 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom' | |||
|
234 | should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'index', :project_id => 'ecookbook', :issue_id => '123' | |||
|
235 | ||||
225 | should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567' |
|
236 | should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567' | |
226 | should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook' |
|
237 | should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook' | |
227 | should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567' |
|
238 | should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567' | |
228 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' |
|
239 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' | |
229 |
|
240 | |||
230 | should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55' |
|
241 | should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55' | |
231 | end |
|
242 | end | |
232 |
|
243 | |||
233 | context "time_entry_reports" do |
|
244 | context "time_entry_reports" do | |
234 | should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report' |
|
245 | should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report' | |
235 | should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567' |
|
246 | should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567' | |
236 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' |
|
247 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' | |
237 |
|
||||
238 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'details' |
|
|||
239 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv' |
|
|||
240 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom' |
|
|||
241 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567' |
|
|||
242 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv' |
|
|||
243 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom' |
|
|||
244 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234' |
|
|||
245 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv' |
|
|||
246 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom' |
|
|||
247 | should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123' |
|
|||
248 |
|
||||
249 | end |
|
248 | end | |
250 |
|
249 | |||
251 | context "users" do |
|
250 | context "users" do | |
252 | should_route :get, "/users", :controller => 'users', :action => 'index' |
|
251 | should_route :get, "/users", :controller => 'users', :action => 'index' | |
253 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' |
|
252 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' | |
254 | should_route :get, "/users/new", :controller => 'users', :action => 'new' |
|
253 | should_route :get, "/users/new", :controller => 'users', :action => 'new' | |
255 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
254 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' | |
256 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' |
|
255 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' | |
257 |
|
256 | |||
258 | should_route :post, "/users", :controller => 'users', :action => 'create' |
|
257 | should_route :post, "/users", :controller => 'users', :action => 'create' | |
259 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' |
|
258 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' | |
260 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' |
|
259 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' | |
261 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
260 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' | |
262 |
|
261 | |||
263 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' |
|
262 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' | |
264 | end |
|
263 | end | |
265 |
|
264 | |||
266 | # TODO: should they all be scoped under /projects/:project_id ? |
|
265 | # TODO: should they all be scoped under /projects/:project_id ? | |
267 | context "versions" do |
|
266 | context "versions" do | |
268 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
267 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' | |
269 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' |
|
268 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' | |
270 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' |
|
269 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' | |
271 |
|
270 | |||
272 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' |
|
271 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' | |
273 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' |
|
272 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' | |
274 |
|
273 | |||
275 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' |
|
274 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' | |
276 | end |
|
275 | end | |
277 |
|
276 | |||
278 | context "wiki (singular, project's pages)" do |
|
277 | context "wiki (singular, project's pages)" do | |
279 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567' |
|
278 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567' | |
280 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala' |
|
279 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala' | |
281 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' |
|
280 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' | |
282 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation' |
|
281 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation' | |
283 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1' |
|
282 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1' | |
284 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2' |
|
283 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2' | |
285 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' |
|
284 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' | |
286 | should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index' |
|
285 | should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index' | |
287 | should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index' |
|
286 | should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index' | |
288 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index' |
|
287 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index' | |
289 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export' |
|
288 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export' | |
290 |
|
289 | |||
291 | should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' |
|
290 | should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' | |
292 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation' |
|
291 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation' | |
293 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' |
|
292 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' | |
294 | should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida' |
|
293 | should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida' | |
295 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida' |
|
294 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida' | |
296 | end |
|
295 | end | |
297 |
|
296 | |||
298 | context "wikis (plural, admin setup)" do |
|
297 | context "wikis (plural, admin setup)" do | |
299 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
298 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
300 |
|
299 | |||
301 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' |
|
300 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' | |
302 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
301 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
303 | end |
|
302 | end | |
304 |
|
303 | |||
305 | context "administration panel" do |
|
304 | context "administration panel" do | |
306 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' |
|
305 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' | |
307 | end |
|
306 | end | |
308 | end |
|
307 | end |
General Comments 0
You need to be logged in to leave comments.
Login now