##// END OF EJS Templates
Refactor: rename UsersController#add to #new...
Eric Davis -
r4115:d06a1a7fa47a
parent child
Show More
@@ -1,187 +1,187
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class UsersController < ApplicationController
18 class UsersController < ApplicationController
19 layout 'admin'
19 layout 'admin'
20
20
21 before_filter :require_admin, :except => :show
21 before_filter :require_admin, :except => :show
22
22
23 helper :sort
23 helper :sort
24 include SortHelper
24 include SortHelper
25 helper :custom_fields
25 helper :custom_fields
26 include CustomFieldsHelper
26 include CustomFieldsHelper
27
27
28 def index
28 def index
29 sort_init 'login', 'asc'
29 sort_init 'login', 'asc'
30 sort_update %w(login firstname lastname mail admin created_on last_login_on)
30 sort_update %w(login firstname lastname mail admin created_on last_login_on)
31
31
32 @status = params[:status] ? params[:status].to_i : 1
32 @status = params[:status] ? params[:status].to_i : 1
33 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
33 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
34
34
35 unless params[:name].blank?
35 unless params[:name].blank?
36 name = "%#{params[:name].strip.downcase}%"
36 name = "%#{params[:name].strip.downcase}%"
37 c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", name, name, name, name]
37 c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", name, name, name, name]
38 end
38 end
39
39
40 @user_count = User.count(:conditions => c.conditions)
40 @user_count = User.count(:conditions => c.conditions)
41 @user_pages = Paginator.new self, @user_count,
41 @user_pages = Paginator.new self, @user_count,
42 per_page_option,
42 per_page_option,
43 params['page']
43 params['page']
44 @users = User.find :all,:order => sort_clause,
44 @users = User.find :all,:order => sort_clause,
45 :conditions => c.conditions,
45 :conditions => c.conditions,
46 :limit => @user_pages.items_per_page,
46 :limit => @user_pages.items_per_page,
47 :offset => @user_pages.current.offset
47 :offset => @user_pages.current.offset
48
48
49 render :layout => !request.xhr?
49 render :layout => !request.xhr?
50 end
50 end
51
51
52 def show
52 def show
53 @user = User.find(params[:id])
53 @user = User.find(params[:id])
54 @custom_values = @user.custom_values
54 @custom_values = @user.custom_values
55
55
56 # show projects based on current user visibility
56 # show projects based on current user visibility
57 @memberships = @user.memberships.all(:conditions => Project.visible_by(User.current))
57 @memberships = @user.memberships.all(:conditions => Project.visible_by(User.current))
58
58
59 events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
59 events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
60 @events_by_day = events.group_by(&:event_date)
60 @events_by_day = events.group_by(&:event_date)
61
61
62 unless User.current.admin?
62 unless User.current.admin?
63 if !@user.active? || (@user != User.current && @memberships.empty? && events.empty?)
63 if !@user.active? || (@user != User.current && @memberships.empty? && events.empty?)
64 render_404
64 render_404
65 return
65 return
66 end
66 end
67 end
67 end
68 render :layout => 'base'
68 render :layout => 'base'
69
69
70 rescue ActiveRecord::RecordNotFound
70 rescue ActiveRecord::RecordNotFound
71 render_404
71 render_404
72 end
72 end
73
73
74 def add
74 def new
75 @notification_options = User::MAIL_NOTIFICATION_OPTIONS
75 @notification_options = User::MAIL_NOTIFICATION_OPTIONS
76 @notification_option = Setting.default_notification_option
76 @notification_option = Setting.default_notification_option
77
77
78 @user = User.new(:language => Setting.default_language)
78 @user = User.new(:language => Setting.default_language)
79 @auth_sources = AuthSource.find(:all)
79 @auth_sources = AuthSource.find(:all)
80 end
80 end
81
81
82 verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
82 verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
83 def create
83 def create
84 @notification_options = User::MAIL_NOTIFICATION_OPTIONS
84 @notification_options = User::MAIL_NOTIFICATION_OPTIONS
85 @notification_option = Setting.default_notification_option
85 @notification_option = Setting.default_notification_option
86
86
87 @user = User.new(params[:user])
87 @user = User.new(params[:user])
88 @user.admin = params[:user][:admin] || false
88 @user.admin = params[:user][:admin] || false
89 @user.login = params[:user][:login]
89 @user.login = params[:user][:login]
90 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id
90 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id
91
91
92 # TODO: Similar to My#account
92 # TODO: Similar to My#account
93 @user.mail_notification = params[:notification_option] || 'only_my_events'
93 @user.mail_notification = params[:notification_option] || 'only_my_events'
94 @user.pref.attributes = params[:pref]
94 @user.pref.attributes = params[:pref]
95 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
95 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
96
96
97 if @user.save
97 if @user.save
98 @user.pref.save
98 @user.pref.save
99 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
99 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
100
100
101 Mailer.deliver_account_information(@user, params[:password]) if params[:send_information]
101 Mailer.deliver_account_information(@user, params[:password]) if params[:send_information]
102 flash[:notice] = l(:notice_successful_create)
102 flash[:notice] = l(:notice_successful_create)
103 redirect_to(params[:continue] ? {:controller => 'users', :action => 'add'} :
103 redirect_to(params[:continue] ? {:controller => 'users', :action => 'new'} :
104 {:controller => 'users', :action => 'edit', :id => @user})
104 {:controller => 'users', :action => 'edit', :id => @user})
105 return
105 return
106 else
106 else
107 @auth_sources = AuthSource.find(:all)
107 @auth_sources = AuthSource.find(:all)
108 @notification_option = @user.mail_notification
108 @notification_option = @user.mail_notification
109
109
110 render :action => 'add'
110 render :action => 'new'
111 end
111 end
112 end
112 end
113
113
114 def edit
114 def edit
115 @user = User.find(params[:id])
115 @user = User.find(params[:id])
116 @notification_options = @user.valid_notification_options
116 @notification_options = @user.valid_notification_options
117 @notification_option = @user.mail_notification
117 @notification_option = @user.mail_notification
118
118
119 if request.post?
119 if request.post?
120 @user.admin = params[:user][:admin] if params[:user][:admin]
120 @user.admin = params[:user][:admin] if params[:user][:admin]
121 @user.login = params[:user][:login] if params[:user][:login]
121 @user.login = params[:user][:login] if params[:user][:login]
122 if params[:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)
122 if params[:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)
123 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
123 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
124 end
124 end
125 @user.group_ids = params[:user][:group_ids] if params[:user][:group_ids]
125 @user.group_ids = params[:user][:group_ids] if params[:user][:group_ids]
126 @user.attributes = params[:user]
126 @user.attributes = params[:user]
127 # Was the account actived ? (do it before User#save clears the change)
127 # Was the account actived ? (do it before User#save clears the change)
128 was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE])
128 was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE])
129 # TODO: Similar to My#account
129 # TODO: Similar to My#account
130 @user.mail_notification = params[:notification_option] || 'only_my_events'
130 @user.mail_notification = params[:notification_option] || 'only_my_events'
131 @user.pref.attributes = params[:pref]
131 @user.pref.attributes = params[:pref]
132 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
132 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
133
133
134 if @user.save
134 if @user.save
135 @user.pref.save
135 @user.pref.save
136 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
136 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
137
137
138 if was_activated
138 if was_activated
139 Mailer.deliver_account_activated(@user)
139 Mailer.deliver_account_activated(@user)
140 elsif @user.active? && params[:send_information] && !params[:password].blank? && @user.auth_source_id.nil?
140 elsif @user.active? && params[:send_information] && !params[:password].blank? && @user.auth_source_id.nil?
141 Mailer.deliver_account_information(@user, params[:password])
141 Mailer.deliver_account_information(@user, params[:password])
142 end
142 end
143 flash[:notice] = l(:notice_successful_update)
143 flash[:notice] = l(:notice_successful_update)
144 redirect_to :back
144 redirect_to :back
145 end
145 end
146 end
146 end
147 @auth_sources = AuthSource.find(:all)
147 @auth_sources = AuthSource.find(:all)
148 @membership ||= Member.new
148 @membership ||= Member.new
149 rescue ::ActionController::RedirectBackError
149 rescue ::ActionController::RedirectBackError
150 redirect_to :controller => 'users', :action => 'edit', :id => @user
150 redirect_to :controller => 'users', :action => 'edit', :id => @user
151 end
151 end
152
152
153 def edit_membership
153 def edit_membership
154 @user = User.find(params[:id])
154 @user = User.find(params[:id])
155 @membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
155 @membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
156 @membership.save if request.post?
156 @membership.save if request.post?
157 respond_to do |format|
157 respond_to do |format|
158 if @membership.valid?
158 if @membership.valid?
159 format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
159 format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
160 format.js {
160 format.js {
161 render(:update) {|page|
161 render(:update) {|page|
162 page.replace_html "tab-content-memberships", :partial => 'users/memberships'
162 page.replace_html "tab-content-memberships", :partial => 'users/memberships'
163 page.visual_effect(:highlight, "member-#{@membership.id}")
163 page.visual_effect(:highlight, "member-#{@membership.id}")
164 }
164 }
165 }
165 }
166 else
166 else
167 format.js {
167 format.js {
168 render(:update) {|page|
168 render(:update) {|page|
169 page.alert(l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', ')))
169 page.alert(l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', ')))
170 }
170 }
171 }
171 }
172 end
172 end
173 end
173 end
174 end
174 end
175
175
176 def destroy_membership
176 def destroy_membership
177 @user = User.find(params[:id])
177 @user = User.find(params[:id])
178 @membership = Member.find(params[:membership_id])
178 @membership = Member.find(params[:membership_id])
179 if request.post? && @membership.deletable?
179 if request.post? && @membership.deletable?
180 @membership.destroy
180 @membership.destroy
181 end
181 end
182 respond_to do |format|
182 respond_to do |format|
183 format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
183 format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
184 format.js { render(:update) {|page| page.replace_html "tab-content-memberships", :partial => 'users/memberships'} }
184 format.js { render(:update) {|page| page.replace_html "tab-content-memberships", :partial => 'users/memberships'} }
185 end
185 end
186 end
186 end
187 end
187 end
@@ -1,48 +1,48
1 <div class="contextual">
1 <div class="contextual">
2 <%= link_to l(:label_user_new), {:action => 'add'}, :class => 'icon icon-add' %>
2 <%= link_to l(:label_user_new), {:action => 'new'}, :class => 'icon icon-add' %>
3 </div>
3 </div>
4
4
5 <h2><%=l(:label_user_plural)%></h2>
5 <h2><%=l(:label_user_plural)%></h2>
6
6
7 <% form_tag({}, :method => :get) do %>
7 <% form_tag({}, :method => :get) do %>
8 <fieldset><legend><%= l(:label_filter_plural) %></legend>
8 <fieldset><legend><%= l(:label_filter_plural) %></legend>
9 <label><%= l(:field_status) %>:</label>
9 <label><%= l(:field_status) %>:</label>
10 <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
10 <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
11 <label><%= l(:label_user) %>:</label>
11 <label><%= l(:label_user) %>:</label>
12 <%= text_field_tag 'name', params[:name], :size => 30 %>
12 <%= text_field_tag 'name', params[:name], :size => 30 %>
13 <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
13 <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
14 </fieldset>
14 </fieldset>
15 <% end %>
15 <% end %>
16 &nbsp;
16 &nbsp;
17
17
18 <div class="autoscroll">
18 <div class="autoscroll">
19 <table class="list">
19 <table class="list">
20 <thead><tr>
20 <thead><tr>
21 <%= sort_header_tag('login', :caption => l(:field_login)) %>
21 <%= sort_header_tag('login', :caption => l(:field_login)) %>
22 <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>
22 <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>
23 <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>
23 <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>
24 <%= sort_header_tag('mail', :caption => l(:field_mail)) %>
24 <%= sort_header_tag('mail', :caption => l(:field_mail)) %>
25 <%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
25 <%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
26 <%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
26 <%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
27 <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
27 <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
28 <th></th>
28 <th></th>
29 </tr></thead>
29 </tr></thead>
30 <tbody>
30 <tbody>
31 <% for user in @users -%>
31 <% for user in @users -%>
32 <tr class="user <%= cycle("odd", "even") %> <%= %w(anon active registered locked)[user.status] %>">
32 <tr class="user <%= cycle("odd", "even") %> <%= %w(anon active registered locked)[user.status] %>">
33 <td class="username"><%= avatar(user, :size => "14") %><%= link_to h(user.login), :action => 'edit', :id => user %></td>
33 <td class="username"><%= avatar(user, :size => "14") %><%= link_to h(user.login), :action => 'edit', :id => user %></td>
34 <td class="firstname"><%= h(user.firstname) %></td>
34 <td class="firstname"><%= h(user.firstname) %></td>
35 <td class="lastname"><%= h(user.lastname) %></td>
35 <td class="lastname"><%= h(user.lastname) %></td>
36 <td class="email"><%= mail_to(h(user.mail)) %></td>
36 <td class="email"><%= mail_to(h(user.mail)) %></td>
37 <td align="center"><%= checked_image user.admin? %></td>
37 <td align="center"><%= checked_image user.admin? %></td>
38 <td class="created_on" align="center"><%= format_time(user.created_on) %></td>
38 <td class="created_on" align="center"><%= format_time(user.created_on) %></td>
39 <td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
39 <td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
40 <td><small><%= change_status_link(user) %></small></td>
40 <td><small><%= change_status_link(user) %></small></td>
41 </tr>
41 </tr>
42 <% end -%>
42 <% end -%>
43 </tbody>
43 </tbody>
44 </table>
44 </table>
45 </div>
45 </div>
46 <p class="pagination"><%= pagination_links_full @user_pages, @user_count %></p>
46 <p class="pagination"><%= pagination_links_full @user_pages, @user_count %></p>
47
47
48 <% html_title(l(:label_user_plural)) -%>
48 <% html_title(l(:label_user_plural)) -%>
1 NO CONTENT: file renamed from app/views/users/add.rhtml to app/views/users/new.html.erb
NO CONTENT: file renamed from app/views/users/add.rhtml to app/views/users/new.html.erb
@@ -1,259 +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 => 'details'
22 timelog.connect 'projects/:project_id/time_entries', :action => 'details'
23
23
24 timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
24 timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details|
25 time_details.connect 'time_entries'
25 time_details.connect 'time_entries'
26 time_details.connect 'time_entries.:format'
26 time_details.connect 'time_entries.:format'
27 time_details.connect 'issues/:issue_id/time_entries'
27 time_details.connect 'issues/:issue_id/time_entries'
28 time_details.connect 'issues/:issue_id/time_entries.:format'
28 time_details.connect 'issues/:issue_id/time_entries.:format'
29 time_details.connect 'projects/:project_id/time_entries.:format'
29 time_details.connect 'projects/:project_id/time_entries.:format'
30 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries'
30 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries'
31 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
31 time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format'
32 end
32 end
33 timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
33 timelog.connect 'projects/:project_id/time_entries/report', :action => 'report'
34 timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
34 timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report|
35 time_report.connect 'time_entries/report'
35 time_report.connect 'time_entries/report'
36 time_report.connect 'time_entries/report.:format'
36 time_report.connect 'time_entries/report.:format'
37 time_report.connect 'projects/:project_id/time_entries/report.:format'
37 time_report.connect 'projects/:project_id/time_entries/report.:format'
38 end
38 end
39
39
40 timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
40 timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit|
41 time_edit.connect 'issues/:issue_id/time_entries/new'
41 time_edit.connect 'issues/:issue_id/time_entries/new'
42 end
42 end
43
43
44 timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
44 timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post}
45 end
45 end
46
46
47 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
47 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
48 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
48 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
49 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
49 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
50 map.with_options :controller => 'wiki' do |wiki_routes|
50 map.with_options :controller => 'wiki' do |wiki_routes|
51 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
51 wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
52 wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i
52 wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i
53 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
53 wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
54 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
54 wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
55 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
55 wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
56 wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
56 wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
57 wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff'
57 wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff'
58 wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
58 wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
59 end
59 end
60
60
61 wiki_routes.connect 'projects/:id/wiki/:page/:action',
61 wiki_routes.connect 'projects/:id/wiki/:page/:action',
62 :action => /edit|rename|destroy|preview|protect/,
62 :action => /edit|rename|destroy|preview|protect/,
63 :conditions => {:method => :post}
63 :conditions => {:method => :post}
64 end
64 end
65
65
66 map.with_options :controller => 'messages' do |messages_routes|
66 map.with_options :controller => 'messages' do |messages_routes|
67 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
67 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
68 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
68 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
69 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
69 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
70 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
70 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
71 end
71 end
72 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
72 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
73 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
73 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
74 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
74 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
75 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
75 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
76 end
76 end
77 end
77 end
78
78
79 map.with_options :controller => 'boards' do |board_routes|
79 map.with_options :controller => 'boards' do |board_routes|
80 board_routes.with_options :conditions => {:method => :get} do |board_views|
80 board_routes.with_options :conditions => {:method => :get} do |board_views|
81 board_views.connect 'projects/:project_id/boards', :action => 'index'
81 board_views.connect 'projects/:project_id/boards', :action => 'index'
82 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
82 board_views.connect 'projects/:project_id/boards/new', :action => 'new'
83 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
83 board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
84 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
84 board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
85 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
85 board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
86 end
86 end
87 board_routes.with_options :conditions => {:method => :post} do |board_actions|
87 board_routes.with_options :conditions => {:method => :post} do |board_actions|
88 board_actions.connect 'projects/:project_id/boards', :action => 'new'
88 board_actions.connect 'projects/:project_id/boards', :action => 'new'
89 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
89 board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
90 end
90 end
91 end
91 end
92
92
93 map.with_options :controller => 'documents' do |document_routes|
93 map.with_options :controller => 'documents' do |document_routes|
94 document_routes.with_options :conditions => {:method => :get} do |document_views|
94 document_routes.with_options :conditions => {:method => :get} do |document_views|
95 document_views.connect 'projects/:project_id/documents', :action => 'index'
95 document_views.connect 'projects/:project_id/documents', :action => 'index'
96 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
96 document_views.connect 'projects/:project_id/documents/new', :action => 'new'
97 document_views.connect 'documents/:id', :action => 'show'
97 document_views.connect 'documents/:id', :action => 'show'
98 document_views.connect 'documents/:id/edit', :action => 'edit'
98 document_views.connect 'documents/:id/edit', :action => 'edit'
99 end
99 end
100 document_routes.with_options :conditions => {:method => :post} do |document_actions|
100 document_routes.with_options :conditions => {:method => :post} do |document_actions|
101 document_actions.connect 'projects/:project_id/documents', :action => 'new'
101 document_actions.connect 'projects/:project_id/documents', :action => 'new'
102 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
102 document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
103 end
103 end
104 end
104 end
105
105
106 map.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.with_options :conditions => {:method => :get} do |user_views|
143 users.with_options :conditions => {:method => :get} do |user_views|
144 user_views.connect 'users', :action => 'index'
144 user_views.connect 'users', :action => 'index'
145 user_views.connect 'users/:id', :action => 'show', :id => /\d+/
145 user_views.connect 'users/:id', :action => 'show', :id => /\d+/
146 user_views.connect 'users/new', :action => 'add'
146 user_views.connect 'users/new', :action => 'new'
147 user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
147 user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil
148 end
148 end
149 users.with_options :conditions => {:method => :post} do |user_actions|
149 users.with_options :conditions => {:method => :post} do |user_actions|
150 user_actions.connect 'users', :action => 'add'
151 user_actions.connect 'users/new', :action => 'create'
150 user_actions.connect 'users/new', :action => 'create'
152 user_actions.connect 'users/:id/edit', :action => 'edit'
151 user_actions.connect 'users/:id/edit', :action => 'edit'
153 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
152 user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
154 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
153 user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
155 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
154 user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
156 end
155 end
157 end
156 end
158
157
159 # For nice "roadmap" in the url for the index action
158 # For nice "roadmap" in the url for the index action
160 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
159 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
161
160
162 map.all_news 'news', :controller => 'news', :action => 'index'
161 map.all_news 'news', :controller => 'news', :action => 'index'
163 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
162 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
164 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
163 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
165 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}
166 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}
167
166
168 map.resources :projects, :member => {
167 map.resources :projects, :member => {
169 :copy => [:get, :post],
168 :copy => [:get, :post],
170 :settings => :get,
169 :settings => :get,
171 :modules => :post,
170 :modules => :post,
172 :archive => :post,
171 :archive => :post,
173 :unarchive => :post
172 :unarchive => :post
174 } do |project|
173 } do |project|
175 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
174 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
176 project.resources :files, :only => [:index, :new, :create]
175 project.resources :files, :only => [:index, :new, :create]
177 project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post}
176 project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post}
178 project.resources :news, :shallow => true
177 project.resources :news, :shallow => true
179 end
178 end
180
179
181 # 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
182 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}
183
182
184 # TODO: port to be part of the resources route(s)
183 # TODO: port to be part of the resources route(s)
185 map.with_options :controller => 'projects' do |project_mapper|
184 map.with_options :controller => 'projects' do |project_mapper|
186 project_mapper.with_options :conditions => {:method => :get} do |project_views|
185 project_mapper.with_options :conditions => {:method => :get} do |project_views|
187 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
186 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
188 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'
189 end
188 end
190 end
189 end
191
190
192 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|
193 activity.connect 'projects/:id/activity'
192 activity.connect 'projects/:id/activity'
194 activity.connect 'projects/:id/activity.:format'
193 activity.connect 'projects/:id/activity.:format'
195 activity.connect 'activity', :id => nil
194 activity.connect 'activity', :id => nil
196 activity.connect 'activity.:format', :id => nil
195 activity.connect 'activity.:format', :id => nil
197 end
196 end
198
197
199
198
200 map.with_options :controller => 'issue_categories' do |categories|
199 map.with_options :controller => 'issue_categories' do |categories|
201 categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
200 categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
202 end
201 end
203
202
204 map.with_options :controller => 'repositories' do |repositories|
203 map.with_options :controller => 'repositories' do |repositories|
205 repositories.with_options :conditions => {:method => :get} do |repository_views|
204 repositories.with_options :conditions => {:method => :get} do |repository_views|
206 repository_views.connect 'projects/:id/repository', :action => 'show'
205 repository_views.connect 'projects/:id/repository', :action => 'show'
207 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
206 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
208 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
207 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
209 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
208 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
210 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
209 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
211 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
210 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
212 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
211 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
213 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'
214 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\.\-_]+/ }
215 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\.\-_]+/ }
216 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'
217 # TODO: why the following route is required?
216 # TODO: why the following route is required?
218 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
217 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
219 repository_views.connect 'projects/:id/repository/:action/*path'
218 repository_views.connect 'projects/:id/repository/:action/*path'
220 end
219 end
221
220
222 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
221 repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
223 end
222 end
224
223
225 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
224 map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
226 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 => /.*/
227 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 => /.*/
228
227
229 map.resources :groups
228 map.resources :groups
230
229
231 #left old routes at the bottom for backwards compat
230 #left old routes at the bottom for backwards compat
232 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
231 map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
233 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
232 map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
234 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
233 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
235 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
234 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
236 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
235 map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
237 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
236 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
238 map.connect 'projects/:project_id/news/:action', :controller => 'news'
237 map.connect 'projects/:project_id/news/:action', :controller => 'news'
239 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 => /.+/
240 map.with_options :controller => 'repositories' do |omap|
239 map.with_options :controller => 'repositories' do |omap|
241 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
240 omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
242 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
241 omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
243 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
242 omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
244 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
243 omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
245 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
244 omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
246 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
245 omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
247 end
246 end
248
247
249 map.with_options :controller => 'sys' do |sys|
248 map.with_options :controller => 'sys' do |sys|
250 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
249 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
251 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}
252 end
251 end
253
252
254 # Install the default route as the lowest priority.
253 # Install the default route as the lowest priority.
255 map.connect ':controller/:action/:id'
254 map.connect ':controller/:action/:id'
256 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
255 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
257 # Used for OpenID
256 # Used for OpenID
258 map.root :controller => 'account', :action => 'login'
257 map.root :controller => 'account', :action => 'login'
259 end
258 end
@@ -1,222 +1,222
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 require File.dirname(__FILE__) + '/../test_helper'
18 require File.dirname(__FILE__) + '/../test_helper'
19 require 'users_controller'
19 require 'users_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class UsersController; def rescue_action(e) raise e end; end
22 class UsersController; def rescue_action(e) raise e end; end
23
23
24 class UsersControllerTest < ActionController::TestCase
24 class UsersControllerTest < ActionController::TestCase
25 include Redmine::I18n
25 include Redmine::I18n
26
26
27 fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources
27 fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources
28
28
29 def setup
29 def setup
30 @controller = UsersController.new
30 @controller = UsersController.new
31 @request = ActionController::TestRequest.new
31 @request = ActionController::TestRequest.new
32 @response = ActionController::TestResponse.new
32 @response = ActionController::TestResponse.new
33 User.current = nil
33 User.current = nil
34 @request.session[:user_id] = 1 # admin
34 @request.session[:user_id] = 1 # admin
35 end
35 end
36
36
37 def test_index
37 def test_index
38 get :index
38 get :index
39 assert_response :success
39 assert_response :success
40 assert_template 'index'
40 assert_template 'index'
41 end
41 end
42
42
43 def test_index
43 def test_index
44 get :index
44 get :index
45 assert_response :success
45 assert_response :success
46 assert_template 'index'
46 assert_template 'index'
47 assert_not_nil assigns(:users)
47 assert_not_nil assigns(:users)
48 # active users only
48 # active users only
49 assert_nil assigns(:users).detect {|u| !u.active?}
49 assert_nil assigns(:users).detect {|u| !u.active?}
50 end
50 end
51
51
52 def test_index_with_name_filter
52 def test_index_with_name_filter
53 get :index, :name => 'john'
53 get :index, :name => 'john'
54 assert_response :success
54 assert_response :success
55 assert_template 'index'
55 assert_template 'index'
56 users = assigns(:users)
56 users = assigns(:users)
57 assert_not_nil users
57 assert_not_nil users
58 assert_equal 1, users.size
58 assert_equal 1, users.size
59 assert_equal 'John', users.first.firstname
59 assert_equal 'John', users.first.firstname
60 end
60 end
61
61
62 def test_show
62 def test_show
63 @request.session[:user_id] = nil
63 @request.session[:user_id] = nil
64 get :show, :id => 2
64 get :show, :id => 2
65 assert_response :success
65 assert_response :success
66 assert_template 'show'
66 assert_template 'show'
67 assert_not_nil assigns(:user)
67 assert_not_nil assigns(:user)
68 end
68 end
69
69
70 def test_show_should_not_fail_when_custom_values_are_nil
70 def test_show_should_not_fail_when_custom_values_are_nil
71 user = User.find(2)
71 user = User.find(2)
72
72
73 # Create a custom field to illustrate the issue
73 # Create a custom field to illustrate the issue
74 custom_field = CustomField.create!(:name => 'Testing', :field_format => 'text')
74 custom_field = CustomField.create!(:name => 'Testing', :field_format => 'text')
75 custom_value = user.custom_values.build(:custom_field => custom_field).save!
75 custom_value = user.custom_values.build(:custom_field => custom_field).save!
76
76
77 get :show, :id => 2
77 get :show, :id => 2
78 assert_response :success
78 assert_response :success
79 end
79 end
80
80
81 def test_show_inactive
81 def test_show_inactive
82 @request.session[:user_id] = nil
82 @request.session[:user_id] = nil
83 get :show, :id => 5
83 get :show, :id => 5
84 assert_response 404
84 assert_response 404
85 end
85 end
86
86
87 def test_show_should_not_reveal_users_with_no_visible_activity_or_project
87 def test_show_should_not_reveal_users_with_no_visible_activity_or_project
88 @request.session[:user_id] = nil
88 @request.session[:user_id] = nil
89 get :show, :id => 9
89 get :show, :id => 9
90 assert_response 404
90 assert_response 404
91 end
91 end
92
92
93 def test_show_inactive_by_admin
93 def test_show_inactive_by_admin
94 @request.session[:user_id] = 1
94 @request.session[:user_id] = 1
95 get :show, :id => 5
95 get :show, :id => 5
96 assert_response 200
96 assert_response 200
97 assert_not_nil assigns(:user)
97 assert_not_nil assigns(:user)
98 end
98 end
99
99
100 def test_show_displays_memberships_based_on_project_visibility
100 def test_show_displays_memberships_based_on_project_visibility
101 @request.session[:user_id] = 1
101 @request.session[:user_id] = 1
102 get :show, :id => 2
102 get :show, :id => 2
103 assert_response :success
103 assert_response :success
104 memberships = assigns(:memberships)
104 memberships = assigns(:memberships)
105 assert_not_nil memberships
105 assert_not_nil memberships
106 project_ids = memberships.map(&:project_id)
106 project_ids = memberships.map(&:project_id)
107 assert project_ids.include?(2) #private project admin can see
107 assert project_ids.include?(2) #private project admin can see
108 end
108 end
109
109
110 context "GET :add" do
110 context "GET :new" do
111 setup do
111 setup do
112 get :add
112 get :new
113 end
113 end
114
114
115 should_assign_to :user
115 should_assign_to :user
116 should_respond_with :success
116 should_respond_with :success
117 should_render_template :add
117 should_render_template :new
118 end
118 end
119
119
120 context "POST :create" do
120 context "POST :create" do
121 context "when successful" do
121 context "when successful" do
122 setup do
122 setup do
123 post :create, :user => {
123 post :create, :user => {
124 :firstname => 'John',
124 :firstname => 'John',
125 :lastname => 'Doe',
125 :lastname => 'Doe',
126 :login => 'jdoe',
126 :login => 'jdoe',
127 :password => 'test',
127 :password => 'test',
128 :password_confirmation => 'test',
128 :password_confirmation => 'test',
129 :mail => 'jdoe@gmail.com'
129 :mail => 'jdoe@gmail.com'
130 },
130 },
131 :notification_option => 'none'
131 :notification_option => 'none'
132 end
132 end
133
133
134 should_assign_to :user
134 should_assign_to :user
135 should_respond_with :redirect
135 should_respond_with :redirect
136 should_redirect_to('user edit') { {:controller => 'users', :action => 'edit', :id => User.find_by_login('jdoe')}}
136 should_redirect_to('user edit') { {:controller => 'users', :action => 'edit', :id => User.find_by_login('jdoe')}}
137
137
138 should 'set the users mail notification' do
138 should 'set the users mail notification' do
139 user = User.last
139 user = User.last
140 assert_equal 'none', user.mail_notification
140 assert_equal 'none', user.mail_notification
141 end
141 end
142 end
142 end
143
143
144 context "when unsuccessful" do
144 context "when unsuccessful" do
145 setup do
145 setup do
146 post :create, :user => {}
146 post :create, :user => {}
147 end
147 end
148
148
149 should_assign_to :user
149 should_assign_to :user
150 should_respond_with :success
150 should_respond_with :success
151 should_render_template :add
151 should_render_template :new
152 end
152 end
153
153
154 end
154 end
155
155
156 def test_edit
156 def test_edit
157 ActionMailer::Base.deliveries.clear
157 ActionMailer::Base.deliveries.clear
158 post :edit, :id => 2, :user => {:firstname => 'Changed'}, :notification_option => 'all', :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
158 post :edit, :id => 2, :user => {:firstname => 'Changed'}, :notification_option => 'all', :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
159
159
160 user = User.find(2)
160 user = User.find(2)
161 assert_equal 'Changed', user.firstname
161 assert_equal 'Changed', user.firstname
162 assert_equal 'all', user.mail_notification
162 assert_equal 'all', user.mail_notification
163 assert_equal true, user.pref[:hide_mail]
163 assert_equal true, user.pref[:hide_mail]
164 assert_equal 'desc', user.pref[:comments_sorting]
164 assert_equal 'desc', user.pref[:comments_sorting]
165 assert ActionMailer::Base.deliveries.empty?
165 assert ActionMailer::Base.deliveries.empty?
166 end
166 end
167
167
168 def test_edit_with_activation_should_send_a_notification
168 def test_edit_with_activation_should_send_a_notification
169 u = User.new(:firstname => 'Foo', :lastname => 'Bar', :mail => 'foo.bar@somenet.foo', :language => 'fr')
169 u = User.new(:firstname => 'Foo', :lastname => 'Bar', :mail => 'foo.bar@somenet.foo', :language => 'fr')
170 u.login = 'foo'
170 u.login = 'foo'
171 u.status = User::STATUS_REGISTERED
171 u.status = User::STATUS_REGISTERED
172 u.save!
172 u.save!
173 ActionMailer::Base.deliveries.clear
173 ActionMailer::Base.deliveries.clear
174 Setting.bcc_recipients = '1'
174 Setting.bcc_recipients = '1'
175
175
176 post :edit, :id => u.id, :user => {:status => User::STATUS_ACTIVE}
176 post :edit, :id => u.id, :user => {:status => User::STATUS_ACTIVE}
177 assert u.reload.active?
177 assert u.reload.active?
178 mail = ActionMailer::Base.deliveries.last
178 mail = ActionMailer::Base.deliveries.last
179 assert_not_nil mail
179 assert_not_nil mail
180 assert_equal ['foo.bar@somenet.foo'], mail.bcc
180 assert_equal ['foo.bar@somenet.foo'], mail.bcc
181 assert mail.body.include?(ll('fr', :notice_account_activated))
181 assert mail.body.include?(ll('fr', :notice_account_activated))
182 end
182 end
183
183
184 def test_edit_with_password_change_should_send_a_notification
184 def test_edit_with_password_change_should_send_a_notification
185 ActionMailer::Base.deliveries.clear
185 ActionMailer::Base.deliveries.clear
186 Setting.bcc_recipients = '1'
186 Setting.bcc_recipients = '1'
187
187
188 u = User.find(2)
188 u = User.find(2)
189 post :edit, :id => u.id, :user => {}, :password => 'newpass', :password_confirmation => 'newpass', :send_information => '1'
189 post :edit, :id => u.id, :user => {}, :password => 'newpass', :password_confirmation => 'newpass', :send_information => '1'
190 assert_equal User.hash_password('newpass'), u.reload.hashed_password
190 assert_equal User.hash_password('newpass'), u.reload.hashed_password
191
191
192 mail = ActionMailer::Base.deliveries.last
192 mail = ActionMailer::Base.deliveries.last
193 assert_not_nil mail
193 assert_not_nil mail
194 assert_equal [u.mail], mail.bcc
194 assert_equal [u.mail], mail.bcc
195 assert mail.body.include?('newpass')
195 assert mail.body.include?('newpass')
196 end
196 end
197
197
198 test "POST :edit with a password change to an AuthSource user switching to Internal authentication" do
198 test "POST :edit with a password change to an AuthSource user switching to Internal authentication" do
199 # Configure as auth source
199 # Configure as auth source
200 u = User.find(2)
200 u = User.find(2)
201 u.auth_source = AuthSource.find(1)
201 u.auth_source = AuthSource.find(1)
202 u.save!
202 u.save!
203
203
204 post :edit, :id => u.id, :user => {:auth_source_id => ''}, :password => 'newpass', :password_confirmation => 'newpass'
204 post :edit, :id => u.id, :user => {:auth_source_id => ''}, :password => 'newpass', :password_confirmation => 'newpass'
205
205
206 assert_equal nil, u.reload.auth_source
206 assert_equal nil, u.reload.auth_source
207 assert_equal User.hash_password('newpass'), u.reload.hashed_password
207 assert_equal User.hash_password('newpass'), u.reload.hashed_password
208 end
208 end
209
209
210 def test_edit_membership
210 def test_edit_membership
211 post :edit_membership, :id => 2, :membership_id => 1,
211 post :edit_membership, :id => 2, :membership_id => 1,
212 :membership => { :role_ids => [2]}
212 :membership => { :role_ids => [2]}
213 assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'
213 assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'
214 assert_equal [2], Member.find(1).role_ids
214 assert_equal [2], Member.find(1).role_ids
215 end
215 end
216
216
217 def test_destroy_membership
217 def test_destroy_membership
218 post :destroy_membership, :id => 2, :membership_id => 1
218 post :destroy_membership, :id => 2, :membership_id => 1
219 assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'
219 assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'
220 assert_nil Member.find_by_id(1)
220 assert_nil Member.find_by_id(1)
221 end
221 end
222 end
222 end
@@ -1,49 +1,49
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
2 # Copyright (C) 2006 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require "#{File.dirname(__FILE__)}/../test_helper"
18 require "#{File.dirname(__FILE__)}/../test_helper"
19
19
20 class AdminTest < ActionController::IntegrationTest
20 class AdminTest < ActionController::IntegrationTest
21 fixtures :all
21 fixtures :all
22
22
23 def test_add_user
23 def test_add_user
24 log_user("admin", "admin")
24 log_user("admin", "admin")
25 get "/users/add"
25 get "/users/new"
26 assert_response :success
26 assert_response :success
27 assert_template "users/add"
27 assert_template "users/new"
28 post "/users/create", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en" }, :password => "psmith09", :password_confirmation => "psmith09"
28 post "/users/create", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en" }, :password => "psmith09", :password_confirmation => "psmith09"
29
29
30 user = User.find_by_login("psmith")
30 user = User.find_by_login("psmith")
31 assert_kind_of User, user
31 assert_kind_of User, user
32 assert_redirected_to "/users/#{ user.id }/edit"
32 assert_redirected_to "/users/#{ user.id }/edit"
33
33
34 logged_user = User.try_to_login("psmith", "psmith09")
34 logged_user = User.try_to_login("psmith", "psmith09")
35 assert_kind_of User, logged_user
35 assert_kind_of User, logged_user
36 assert_equal "Paul", logged_user.firstname
36 assert_equal "Paul", logged_user.firstname
37
37
38 post "users/edit", :id => user.id, :user => { :status => User::STATUS_LOCKED }
38 post "users/edit", :id => user.id, :user => { :status => User::STATUS_LOCKED }
39 assert_redirected_to "/users/#{ user.id }/edit"
39 assert_redirected_to "/users/#{ user.id }/edit"
40 locked_user = User.try_to_login("psmith", "psmith09")
40 locked_user = User.try_to_login("psmith", "psmith09")
41 assert_equal nil, locked_user
41 assert_equal nil, locked_user
42 end
42 end
43
43
44 test "Add a user as an anonymous user should fail" do
44 test "Add a user as an anonymous user should fail" do
45 post '/users/create', :user => { :login => 'psmith', :firstname => 'Paul'}, :password => "psmith09", :password_confirmation => "psmith09"
45 post '/users/create', :user => { :login => 'psmith', :firstname => 'Paul'}, :password => "psmith09", :password_confirmation => "psmith09"
46 assert_response :redirect
46 assert_response :redirect
47 assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fusers%2Fnew"
47 assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fusers%2Fnew"
48 end
48 end
49 end
49 end
@@ -1,302 +1,302
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, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567'
225 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'
226 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'
227 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'
228 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
229 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
229 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
230 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
230 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
231 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
231 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
232 should_route :get, "/time_entries", :controller => 'timelog', :action => 'details'
232 should_route :get, "/time_entries", :controller => 'timelog', :action => 'details'
233 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv'
233 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv'
234 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom'
234 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom'
235 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567'
235 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567'
236 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv'
236 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv'
237 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom'
237 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom'
238 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234'
238 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234'
239 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv'
239 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv'
240 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom'
240 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom'
241 should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123'
241 should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123'
242
242
243 should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55'
243 should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55'
244 end
244 end
245
245
246 context "users" do
246 context "users" do
247 should_route :get, "/users", :controller => 'users', :action => 'index'
247 should_route :get, "/users", :controller => 'users', :action => 'index'
248 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
248 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
249 should_route :get, "/users/new", :controller => 'users', :action => 'add'
249 should_route :get, "/users/new", :controller => 'users', :action => 'new'
250 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
250 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
251 should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
251 should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
252
252
253 should_route :post, "/users/new", :controller => 'users', :action => 'create'
253 should_route :post, "/users/new", :controller => 'users', :action => 'create'
254 should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
254 should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
255 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
255 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
256 should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
256 should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
257 should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
257 should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
258 end
258 end
259
259
260 # TODO: should they all be scoped under /projects/:project_id ?
260 # TODO: should they all be scoped under /projects/:project_id ?
261 context "versions" do
261 context "versions" do
262 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
262 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
263 should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1'
263 should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1'
264 should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1'
264 should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1'
265
265
266 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
266 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
267 should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1'
267 should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1'
268
268
269 should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1'
269 should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1'
270 end
270 end
271
271
272 context "wiki (singular, project's pages)" do
272 context "wiki (singular, project's pages)" do
273 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567'
273 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567'
274 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala'
274 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala'
275 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
275 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
276 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation'
276 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation'
277 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'
277 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'
278 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
278 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
279 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
279 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
280 should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index'
280 should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index'
281 should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index'
281 should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index'
282 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
282 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
283 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export'
283 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export'
284
284
285 should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
285 should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
286 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation'
286 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation'
287 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
287 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
288 should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida'
288 should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida'
289 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida'
289 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida'
290 end
290 end
291
291
292 context "wikis (plural, admin setup)" do
292 context "wikis (plural, admin setup)" do
293 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
293 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
294
294
295 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
295 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
296 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
296 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
297 end
297 end
298
298
299 context "administration panel" do
299 context "administration panel" do
300 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
300 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
301 end
301 end
302 end
302 end
General Comments 0
You need to be logged in to leave comments. Login now