@@ -0,0 +1,77 | |||||
|
1 | <h2><%= link_to l(:label_tracker_plural), trackers_path %> » <%= l(:field_summary) %></h2> | |||
|
2 | ||||
|
3 | <% if @trackers.any? %> | |||
|
4 | <%= form_tag({}) do %> | |||
|
5 | <div class="autoscroll"> | |||
|
6 | <table class="list"> | |||
|
7 | <thead> | |||
|
8 | <tr> | |||
|
9 | <th></th> | |||
|
10 | <% @trackers.each do |tracker| %> | |||
|
11 | <th> | |||
|
12 | <%= tracker.name %> | |||
|
13 | <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')", | |||
|
14 | :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> | |||
|
15 | </th> | |||
|
16 | <% end %> | |||
|
17 | </tr> | |||
|
18 | </thead> | |||
|
19 | <tbody> | |||
|
20 | <tr class="group open"> | |||
|
21 | <td colspan="<%= @trackers.size + 1 %>"> | |||
|
22 | <span class="expander" onclick="toggleRowGroup(this);"> </span> | |||
|
23 | <%= l(:field_core_fields) %> | |||
|
24 | </td> | |||
|
25 | </tr> | |||
|
26 | <% Tracker::CORE_FIELDS.each do |field| %> | |||
|
27 | <tr class="<%= cycle("odd", "even") %>"> | |||
|
28 | <td> | |||
|
29 | <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.core-field-#{field}')", | |||
|
30 | :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> | |||
|
31 | <%= l("field_#{field}".sub(/_id$/, '')) %> | |||
|
32 | </td> | |||
|
33 | <% @trackers.each do |tracker| %> | |||
|
34 | <td align="center"> | |||
|
35 | <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field), | |||
|
36 | :class => "tracker-#{tracker.id} core-field-#{field}" %> | |||
|
37 | </td> | |||
|
38 | <% end %> | |||
|
39 | </tr> | |||
|
40 | <% end %> | |||
|
41 | <% if @custom_fields.any? %> | |||
|
42 | <tr class="group open"> | |||
|
43 | <td colspan="<%= @trackers.size + 1 %>"> | |||
|
44 | <span class="expander" onclick="toggleRowGroup(this);"> </span> | |||
|
45 | <%= l(:label_custom_field_plural) %> | |||
|
46 | </td> | |||
|
47 | </tr> | |||
|
48 | <% @custom_fields.each do |field| %> | |||
|
49 | <tr class="<%= cycle("odd", "even") %>"> | |||
|
50 | <td> | |||
|
51 | <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.custom-field-#{field.id}')", | |||
|
52 | :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> | |||
|
53 | <%= field.name %> | |||
|
54 | </td> | |||
|
55 | <% @trackers.each do |tracker| %> | |||
|
56 | <td align="center"> | |||
|
57 | <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field), | |||
|
58 | :class => "tracker-#{tracker.id} custom-field-#{field.id}" %> | |||
|
59 | </td> | |||
|
60 | <% end %> | |||
|
61 | </tr> | |||
|
62 | <% end %> | |||
|
63 | <% end %> | |||
|
64 | </tbody> | |||
|
65 | </table> | |||
|
66 | </div> | |||
|
67 | <p><%= submit_tag l(:button_save) %></p> | |||
|
68 | <% @trackers.each do |tracker| %> | |||
|
69 | <%= hidden_field_tag "trackers[#{tracker.id}][core_fields][]", '' %> | |||
|
70 | <%= hidden_field_tag "trackers[#{tracker.id}][custom_field_ids][]", '' %> | |||
|
71 | <% end %> | |||
|
72 | <% end %> | |||
|
73 | <% else %> | |||
|
74 | <p class="nodata"><%= l(:label_no_data) %></p> | |||
|
75 | <% end %> | |||
|
76 | ||||
|
77 | <% html_title l(:field_summary) %> |
@@ -1,83 +1,101 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 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 TrackersController < ApplicationController |
|
18 | class TrackersController < ApplicationController | |
19 | layout 'admin' |
|
19 | layout 'admin' | |
20 |
|
20 | |||
21 | before_filter :require_admin, :except => :index |
|
21 | before_filter :require_admin, :except => :index | |
22 | before_filter :require_admin_or_api_request, :only => :index |
|
22 | before_filter :require_admin_or_api_request, :only => :index | |
23 | accept_api_auth :index |
|
23 | accept_api_auth :index | |
24 |
|
24 | |||
25 | def index |
|
25 | def index | |
26 | respond_to do |format| |
|
26 | respond_to do |format| | |
27 | format.html { |
|
27 | format.html { | |
28 | @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position' |
|
28 | @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position' | |
29 | render :action => "index", :layout => false if request.xhr? |
|
29 | render :action => "index", :layout => false if request.xhr? | |
30 | } |
|
30 | } | |
31 | format.api { |
|
31 | format.api { | |
32 | @trackers = Tracker.sorted.all |
|
32 | @trackers = Tracker.sorted.all | |
33 | } |
|
33 | } | |
34 | end |
|
34 | end | |
35 | end |
|
35 | end | |
36 |
|
36 | |||
37 | def new |
|
37 | def new | |
38 | @tracker ||= Tracker.new(params[:tracker]) |
|
38 | @tracker ||= Tracker.new(params[:tracker]) | |
39 | @trackers = Tracker.find :all, :order => 'position' |
|
39 | @trackers = Tracker.find :all, :order => 'position' | |
40 | @projects = Project.find(:all) |
|
40 | @projects = Project.find(:all) | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | def create |
|
43 | def create | |
44 | @tracker = Tracker.new(params[:tracker]) |
|
44 | @tracker = Tracker.new(params[:tracker]) | |
45 | if request.post? and @tracker.save |
|
45 | if request.post? and @tracker.save | |
46 | # workflow copy |
|
46 | # workflow copy | |
47 | if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from])) |
|
47 | if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from])) | |
48 | @tracker.workflow_rules.copy(copy_from) |
|
48 | @tracker.workflow_rules.copy(copy_from) | |
49 | end |
|
49 | end | |
50 | flash[:notice] = l(:notice_successful_create) |
|
50 | flash[:notice] = l(:notice_successful_create) | |
51 | redirect_to :action => 'index' |
|
51 | redirect_to :action => 'index' | |
52 | return |
|
52 | return | |
53 | end |
|
53 | end | |
54 | new |
|
54 | new | |
55 | render :action => 'new' |
|
55 | render :action => 'new' | |
56 | end |
|
56 | end | |
57 |
|
57 | |||
58 | def edit |
|
58 | def edit | |
59 | @tracker ||= Tracker.find(params[:id]) |
|
59 | @tracker ||= Tracker.find(params[:id]) | |
60 | @projects = Project.find(:all) |
|
60 | @projects = Project.find(:all) | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | def update |
|
63 | def update | |
64 | @tracker = Tracker.find(params[:id]) |
|
64 | @tracker = Tracker.find(params[:id]) | |
65 | if request.put? and @tracker.update_attributes(params[:tracker]) |
|
65 | if request.put? and @tracker.update_attributes(params[:tracker]) | |
66 | flash[:notice] = l(:notice_successful_update) |
|
66 | flash[:notice] = l(:notice_successful_update) | |
67 | redirect_to :action => 'index' |
|
67 | redirect_to :action => 'index' | |
68 | return |
|
68 | return | |
69 | end |
|
69 | end | |
70 | edit |
|
70 | edit | |
71 | render :action => 'edit' |
|
71 | render :action => 'edit' | |
72 | end |
|
72 | end | |
73 |
|
73 | |||
74 | def destroy |
|
74 | def destroy | |
75 | @tracker = Tracker.find(params[:id]) |
|
75 | @tracker = Tracker.find(params[:id]) | |
76 | unless @tracker.issues.empty? |
|
76 | unless @tracker.issues.empty? | |
77 | flash[:error] = l(:error_can_not_delete_tracker) |
|
77 | flash[:error] = l(:error_can_not_delete_tracker) | |
78 | else |
|
78 | else | |
79 | @tracker.destroy |
|
79 | @tracker.destroy | |
80 | end |
|
80 | end | |
81 | redirect_to :action => 'index' |
|
81 | redirect_to :action => 'index' | |
82 | end |
|
82 | end | |
|
83 | ||||
|
84 | def fields | |||
|
85 | if request.post? && params[:trackers] | |||
|
86 | params[:trackers].each do |tracker_id, tracker_params| | |||
|
87 | tracker = Tracker.find_by_id(tracker_id) | |||
|
88 | if tracker | |||
|
89 | tracker.core_fields = tracker_params[:core_fields] | |||
|
90 | tracker.custom_field_ids = tracker_params[:custom_field_ids] | |||
|
91 | tracker.save | |||
|
92 | end | |||
|
93 | end | |||
|
94 | flash[:notice] = l(:notice_successful_update) | |||
|
95 | redirect_to :action => 'fields' | |||
|
96 | return | |||
|
97 | end | |||
|
98 | @trackers = Tracker.sorted.all | |||
|
99 | @custom_fields = IssueCustomField.all.sort | |||
|
100 | end | |||
83 | end |
|
101 | end |
@@ -1,30 +1,31 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= link_to l(:label_tracker_new), new_tracker_path, :class => 'icon icon-add' %> |
|
2 | <%= link_to l(:label_tracker_new), new_tracker_path, :class => 'icon icon-add' %> | |
|
3 | <%= link_to l(:field_summary), {:action => 'fields'}, :class => 'icon icon-summary' %> | |||
3 | </div> |
|
4 | </div> | |
4 |
|
5 | |||
5 | <h2><%=l(:label_tracker_plural)%></h2> |
|
6 | <h2><%=l(:label_tracker_plural)%></h2> | |
6 |
|
7 | |||
7 | <table class="list"> |
|
8 | <table class="list"> | |
8 | <thead><tr> |
|
9 | <thead><tr> | |
9 | <th><%=l(:label_tracker)%></th> |
|
10 | <th><%=l(:label_tracker)%></th> | |
10 | <th></th> |
|
11 | <th></th> | |
11 | <th><%=l(:button_sort)%></th> |
|
12 | <th><%=l(:button_sort)%></th> | |
12 | <th></th> |
|
13 | <th></th> | |
13 | </tr></thead> |
|
14 | </tr></thead> | |
14 | <tbody> |
|
15 | <tbody> | |
15 | <% for tracker in @trackers %> |
|
16 | <% for tracker in @trackers %> | |
16 | <tr class="<%= cycle("odd", "even") %>"> |
|
17 | <tr class="<%= cycle("odd", "even") %>"> | |
17 | <td><%= link_to h(tracker.name), edit_tracker_path(tracker) %></td> |
|
18 | <td><%= link_to h(tracker.name), edit_tracker_path(tracker) %></td> | |
18 | <td align="center"><% unless tracker.workflow_rules.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => 'workflows', :action => 'edit', :tracker_id => tracker} %>)</span><% end %></td> |
|
19 | <td align="center"><% unless tracker.workflow_rules.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => 'workflows', :action => 'edit', :tracker_id => tracker} %>)</span><% end %></td> | |
19 | <td align="center" style="width:15%;"><%= reorder_links('tracker', {:action => 'update', :id => tracker}, :put) %></td> |
|
20 | <td align="center" style="width:15%;"><%= reorder_links('tracker', {:action => 'update', :id => tracker}, :put) %></td> | |
20 | <td class="buttons"> |
|
21 | <td class="buttons"> | |
21 | <%= delete_link tracker_path(tracker) %> |
|
22 | <%= delete_link tracker_path(tracker) %> | |
22 | </td> |
|
23 | </td> | |
23 | </tr> |
|
24 | </tr> | |
24 | <% end %> |
|
25 | <% end %> | |
25 | </tbody> |
|
26 | </tbody> | |
26 | </table> |
|
27 | </table> | |
27 |
|
28 | |||
28 | <p class="pagination"><%= pagination_links_full @tracker_pages %></p> |
|
29 | <p class="pagination"><%= pagination_links_full @tracker_pages %></p> | |
29 |
|
30 | |||
30 | <% html_title(l(:label_tracker_plural)) -%> |
|
31 | <% html_title(l(:label_tracker_plural)) -%> |
@@ -1,340 +1,344 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 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 | RedmineApp::Application.routes.draw do |
|
18 | RedmineApp::Application.routes.draw do | |
19 | root :to => 'welcome#index', :as => 'home' |
|
19 | root :to => 'welcome#index', :as => 'home' | |
20 |
|
20 | |||
21 | match 'login', :to => 'account#login', :as => 'signin' |
|
21 | match 'login', :to => 'account#login', :as => 'signin' | |
22 | match 'logout', :to => 'account#logout', :as => 'signout' |
|
22 | match 'logout', :to => 'account#logout', :as => 'signout' | |
23 | match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' |
|
23 | match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' | |
24 | match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' |
|
24 | match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' | |
25 | match 'account/activate', :to => 'account#activate', :via => :get |
|
25 | match 'account/activate', :to => 'account#activate', :via => :get | |
26 |
|
26 | |||
27 | match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news' |
|
27 | match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news' | |
28 | match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue' |
|
28 | match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue' | |
29 | match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue' |
|
29 | match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue' | |
30 | match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue' |
|
30 | match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue' | |
31 |
|
31 | |||
32 | match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post |
|
32 | match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post | |
33 | match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] |
|
33 | match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] | |
34 |
|
34 | |||
35 | match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post] |
|
35 | match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post] | |
36 | get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' |
|
36 | get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' | |
37 | match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] |
|
37 | match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] | |
38 | get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' |
|
38 | get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' | |
39 |
|
39 | |||
40 | post 'boards/:board_id/topics/preview', :to => 'messages#preview' |
|
40 | post 'boards/:board_id/topics/preview', :to => 'messages#preview' | |
41 | post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' |
|
41 | post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' | |
42 | post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' |
|
42 | post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' | |
43 | post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' |
|
43 | post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' | |
44 |
|
44 | |||
45 | # Misc issue routes. TODO: move into resources |
|
45 | # Misc issue routes. TODO: move into resources | |
46 | match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' |
|
46 | match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' | |
47 | match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu' |
|
47 | match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu' | |
48 | match '/issues/changes', :to => 'journals#index', :as => 'issue_changes' |
|
48 | match '/issues/changes', :to => 'journals#index', :as => 'issue_changes' | |
49 | match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' |
|
49 | match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' | |
50 |
|
50 | |||
51 | match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get |
|
51 | match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get | |
52 | match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] |
|
52 | match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] | |
53 |
|
53 | |||
54 | match '/projects/:project_id/issues/gantt', :to => 'gantts#show' |
|
54 | match '/projects/:project_id/issues/gantt', :to => 'gantts#show' | |
55 | match '/issues/gantt', :to => 'gantts#show' |
|
55 | match '/issues/gantt', :to => 'gantts#show' | |
56 |
|
56 | |||
57 | match '/projects/:project_id/issues/calendar', :to => 'calendars#show' |
|
57 | match '/projects/:project_id/issues/calendar', :to => 'calendars#show' | |
58 | match '/issues/calendar', :to => 'calendars#show' |
|
58 | match '/issues/calendar', :to => 'calendars#show' | |
59 |
|
59 | |||
60 | match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get |
|
60 | match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get | |
61 | match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get |
|
61 | match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get | |
62 |
|
62 | |||
63 | match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] |
|
63 | match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] | |
64 | match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] |
|
64 | match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] | |
65 | match 'my/page', :controller => 'my', :action => 'page', :via => :get |
|
65 | match 'my/page', :controller => 'my', :action => 'page', :via => :get | |
66 | match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page |
|
66 | match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page | |
67 | match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post |
|
67 | match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post | |
68 | match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post |
|
68 | match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post | |
69 | match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] |
|
69 | match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] | |
70 | match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get |
|
70 | match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get | |
71 | match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post |
|
71 | match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post | |
72 | match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post |
|
72 | match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post | |
73 | match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post |
|
73 | match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post | |
74 |
|
74 | |||
75 | resources :users |
|
75 | resources :users | |
76 | match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' |
|
76 | match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' | |
77 | match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete |
|
77 | match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete | |
78 | match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' |
|
78 | match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' | |
79 |
|
79 | |||
80 | match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get |
|
80 | match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get | |
81 | match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post |
|
81 | match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post | |
82 | match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post |
|
82 | match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post | |
83 | match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post |
|
83 | match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post | |
84 | match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post |
|
84 | match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post | |
85 | match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post |
|
85 | match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post | |
86 | match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get |
|
86 | match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get | |
87 |
|
87 | |||
88 | match 'projects/:id/settings/:tab', :to => "projects#settings" |
|
88 | match 'projects/:id/settings/:tab', :to => "projects#settings" | |
89 |
|
89 | |||
90 | resources :projects do |
|
90 | resources :projects do | |
91 | member do |
|
91 | member do | |
92 | get 'settings' |
|
92 | get 'settings' | |
93 | post 'modules' |
|
93 | post 'modules' | |
94 | post 'archive' |
|
94 | post 'archive' | |
95 | post 'unarchive' |
|
95 | post 'unarchive' | |
96 | post 'close' |
|
96 | post 'close' | |
97 | post 'reopen' |
|
97 | post 'reopen' | |
98 | match 'copy', :via => [:get, :post] |
|
98 | match 'copy', :via => [:get, :post] | |
99 | end |
|
99 | end | |
100 |
|
100 | |||
101 | resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :create, :update, :destroy] do |
|
101 | resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :create, :update, :destroy] do | |
102 | collection do |
|
102 | collection do | |
103 | get 'autocomplete' |
|
103 | get 'autocomplete' | |
104 | end |
|
104 | end | |
105 | end |
|
105 | end | |
106 |
|
106 | |||
107 | resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] |
|
107 | resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] | |
108 |
|
108 | |||
109 | match 'issues/:copy_from/copy', :to => 'issues#new' |
|
109 | match 'issues/:copy_from/copy', :to => 'issues#new' | |
110 | resources :issues, :only => [:index, :new, :create] do |
|
110 | resources :issues, :only => [:index, :new, :create] do | |
111 | resources :time_entries, :controller => 'timelog' do |
|
111 | resources :time_entries, :controller => 'timelog' do | |
112 | collection do |
|
112 | collection do | |
113 | get 'report' |
|
113 | get 'report' | |
114 | end |
|
114 | end | |
115 | end |
|
115 | end | |
116 | end |
|
116 | end | |
117 | # issue form update |
|
117 | # issue form update | |
118 | match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' |
|
118 | match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' | |
119 |
|
119 | |||
120 | resources :files, :only => [:index, :new, :create] |
|
120 | resources :files, :only => [:index, :new, :create] | |
121 |
|
121 | |||
122 | resources :versions, :except => [:index, :show, :edit, :update, :destroy] do |
|
122 | resources :versions, :except => [:index, :show, :edit, :update, :destroy] do | |
123 | collection do |
|
123 | collection do | |
124 | put 'close_completed' |
|
124 | put 'close_completed' | |
125 | end |
|
125 | end | |
126 | end |
|
126 | end | |
127 | match 'versions.:format', :to => 'versions#index' |
|
127 | match 'versions.:format', :to => 'versions#index' | |
128 | match 'roadmap', :to => 'versions#index', :format => false |
|
128 | match 'roadmap', :to => 'versions#index', :format => false | |
129 | match 'versions', :to => 'versions#index' |
|
129 | match 'versions', :to => 'versions#index' | |
130 |
|
130 | |||
131 | resources :news, :except => [:show, :edit, :update, :destroy] |
|
131 | resources :news, :except => [:show, :edit, :update, :destroy] | |
132 | resources :time_entries, :controller => 'timelog' do |
|
132 | resources :time_entries, :controller => 'timelog' do | |
133 | get 'report', :on => :collection |
|
133 | get 'report', :on => :collection | |
134 | end |
|
134 | end | |
135 | resources :queries, :only => [:new, :create] |
|
135 | resources :queries, :only => [:new, :create] | |
136 | resources :issue_categories, :shallow => true |
|
136 | resources :issue_categories, :shallow => true | |
137 | resources :documents, :except => [:show, :edit, :update, :destroy] |
|
137 | resources :documents, :except => [:show, :edit, :update, :destroy] | |
138 | resources :boards |
|
138 | resources :boards | |
139 | resources :repositories, :shallow => true, :except => [:index, :show] do |
|
139 | resources :repositories, :shallow => true, :except => [:index, :show] do | |
140 | member do |
|
140 | member do | |
141 | match 'committers', :via => [:get, :post] |
|
141 | match 'committers', :via => [:get, :post] | |
142 | end |
|
142 | end | |
143 | end |
|
143 | end | |
144 |
|
144 | |||
145 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get |
|
145 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get | |
146 | match 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' |
|
146 | match 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' | |
147 | match 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff' |
|
147 | match 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff' | |
148 | resources :wiki, :except => [:index, :new, :create] do |
|
148 | resources :wiki, :except => [:index, :new, :create] do | |
149 | member do |
|
149 | member do | |
150 | get 'rename' |
|
150 | get 'rename' | |
151 | post 'rename' |
|
151 | post 'rename' | |
152 | get 'history' |
|
152 | get 'history' | |
153 | get 'diff' |
|
153 | get 'diff' | |
154 | match 'preview', :via => [:post, :put] |
|
154 | match 'preview', :via => [:post, :put] | |
155 | post 'protect' |
|
155 | post 'protect' | |
156 | post 'add_attachment' |
|
156 | post 'add_attachment' | |
157 | end |
|
157 | end | |
158 | collection do |
|
158 | collection do | |
159 | get 'export' |
|
159 | get 'export' | |
160 | get 'date_index' |
|
160 | get 'date_index' | |
161 | end |
|
161 | end | |
162 | end |
|
162 | end | |
163 | match 'wiki', :controller => 'wiki', :action => 'show', :via => :get |
|
163 | match 'wiki', :controller => 'wiki', :action => 'show', :via => :get | |
164 | match 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' |
|
164 | match 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' | |
165 | end |
|
165 | end | |
166 |
|
166 | |||
167 | resources :issues do |
|
167 | resources :issues do | |
168 | collection do |
|
168 | collection do | |
169 | match 'bulk_edit', :via => [:get, :post] |
|
169 | match 'bulk_edit', :via => [:get, :post] | |
170 | post 'bulk_update' |
|
170 | post 'bulk_update' | |
171 | end |
|
171 | end | |
172 | resources :time_entries, :controller => 'timelog' do |
|
172 | resources :time_entries, :controller => 'timelog' do | |
173 | collection do |
|
173 | collection do | |
174 | get 'report' |
|
174 | get 'report' | |
175 | end |
|
175 | end | |
176 | end |
|
176 | end | |
177 | resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] |
|
177 | resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] | |
178 | end |
|
178 | end | |
179 | match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete |
|
179 | match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete | |
180 |
|
180 | |||
181 | resources :queries, :except => [:show] |
|
181 | resources :queries, :except => [:show] | |
182 |
|
182 | |||
183 | resources :news, :only => [:index, :show, :edit, :update, :destroy] |
|
183 | resources :news, :only => [:index, :show, :edit, :update, :destroy] | |
184 | match '/news/:id/comments', :to => 'comments#create', :via => :post |
|
184 | match '/news/:id/comments', :to => 'comments#create', :via => :post | |
185 | match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete |
|
185 | match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete | |
186 |
|
186 | |||
187 | resources :versions, :only => [:show, :edit, :update, :destroy] do |
|
187 | resources :versions, :only => [:show, :edit, :update, :destroy] do | |
188 | post 'status_by', :on => :member |
|
188 | post 'status_by', :on => :member | |
189 | end |
|
189 | end | |
190 |
|
190 | |||
191 | resources :documents, :only => [:show, :edit, :update, :destroy] do |
|
191 | resources :documents, :only => [:show, :edit, :update, :destroy] do | |
192 | post 'add_attachment', :on => :member |
|
192 | post 'add_attachment', :on => :member | |
193 | end |
|
193 | end | |
194 |
|
194 | |||
195 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu |
|
195 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu | |
196 |
|
196 | |||
197 | resources :time_entries, :controller => 'timelog', :except => :destroy do |
|
197 | resources :time_entries, :controller => 'timelog', :except => :destroy do | |
198 | collection do |
|
198 | collection do | |
199 | get 'report' |
|
199 | get 'report' | |
200 | get 'bulk_edit' |
|
200 | get 'bulk_edit' | |
201 | post 'bulk_update' |
|
201 | post 'bulk_update' | |
202 | end |
|
202 | end | |
203 | end |
|
203 | end | |
204 | match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ |
|
204 | match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ | |
205 | # TODO: delete /time_entries for bulk deletion |
|
205 | # TODO: delete /time_entries for bulk deletion | |
206 | match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete |
|
206 | match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete | |
207 |
|
207 | |||
208 | # TODO: port to be part of the resources route(s) |
|
208 | # TODO: port to be part of the resources route(s) | |
209 | match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get |
|
209 | match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get | |
210 |
|
210 | |||
211 | get 'projects/:id/activity', :to => 'activities#index' |
|
211 | get 'projects/:id/activity', :to => 'activities#index' | |
212 | get 'projects/:id/activity.:format', :to => 'activities#index' |
|
212 | get 'projects/:id/activity.:format', :to => 'activities#index' | |
213 | get 'activity', :to => 'activities#index' |
|
213 | get 'activity', :to => 'activities#index' | |
214 |
|
214 | |||
215 | # repositories routes |
|
215 | # repositories routes | |
216 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' |
|
216 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' | |
217 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' |
|
217 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' | |
218 |
|
218 | |||
219 | get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', |
|
219 | get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', | |
220 | :to => 'repositories#changes' |
|
220 | :to => 'repositories#changes' | |
221 |
|
221 | |||
222 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' |
|
222 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' | |
223 | get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' |
|
223 | get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' | |
224 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
224 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' | |
225 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
225 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' | |
226 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' |
|
226 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' | |
227 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', |
|
227 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', | |
228 | :controller => 'repositories', |
|
228 | :controller => 'repositories', | |
229 | :format => false, |
|
229 | :format => false, | |
230 | :constraints => { |
|
230 | :constraints => { | |
231 | :action => /(browse|show|entry|raw|annotate|diff)/, |
|
231 | :action => /(browse|show|entry|raw|annotate|diff)/, | |
232 | :rev => /[a-z0-9\.\-_]+/ |
|
232 | :rev => /[a-z0-9\.\-_]+/ | |
233 | } |
|
233 | } | |
234 |
|
234 | |||
235 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' |
|
235 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' | |
236 | get 'projects/:id/repository/graph', :to => 'repositories#graph' |
|
236 | get 'projects/:id/repository/graph', :to => 'repositories#graph' | |
237 |
|
237 | |||
238 | get 'projects/:id/repository/changes(/*path(.:ext))', |
|
238 | get 'projects/:id/repository/changes(/*path(.:ext))', | |
239 | :to => 'repositories#changes' |
|
239 | :to => 'repositories#changes' | |
240 |
|
240 | |||
241 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' |
|
241 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' | |
242 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' |
|
242 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' | |
243 | get 'projects/:id/repository/revision', :to => 'repositories#revision' |
|
243 | get 'projects/:id/repository/revision', :to => 'repositories#revision' | |
244 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
244 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' | |
245 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
245 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' | |
246 | get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', |
|
246 | get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', | |
247 | :controller => 'repositories', |
|
247 | :controller => 'repositories', | |
248 | :format => false, |
|
248 | :format => false, | |
249 | :constraints => { |
|
249 | :constraints => { | |
250 | :action => /(browse|show|entry|raw|annotate|diff)/, |
|
250 | :action => /(browse|show|entry|raw|annotate|diff)/, | |
251 | :rev => /[a-z0-9\.\-_]+/ |
|
251 | :rev => /[a-z0-9\.\-_]+/ | |
252 | } |
|
252 | } | |
253 | get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', |
|
253 | get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', | |
254 | :controller => 'repositories', |
|
254 | :controller => 'repositories', | |
255 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ |
|
255 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ | |
256 | get 'projects/:id/repository/:action(/*path(.:ext))', |
|
256 | get 'projects/:id/repository/:action(/*path(.:ext))', | |
257 | :controller => 'repositories', |
|
257 | :controller => 'repositories', | |
258 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ |
|
258 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ | |
259 |
|
259 | |||
260 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil |
|
260 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil | |
261 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil |
|
261 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil | |
262 |
|
262 | |||
263 | # additional routes for having the file name at the end of url |
|
263 | # additional routes for having the file name at the end of url | |
264 | match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get |
|
264 | match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get | |
265 | match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get |
|
265 | match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get | |
266 | match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get |
|
266 | match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get | |
267 | match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/ |
|
267 | match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/ | |
268 | resources :attachments, :only => [:show, :destroy] |
|
268 | resources :attachments, :only => [:show, :destroy] | |
269 |
|
269 | |||
270 | resources :groups do |
|
270 | resources :groups do | |
271 | member do |
|
271 | member do | |
272 | get 'autocomplete_for_user' |
|
272 | get 'autocomplete_for_user' | |
273 | end |
|
273 | end | |
274 | end |
|
274 | end | |
275 |
|
275 | |||
276 | match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' |
|
276 | match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' | |
277 | match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' |
|
277 | match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' | |
278 | match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post |
|
278 | match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post | |
279 | match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post |
|
279 | match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post | |
280 |
|
280 | |||
281 | resources :trackers, :except => :show |
|
281 | resources :trackers, :except => :show do | |
|
282 | collection do | |||
|
283 | match 'fields', :via => [:get, :post] | |||
|
284 | end | |||
|
285 | end | |||
282 | resources :issue_statuses, :except => :show do |
|
286 | resources :issue_statuses, :except => :show do | |
283 | collection do |
|
287 | collection do | |
284 | post 'update_issue_done_ratio' |
|
288 | post 'update_issue_done_ratio' | |
285 | end |
|
289 | end | |
286 | end |
|
290 | end | |
287 | resources :custom_fields, :except => :show |
|
291 | resources :custom_fields, :except => :show | |
288 | resources :roles, :except => :show do |
|
292 | resources :roles, :except => :show do | |
289 | collection do |
|
293 | collection do | |
290 | match 'permissions', :via => [:get, :post] |
|
294 | match 'permissions', :via => [:get, :post] | |
291 | end |
|
295 | end | |
292 | end |
|
296 | end | |
293 | resources :enumerations, :except => :show |
|
297 | resources :enumerations, :except => :show | |
294 |
|
298 | |||
295 | get 'projects/:id/search', :controller => 'search', :action => 'index' |
|
299 | get 'projects/:id/search', :controller => 'search', :action => 'index' | |
296 | get 'search', :controller => 'search', :action => 'index' |
|
300 | get 'search', :controller => 'search', :action => 'index' | |
297 |
|
301 | |||
298 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post |
|
302 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post | |
299 |
|
303 | |||
300 | match 'admin', :controller => 'admin', :action => 'index', :via => :get |
|
304 | match 'admin', :controller => 'admin', :action => 'index', :via => :get | |
301 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get |
|
305 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get | |
302 | match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get |
|
306 | match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get | |
303 | match 'admin/info', :controller => 'admin', :action => 'info', :via => :get |
|
307 | match 'admin/info', :controller => 'admin', :action => 'info', :via => :get | |
304 | match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get |
|
308 | match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get | |
305 | match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post |
|
309 | match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post | |
306 |
|
310 | |||
307 | resources :auth_sources do |
|
311 | resources :auth_sources do | |
308 | member do |
|
312 | member do | |
309 | get 'test_connection' |
|
313 | get 'test_connection' | |
310 | end |
|
314 | end | |
311 | end |
|
315 | end | |
312 |
|
316 | |||
313 | match 'workflows', :controller => 'workflows', :action => 'index', :via => :get |
|
317 | match 'workflows', :controller => 'workflows', :action => 'index', :via => :get | |
314 | match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] |
|
318 | match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] | |
315 | match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post] |
|
319 | match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post] | |
316 | match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] |
|
320 | match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] | |
317 | match 'settings', :controller => 'settings', :action => 'index', :via => :get |
|
321 | match 'settings', :controller => 'settings', :action => 'index', :via => :get | |
318 | match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] |
|
322 | match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] | |
319 | match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post] |
|
323 | match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post] | |
320 |
|
324 | |||
321 | match 'sys/projects', :to => 'sys#projects', :via => :get |
|
325 | match 'sys/projects', :to => 'sys#projects', :via => :get | |
322 | match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post |
|
326 | match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post | |
323 | match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get |
|
327 | match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get | |
324 |
|
328 | |||
325 | match 'uploads', :to => 'attachments#upload', :via => :post |
|
329 | match 'uploads', :to => 'attachments#upload', :via => :post | |
326 |
|
330 | |||
327 | get 'robots.txt', :to => 'welcome#robots' |
|
331 | get 'robots.txt', :to => 'welcome#robots' | |
328 |
|
332 | |||
329 | Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| |
|
333 | Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| | |
330 | file = File.join(plugin_dir, "config/routes.rb") |
|
334 | file = File.join(plugin_dir, "config/routes.rb") | |
331 | if File.exists?(file) |
|
335 | if File.exists?(file) | |
332 | begin |
|
336 | begin | |
333 | instance_eval File.read(file) |
|
337 | instance_eval File.read(file) | |
334 | rescue Exception => e |
|
338 | rescue Exception => e | |
335 | puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." |
|
339 | puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." | |
336 | exit 1 |
|
340 | exit 1 | |
337 | end |
|
341 | end | |
338 | end |
|
342 | end | |
339 | end |
|
343 | end | |
340 | end |
|
344 | end |
@@ -1,188 +1,218 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../test_helper', __FILE__) | |
19 | require 'trackers_controller' |
|
19 | require 'trackers_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class TrackersController; def rescue_action(e) raise e end; end |
|
22 | class TrackersController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class TrackersControllerTest < ActionController::TestCase |
|
24 | class TrackersControllerTest < ActionController::TestCase | |
25 | fixtures :trackers, :projects, :projects_trackers, :users, :issues, :custom_fields |
|
25 | fixtures :trackers, :projects, :projects_trackers, :users, :issues, :custom_fields | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = TrackersController.new |
|
28 | @controller = TrackersController.new | |
29 | @request = ActionController::TestRequest.new |
|
29 | @request = ActionController::TestRequest.new | |
30 | @response = ActionController::TestResponse.new |
|
30 | @response = ActionController::TestResponse.new | |
31 | User.current = nil |
|
31 | User.current = nil | |
32 | @request.session[:user_id] = 1 # admin |
|
32 | @request.session[:user_id] = 1 # admin | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | def test_index |
|
35 | def test_index | |
36 | get :index |
|
36 | get :index | |
37 | assert_response :success |
|
37 | assert_response :success | |
38 | assert_template 'index' |
|
38 | assert_template 'index' | |
39 | end |
|
39 | end | |
40 |
|
40 | |||
41 | def test_index_by_anonymous_should_redirect_to_login_form |
|
41 | def test_index_by_anonymous_should_redirect_to_login_form | |
42 | @request.session[:user_id] = nil |
|
42 | @request.session[:user_id] = nil | |
43 | get :index |
|
43 | get :index | |
44 | assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftrackers' |
|
44 | assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftrackers' | |
45 | end |
|
45 | end | |
46 |
|
46 | |||
47 | def test_index_by_user_should_respond_with_406 |
|
47 | def test_index_by_user_should_respond_with_406 | |
48 | @request.session[:user_id] = 2 |
|
48 | @request.session[:user_id] = 2 | |
49 | get :index |
|
49 | get :index | |
50 | assert_response 406 |
|
50 | assert_response 406 | |
51 | end |
|
51 | end | |
52 |
|
52 | |||
53 | def test_new |
|
53 | def test_new | |
54 | get :new |
|
54 | get :new | |
55 | assert_response :success |
|
55 | assert_response :success | |
56 | assert_template 'new' |
|
56 | assert_template 'new' | |
57 | end |
|
57 | end | |
58 |
|
58 | |||
59 | def test_create |
|
59 | def test_create | |
60 | assert_difference 'Tracker.count' do |
|
60 | assert_difference 'Tracker.count' do | |
61 | post :create, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] } |
|
61 | post :create, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] } | |
62 | end |
|
62 | end | |
63 | assert_redirected_to :action => 'index' |
|
63 | assert_redirected_to :action => 'index' | |
64 | tracker = Tracker.first(:order => 'id DESC') |
|
64 | tracker = Tracker.first(:order => 'id DESC') | |
65 | assert_equal 'New tracker', tracker.name |
|
65 | assert_equal 'New tracker', tracker.name | |
66 | assert_equal [1], tracker.project_ids.sort |
|
66 | assert_equal [1], tracker.project_ids.sort | |
67 | assert_equal Tracker::CORE_FIELDS, tracker.core_fields |
|
67 | assert_equal Tracker::CORE_FIELDS, tracker.core_fields | |
68 | assert_equal [1, 6], tracker.custom_field_ids.sort |
|
68 | assert_equal [1, 6], tracker.custom_field_ids.sort | |
69 | assert_equal 0, tracker.workflow_rules.count |
|
69 | assert_equal 0, tracker.workflow_rules.count | |
70 | end |
|
70 | end | |
71 |
|
71 | |||
72 | def create_with_disabled_core_fields |
|
72 | def create_with_disabled_core_fields | |
73 | assert_difference 'Tracker.count' do |
|
73 | assert_difference 'Tracker.count' do | |
74 | post :create, :tracker => { :name => 'New tracker', :core_fields => ['assigned_to_id', 'fixed_version_id', ''] } |
|
74 | post :create, :tracker => { :name => 'New tracker', :core_fields => ['assigned_to_id', 'fixed_version_id', ''] } | |
75 | end |
|
75 | end | |
76 | assert_redirected_to :action => 'index' |
|
76 | assert_redirected_to :action => 'index' | |
77 | tracker = Tracker.first(:order => 'id DESC') |
|
77 | tracker = Tracker.first(:order => 'id DESC') | |
78 | assert_equal 'New tracker', tracker.name |
|
78 | assert_equal 'New tracker', tracker.name | |
79 | assert_equal %w(assigned_to_id fixed_version_id), tracker.core_fields |
|
79 | assert_equal %w(assigned_to_id fixed_version_id), tracker.core_fields | |
80 | end |
|
80 | end | |
81 |
|
81 | |||
82 | def test_create_new_with_workflow_copy |
|
82 | def test_create_new_with_workflow_copy | |
83 | assert_difference 'Tracker.count' do |
|
83 | assert_difference 'Tracker.count' do | |
84 | post :create, :tracker => { :name => 'New tracker' }, :copy_workflow_from => 1 |
|
84 | post :create, :tracker => { :name => 'New tracker' }, :copy_workflow_from => 1 | |
85 | end |
|
85 | end | |
86 | assert_redirected_to :action => 'index' |
|
86 | assert_redirected_to :action => 'index' | |
87 | tracker = Tracker.find_by_name('New tracker') |
|
87 | tracker = Tracker.find_by_name('New tracker') | |
88 | assert_equal 0, tracker.projects.count |
|
88 | assert_equal 0, tracker.projects.count | |
89 | assert_equal Tracker.find(1).workflow_rules.count, tracker.workflow_rules.count |
|
89 | assert_equal Tracker.find(1).workflow_rules.count, tracker.workflow_rules.count | |
90 | end |
|
90 | end | |
91 |
|
91 | |||
92 | def test_create_with_failure |
|
92 | def test_create_with_failure | |
93 | assert_no_difference 'Tracker.count' do |
|
93 | assert_no_difference 'Tracker.count' do | |
94 | post :create, :tracker => { :name => '', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] } |
|
94 | post :create, :tracker => { :name => '', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] } | |
95 | end |
|
95 | end | |
96 | assert_response :success |
|
96 | assert_response :success | |
97 | assert_template 'new' |
|
97 | assert_template 'new' | |
98 | assert_error_tag :content => /name can't be blank/i |
|
98 | assert_error_tag :content => /name can't be blank/i | |
99 | end |
|
99 | end | |
100 |
|
100 | |||
101 | def test_edit |
|
101 | def test_edit | |
102 | Tracker.find(1).project_ids = [1, 3] |
|
102 | Tracker.find(1).project_ids = [1, 3] | |
103 |
|
103 | |||
104 | get :edit, :id => 1 |
|
104 | get :edit, :id => 1 | |
105 | assert_response :success |
|
105 | assert_response :success | |
106 | assert_template 'edit' |
|
106 | assert_template 'edit' | |
107 |
|
107 | |||
108 | assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', |
|
108 | assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', | |
109 | :value => '1', |
|
109 | :value => '1', | |
110 | :checked => 'checked' } |
|
110 | :checked => 'checked' } | |
111 |
|
111 | |||
112 | assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', |
|
112 | assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', | |
113 | :value => '2', |
|
113 | :value => '2', | |
114 | :checked => nil } |
|
114 | :checked => nil } | |
115 |
|
115 | |||
116 | assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', |
|
116 | assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', | |
117 | :value => '', |
|
117 | :value => '', | |
118 | :type => 'hidden'} |
|
118 | :type => 'hidden'} | |
119 | end |
|
119 | end | |
120 |
|
120 | |||
121 | def test_edit_should_check_core_fields |
|
121 | def test_edit_should_check_core_fields | |
122 | tracker = Tracker.find(1) |
|
122 | tracker = Tracker.find(1) | |
123 | tracker.core_fields = %w(assigned_to_id fixed_version_id) |
|
123 | tracker.core_fields = %w(assigned_to_id fixed_version_id) | |
124 | tracker.save! |
|
124 | tracker.save! | |
125 |
|
125 | |||
126 | get :edit, :id => 1 |
|
126 | get :edit, :id => 1 | |
127 | assert_response :success |
|
127 | assert_response :success | |
128 | assert_template 'edit' |
|
128 | assert_template 'edit' | |
129 |
|
129 | |||
130 | assert_select 'input[name=?][value=assigned_to_id][checked=checked]', 'tracker[core_fields][]' |
|
130 | assert_select 'input[name=?][value=assigned_to_id][checked=checked]', 'tracker[core_fields][]' | |
131 | assert_select 'input[name=?][value=fixed_version_id][checked=checked]', 'tracker[core_fields][]' |
|
131 | assert_select 'input[name=?][value=fixed_version_id][checked=checked]', 'tracker[core_fields][]' | |
132 |
|
132 | |||
133 | assert_select 'input[name=?][value=category_id]', 'tracker[core_fields][]' |
|
133 | assert_select 'input[name=?][value=category_id]', 'tracker[core_fields][]' | |
134 | assert_select 'input[name=?][value=category_id][checked=checked]', 'tracker[core_fields][]', 0 |
|
134 | assert_select 'input[name=?][value=category_id][checked=checked]', 'tracker[core_fields][]', 0 | |
135 |
|
135 | |||
136 | assert_select 'input[name=?][value=][type=hidden]', 'tracker[core_fields][]' |
|
136 | assert_select 'input[name=?][value=][type=hidden]', 'tracker[core_fields][]' | |
137 | end |
|
137 | end | |
138 |
|
138 | |||
139 | def test_update |
|
139 | def test_update | |
140 | put :update, :id => 1, :tracker => { :name => 'Renamed', |
|
140 | put :update, :id => 1, :tracker => { :name => 'Renamed', | |
141 | :project_ids => ['1', '2', ''] } |
|
141 | :project_ids => ['1', '2', ''] } | |
142 | assert_redirected_to :action => 'index' |
|
142 | assert_redirected_to :action => 'index' | |
143 | assert_equal [1, 2], Tracker.find(1).project_ids.sort |
|
143 | assert_equal [1, 2], Tracker.find(1).project_ids.sort | |
144 | end |
|
144 | end | |
145 |
|
145 | |||
146 | def test_update_without_projects |
|
146 | def test_update_without_projects | |
147 | put :update, :id => 1, :tracker => { :name => 'Renamed', |
|
147 | put :update, :id => 1, :tracker => { :name => 'Renamed', | |
148 | :project_ids => [''] } |
|
148 | :project_ids => [''] } | |
149 | assert_redirected_to :action => 'index' |
|
149 | assert_redirected_to :action => 'index' | |
150 | assert Tracker.find(1).project_ids.empty? |
|
150 | assert Tracker.find(1).project_ids.empty? | |
151 | end |
|
151 | end | |
152 |
|
152 | |||
153 | def test_update_without_core_fields |
|
153 | def test_update_without_core_fields | |
154 | put :update, :id => 1, :tracker => { :name => 'Renamed', :core_fields => [''] } |
|
154 | put :update, :id => 1, :tracker => { :name => 'Renamed', :core_fields => [''] } | |
155 | assert_redirected_to :action => 'index' |
|
155 | assert_redirected_to :action => 'index' | |
156 | assert Tracker.find(1).core_fields.empty? |
|
156 | assert Tracker.find(1).core_fields.empty? | |
157 | end |
|
157 | end | |
158 |
|
158 | |||
159 | def test_update_with_failure |
|
159 | def test_update_with_failure | |
160 | put :update, :id => 1, :tracker => { :name => '' } |
|
160 | put :update, :id => 1, :tracker => { :name => '' } | |
161 | assert_response :success |
|
161 | assert_response :success | |
162 | assert_template 'edit' |
|
162 | assert_template 'edit' | |
163 | assert_error_tag :content => /name can't be blank/i |
|
163 | assert_error_tag :content => /name can't be blank/i | |
164 | end |
|
164 | end | |
165 |
|
165 | |||
166 | def test_move_lower |
|
166 | def test_move_lower | |
167 | tracker = Tracker.find_by_position(1) |
|
167 | tracker = Tracker.find_by_position(1) | |
168 | put :update, :id => 1, :tracker => { :move_to => 'lower' } |
|
168 | put :update, :id => 1, :tracker => { :move_to => 'lower' } | |
169 | assert_equal 2, tracker.reload.position |
|
169 | assert_equal 2, tracker.reload.position | |
170 | end |
|
170 | end | |
171 |
|
171 | |||
172 | def test_destroy |
|
172 | def test_destroy | |
173 | tracker = Tracker.create!(:name => 'Destroyable') |
|
173 | tracker = Tracker.create!(:name => 'Destroyable') | |
174 | assert_difference 'Tracker.count', -1 do |
|
174 | assert_difference 'Tracker.count', -1 do | |
175 | delete :destroy, :id => tracker.id |
|
175 | delete :destroy, :id => tracker.id | |
176 | end |
|
176 | end | |
177 | assert_redirected_to :action => 'index' |
|
177 | assert_redirected_to :action => 'index' | |
178 | assert_nil flash[:error] |
|
178 | assert_nil flash[:error] | |
179 | end |
|
179 | end | |
180 |
|
180 | |||
181 | def test_destroy_tracker_in_use |
|
181 | def test_destroy_tracker_in_use | |
182 | assert_no_difference 'Tracker.count' do |
|
182 | assert_no_difference 'Tracker.count' do | |
183 | delete :destroy, :id => 1 |
|
183 | delete :destroy, :id => 1 | |
184 | end |
|
184 | end | |
185 | assert_redirected_to :action => 'index' |
|
185 | assert_redirected_to :action => 'index' | |
186 | assert_not_nil flash[:error] |
|
186 | assert_not_nil flash[:error] | |
187 | end |
|
187 | end | |
|
188 | ||||
|
189 | def test_get_fields | |||
|
190 | get :fields | |||
|
191 | assert_response :success | |||
|
192 | assert_template 'fields' | |||
|
193 | ||||
|
194 | assert_select 'form' do | |||
|
195 | assert_select 'input[type=checkbox][name=?][value=assigned_to_id]', 'trackers[1][core_fields][]' | |||
|
196 | assert_select 'input[type=checkbox][name=?][value=2]', 'trackers[1][custom_field_ids][]' | |||
|
197 | ||||
|
198 | assert_select 'input[type=hidden][name=?][value=]', 'trackers[1][core_fields][]' | |||
|
199 | assert_select 'input[type=hidden][name=?][value=]', 'trackers[1][custom_field_ids][]' | |||
|
200 | end | |||
|
201 | end | |||
|
202 | ||||
|
203 | def test_post_fields | |||
|
204 | post :fields, :trackers => { | |||
|
205 | '1' => {'core_fields' => ['assigned_to_id', 'due_date', ''], 'custom_field_ids' => ['1', '2']}, | |||
|
206 | '2' => {'core_fields' => [''], 'custom_field_ids' => ['']} | |||
|
207 | } | |||
|
208 | assert_redirected_to '/trackers/fields' | |||
|
209 | ||||
|
210 | tracker = Tracker.find(1) | |||
|
211 | assert_equal %w(assigned_to_id due_date), tracker.core_fields | |||
|
212 | assert_equal [1, 2], tracker.custom_field_ids.sort | |||
|
213 | ||||
|
214 | tracker = Tracker.find(2) | |||
|
215 | assert_equal [], tracker.core_fields | |||
|
216 | assert_equal [], tracker.custom_field_ids.sort | |||
|
217 | end | |||
188 | end |
|
218 | end |
@@ -1,71 +1,79 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |
19 |
|
19 | |||
20 | class RoutingTrackersTest < ActionController::IntegrationTest |
|
20 | class RoutingTrackersTest < ActionController::IntegrationTest | |
21 | def test_trackers |
|
21 | def test_trackers | |
22 | assert_routing( |
|
22 | assert_routing( | |
23 | { :method => 'get', :path => "/trackers" }, |
|
23 | { :method => 'get', :path => "/trackers" }, | |
24 | { :controller => 'trackers', :action => 'index' } |
|
24 | { :controller => 'trackers', :action => 'index' } | |
25 | ) |
|
25 | ) | |
26 | assert_routing( |
|
26 | assert_routing( | |
27 | { :method => 'get', :path => "/trackers.xml" }, |
|
27 | { :method => 'get', :path => "/trackers.xml" }, | |
28 | { :controller => 'trackers', :action => 'index', :format => 'xml' } |
|
28 | { :controller => 'trackers', :action => 'index', :format => 'xml' } | |
29 | ) |
|
29 | ) | |
30 | assert_routing( |
|
30 | assert_routing( | |
31 | { :method => 'post', :path => "/trackers" }, |
|
31 | { :method => 'post', :path => "/trackers" }, | |
32 | { :controller => 'trackers', :action => 'create' } |
|
32 | { :controller => 'trackers', :action => 'create' } | |
33 | ) |
|
33 | ) | |
34 | assert_routing( |
|
34 | assert_routing( | |
35 | { :method => 'post', :path => "/trackers.xml" }, |
|
35 | { :method => 'post', :path => "/trackers.xml" }, | |
36 | { :controller => 'trackers', :action => 'create', :format => 'xml' } |
|
36 | { :controller => 'trackers', :action => 'create', :format => 'xml' } | |
37 | ) |
|
37 | ) | |
38 | assert_routing( |
|
38 | assert_routing( | |
39 | { :method => 'get', :path => "/trackers/new" }, |
|
39 | { :method => 'get', :path => "/trackers/new" }, | |
40 | { :controller => 'trackers', :action => 'new' } |
|
40 | { :controller => 'trackers', :action => 'new' } | |
41 | ) |
|
41 | ) | |
42 | assert_routing( |
|
42 | assert_routing( | |
43 | { :method => 'get', :path => "/trackers/new.xml" }, |
|
43 | { :method => 'get', :path => "/trackers/new.xml" }, | |
44 | { :controller => 'trackers', :action => 'new', :format => 'xml' } |
|
44 | { :controller => 'trackers', :action => 'new', :format => 'xml' } | |
45 | ) |
|
45 | ) | |
46 | assert_routing( |
|
46 | assert_routing( | |
47 | { :method => 'get', :path => "/trackers/1/edit" }, |
|
47 | { :method => 'get', :path => "/trackers/1/edit" }, | |
48 | { :controller => 'trackers', :action => 'edit', :id => '1' } |
|
48 | { :controller => 'trackers', :action => 'edit', :id => '1' } | |
49 | ) |
|
49 | ) | |
50 | assert_routing( |
|
50 | assert_routing( | |
51 | { :method => 'put', :path => "/trackers/1" }, |
|
51 | { :method => 'put', :path => "/trackers/1" }, | |
52 | { :controller => 'trackers', :action => 'update', |
|
52 | { :controller => 'trackers', :action => 'update', | |
53 | :id => '1' } |
|
53 | :id => '1' } | |
54 | ) |
|
54 | ) | |
55 | assert_routing( |
|
55 | assert_routing( | |
56 | { :method => 'put', :path => "/trackers/1.xml" }, |
|
56 | { :method => 'put', :path => "/trackers/1.xml" }, | |
57 | { :controller => 'trackers', :action => 'update', |
|
57 | { :controller => 'trackers', :action => 'update', | |
58 | :format => 'xml', :id => '1' } |
|
58 | :format => 'xml', :id => '1' } | |
59 | ) |
|
59 | ) | |
60 | assert_routing( |
|
60 | assert_routing( | |
61 | { :method => 'delete', :path => "/trackers/1" }, |
|
61 | { :method => 'delete', :path => "/trackers/1" }, | |
62 | { :controller => 'trackers', :action => 'destroy', |
|
62 | { :controller => 'trackers', :action => 'destroy', | |
63 | :id => '1' } |
|
63 | :id => '1' } | |
64 | ) |
|
64 | ) | |
65 | assert_routing( |
|
65 | assert_routing( | |
66 | { :method => 'delete', :path => "/trackers/1.xml" }, |
|
66 | { :method => 'delete', :path => "/trackers/1.xml" }, | |
67 | { :controller => 'trackers', :action => 'destroy', |
|
67 | { :controller => 'trackers', :action => 'destroy', | |
68 | :format => 'xml', :id => '1' } |
|
68 | :format => 'xml', :id => '1' } | |
69 | ) |
|
69 | ) | |
|
70 | assert_routing( | |||
|
71 | { :method => 'get', :path => "/trackers/fields" }, | |||
|
72 | { :controller => 'trackers', :action => 'fields' } | |||
|
73 | ) | |||
|
74 | assert_routing( | |||
|
75 | { :method => 'post', :path => "/trackers/fields" }, | |||
|
76 | { :controller => 'trackers', :action => 'fields' } | |||
|
77 | ) | |||
70 | end |
|
78 | end | |
71 | end |
|
79 | end |
General Comments 0
You need to be logged in to leave comments.
Login now