@@ -1,144 +1,155 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class VersionsController < ApplicationController |
|
18 | class VersionsController < ApplicationController | |
19 | menu_item :roadmap |
|
19 | menu_item :roadmap | |
20 | model_object Version |
|
20 | model_object Version | |
21 | before_filter :find_model_object, :except => [:index, :new, :close_completed] |
|
21 | before_filter :find_model_object, :except => [:index, :new, :create, :close_completed] | |
22 | before_filter :find_project_from_association, :except => [:index, :new, :close_completed] |
|
22 | before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed] | |
23 | before_filter :find_project, :only => [:index, :new, :close_completed] |
|
23 | before_filter :find_project, :only => [:index, :new, :create, :close_completed] | |
24 | before_filter :authorize |
|
24 | before_filter :authorize | |
25 |
|
25 | |||
26 | helper :custom_fields |
|
26 | helper :custom_fields | |
27 | helper :projects |
|
27 | helper :projects | |
28 |
|
28 | |||
29 | def index |
|
29 | def index | |
30 | @trackers = @project.trackers.find(:all, :order => 'position') |
|
30 | @trackers = @project.trackers.find(:all, :order => 'position') | |
31 | retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?}) |
|
31 | retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?}) | |
32 | @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') |
|
32 | @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') | |
33 | project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id] |
|
33 | project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id] | |
34 |
|
34 | |||
35 | @versions = @project.shared_versions || [] |
|
35 | @versions = @project.shared_versions || [] | |
36 | @versions += @project.rolled_up_versions.visible if @with_subprojects |
|
36 | @versions += @project.rolled_up_versions.visible if @with_subprojects | |
37 | @versions = @versions.uniq.sort |
|
37 | @versions = @versions.uniq.sort | |
38 | @versions.reject! {|version| version.closed? || version.completed? } unless params[:completed] |
|
38 | @versions.reject! {|version| version.closed? || version.completed? } unless params[:completed] | |
39 |
|
39 | |||
40 | @issues_by_version = {} |
|
40 | @issues_by_version = {} | |
41 | unless @selected_tracker_ids.empty? |
|
41 | unless @selected_tracker_ids.empty? | |
42 | @versions.each do |version| |
|
42 | @versions.each do |version| | |
43 | issues = version.fixed_issues.visible.find(:all, |
|
43 | issues = version.fixed_issues.visible.find(:all, | |
44 | :include => [:project, :status, :tracker, :priority], |
|
44 | :include => [:project, :status, :tracker, :priority], | |
45 | :conditions => {:tracker_id => @selected_tracker_ids, :project_id => project_ids}, |
|
45 | :conditions => {:tracker_id => @selected_tracker_ids, :project_id => project_ids}, | |
46 | :order => "#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id") |
|
46 | :order => "#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id") | |
47 | @issues_by_version[version] = issues |
|
47 | @issues_by_version[version] = issues | |
48 | end |
|
48 | end | |
49 | end |
|
49 | end | |
50 | @versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].blank?} |
|
50 | @versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].blank?} | |
51 | end |
|
51 | end | |
52 |
|
52 | |||
53 | def show |
|
53 | def show | |
54 | @issues = @version.fixed_issues.visible.find(:all, |
|
54 | @issues = @version.fixed_issues.visible.find(:all, | |
55 | :include => [:status, :tracker, :priority], |
|
55 | :include => [:status, :tracker, :priority], | |
56 | :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") |
|
56 | :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") | |
57 | end |
|
57 | end | |
58 |
|
58 | |||
59 | def new |
|
59 | def new | |
60 | @version = @project.versions.build |
|
60 | @version = @project.versions.build | |
61 | if params[:version] |
|
61 | if params[:version] | |
62 | attributes = params[:version].dup |
|
62 | attributes = params[:version].dup | |
63 | attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing']) |
|
63 | attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing']) | |
64 | @version.attributes = attributes |
|
64 | @version.attributes = attributes | |
65 | end |
|
65 | end | |
|
66 | end | |||
|
67 | ||||
|
68 | def create | |||
|
69 | # TODO: refactor with code above in #new | |||
|
70 | @version = @project.versions.build | |||
|
71 | if params[:version] | |||
|
72 | attributes = params[:version].dup | |||
|
73 | attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing']) | |||
|
74 | @version.attributes = attributes | |||
|
75 | end | |||
|
76 | ||||
66 | if request.post? |
|
77 | if request.post? | |
67 | if @version.save |
|
78 | if @version.save | |
68 | respond_to do |format| |
|
79 | respond_to do |format| | |
69 | format.html do |
|
80 | format.html do | |
70 | flash[:notice] = l(:notice_successful_create) |
|
81 | flash[:notice] = l(:notice_successful_create) | |
71 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project |
|
82 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project | |
72 | end |
|
83 | end | |
73 | format.js do |
|
84 | format.js do | |
74 | # IE doesn't support the replace_html rjs method for select box options |
|
85 | # IE doesn't support the replace_html rjs method for select box options | |
75 | render(:update) {|page| page.replace "issue_fixed_version_id", |
|
86 | render(:update) {|page| page.replace "issue_fixed_version_id", | |
76 | content_tag('select', '<option></option>' + version_options_for_select(@project.shared_versions.open, @version), :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]') |
|
87 | content_tag('select', '<option></option>' + version_options_for_select(@project.shared_versions.open, @version), :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]') | |
77 | } |
|
88 | } | |
78 | end |
|
89 | end | |
79 | end |
|
90 | end | |
80 | else |
|
91 | else | |
81 | respond_to do |format| |
|
92 | respond_to do |format| | |
82 | format.html |
|
93 | format.html { render :action => 'new' } | |
83 | format.js do |
|
94 | format.js do | |
84 | render(:update) {|page| page.alert(@version.errors.full_messages.join('\n')) } |
|
95 | render(:update) {|page| page.alert(@version.errors.full_messages.join('\n')) } | |
85 | end |
|
96 | end | |
86 | end |
|
97 | end | |
87 | end |
|
98 | end | |
88 | end |
|
99 | end | |
89 | end |
|
100 | end | |
90 |
|
101 | |||
91 | def edit |
|
102 | def edit | |
92 | end |
|
103 | end | |
93 |
|
104 | |||
94 | def update |
|
105 | def update | |
95 | if request.post? && params[:version] |
|
106 | if request.post? && params[:version] | |
96 | attributes = params[:version].dup |
|
107 | attributes = params[:version].dup | |
97 | attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing']) |
|
108 | attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing']) | |
98 | if @version.update_attributes(attributes) |
|
109 | if @version.update_attributes(attributes) | |
99 | flash[:notice] = l(:notice_successful_update) |
|
110 | flash[:notice] = l(:notice_successful_update) | |
100 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project |
|
111 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project | |
101 | end |
|
112 | end | |
102 | end |
|
113 | end | |
103 | end |
|
114 | end | |
104 |
|
115 | |||
105 | def close_completed |
|
116 | def close_completed | |
106 | if request.post? |
|
117 | if request.post? | |
107 | @project.close_completed_versions |
|
118 | @project.close_completed_versions | |
108 | end |
|
119 | end | |
109 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project |
|
120 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project | |
110 | end |
|
121 | end | |
111 |
|
122 | |||
112 | def destroy |
|
123 | def destroy | |
113 | if @version.fixed_issues.empty? |
|
124 | if @version.fixed_issues.empty? | |
114 | @version.destroy |
|
125 | @version.destroy | |
115 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project |
|
126 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project | |
116 | else |
|
127 | else | |
117 | flash[:error] = l(:notice_unable_delete_version) |
|
128 | flash[:error] = l(:notice_unable_delete_version) | |
118 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project |
|
129 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project | |
119 | end |
|
130 | end | |
120 | end |
|
131 | end | |
121 |
|
132 | |||
122 | def status_by |
|
133 | def status_by | |
123 | respond_to do |format| |
|
134 | respond_to do |format| | |
124 | format.html { render :action => 'show' } |
|
135 | format.html { render :action => 'show' } | |
125 | format.js { render(:update) {|page| page.replace_html 'status_by', render_issue_status_by(@version, params[:status_by])} } |
|
136 | format.js { render(:update) {|page| page.replace_html 'status_by', render_issue_status_by(@version, params[:status_by])} } | |
126 | end |
|
137 | end | |
127 | end |
|
138 | end | |
128 |
|
139 | |||
129 | private |
|
140 | private | |
130 | def find_project |
|
141 | def find_project | |
131 | @project = Project.find(params[:project_id]) |
|
142 | @project = Project.find(params[:project_id]) | |
132 | rescue ActiveRecord::RecordNotFound |
|
143 | rescue ActiveRecord::RecordNotFound | |
133 | render_404 |
|
144 | render_404 | |
134 | end |
|
145 | end | |
135 |
|
146 | |||
136 | def retrieve_selected_tracker_ids(selectable_trackers, default_trackers=nil) |
|
147 | def retrieve_selected_tracker_ids(selectable_trackers, default_trackers=nil) | |
137 | if ids = params[:tracker_ids] |
|
148 | if ids = params[:tracker_ids] | |
138 | @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } |
|
149 | @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } | |
139 | else |
|
150 | else | |
140 | @selected_tracker_ids = (default_trackers || selectable_trackers).collect {|t| t.id.to_s } |
|
151 | @selected_tracker_ids = (default_trackers || selectable_trackers).collect {|t| t.id.to_s } | |
141 | end |
|
152 | end | |
142 | end |
|
153 | end | |
143 |
|
154 | |||
144 | end |
|
155 | end |
@@ -1,45 +1,45 | |||||
1 | <% fields_for :issue, @issue, :builder => TabularFormBuilder do |f| %> |
|
1 | <% fields_for :issue, @issue, :builder => TabularFormBuilder do |f| %> | |
2 |
|
2 | |||
3 | <div class="splitcontentleft"> |
|
3 | <div class="splitcontentleft"> | |
4 | <% if @issue.new_record? || @allowed_statuses.any? %> |
|
4 | <% if @issue.new_record? || @allowed_statuses.any? %> | |
5 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> |
|
5 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> | |
6 | <% else %> |
|
6 | <% else %> | |
7 | <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p> |
|
7 | <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p> | |
8 | <% end %> |
|
8 | <% end %> | |
9 |
|
9 | |||
10 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p> |
|
10 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p> | |
11 | <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p> |
|
11 | <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p> | |
12 | <% unless @project.issue_categories.empty? %> |
|
12 | <% unless @project.issue_categories.empty? %> | |
13 | <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> |
|
13 | <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> | |
14 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), |
|
14 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), | |
15 | l(:label_issue_category_new), |
|
15 | l(:label_issue_category_new), | |
16 | 'category[name]', |
|
16 | 'category[name]', | |
17 | {:controller => 'issue_categories', :action => 'new', :project_id => @project}, |
|
17 | {:controller => 'issue_categories', :action => 'new', :project_id => @project}, | |
18 | :title => l(:label_issue_category_new), |
|
18 | :title => l(:label_issue_category_new), | |
19 | :tabindex => 199) if authorize_for('issue_categories', 'new') %></p> |
|
19 | :tabindex => 199) if authorize_for('issue_categories', 'new') %></p> | |
20 | <% end %> |
|
20 | <% end %> | |
21 | <% unless @issue.assignable_versions.empty? %> |
|
21 | <% unless @issue.assignable_versions.empty? %> | |
22 | <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %> |
|
22 | <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %> | |
23 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), |
|
23 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), | |
24 | l(:label_version_new), |
|
24 | l(:label_version_new), | |
25 | 'version[name]', |
|
25 | 'version[name]', | |
26 |
{:controller => 'versions', :action => ' |
|
26 | {:controller => 'versions', :action => 'create', :project_id => @project}, | |
27 | :title => l(:label_version_new), |
|
27 | :title => l(:label_version_new), | |
28 | :tabindex => 200) if authorize_for('versions', 'new') %> |
|
28 | :tabindex => 200) if authorize_for('versions', 'new') %> | |
29 | </p> |
|
29 | </p> | |
30 | <% end %> |
|
30 | <% end %> | |
31 | </div> |
|
31 | </div> | |
32 |
|
32 | |||
33 | <div class="splitcontentright"> |
|
33 | <div class="splitcontentright"> | |
34 | <p><%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_start_date') if @issue.leaf? %></p> |
|
34 | <p><%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_start_date') if @issue.leaf? %></p> | |
35 | <p><%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_due_date') if @issue.leaf? %></p> |
|
35 | <p><%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_due_date') if @issue.leaf? %></p> | |
36 | <p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf? %> <%= l(:field_hours) %></p> |
|
36 | <p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf? %> <%= l(:field_hours) %></p> | |
37 | <% if @issue.leaf? && Issue.use_field_for_done_ratio? %> |
|
37 | <% if @issue.leaf? && Issue.use_field_for_done_ratio? %> | |
38 | <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p> |
|
38 | <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p> | |
39 | <% end %> |
|
39 | <% end %> | |
40 | </div> |
|
40 | </div> | |
41 |
|
41 | |||
42 | <div style="clear:both;"> </div> |
|
42 | <div style="clear:both;"> </div> | |
43 | <%= render :partial => 'issues/form_custom_fields' %> |
|
43 | <%= render :partial => 'issues/form_custom_fields' %> | |
44 |
|
44 | |||
45 | <% end %> |
|
45 | <% end %> |
@@ -1,6 +1,6 | |||||
1 | <h2><%=l(:label_version_new)%></h2> |
|
1 | <h2><%=l(:label_version_new)%></h2> | |
2 |
|
2 | |||
3 |
<% labelled_tabular_form_for :version, @version, :url => { :action => ' |
|
3 | <% labelled_tabular_form_for :version, @version, :url => { :action => 'create', :project_id => @project } do |f| %> | |
4 | <%= render :partial => 'versions/form', :locals => { :f => f } %> |
|
4 | <%= render :partial => 'versions/form', :locals => { :f => f } %> | |
5 | <%= submit_tag l(:button_create) %> |
|
5 | <%= submit_tag l(:button_create) %> | |
6 | <% end %> |
|
6 | <% end %> |
@@ -1,305 +1,306 | |||||
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 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' |
|
107 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' | |
108 | # TODO: would look nicer as /issues/:id/preview |
|
108 | # TODO: would look nicer as /issues/:id/preview | |
109 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' |
|
109 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' | |
110 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' |
|
110 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' | |
111 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' |
|
111 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' | |
112 |
|
112 | |||
113 | map.with_options :controller => 'issues' do |issues_routes| |
|
113 | map.with_options :controller => 'issues' do |issues_routes| | |
114 | issues_routes.with_options :conditions => {:method => :get} do |issues_views| |
|
114 | issues_routes.with_options :conditions => {:method => :get} do |issues_views| | |
115 | issues_views.connect 'issues', :action => 'index' |
|
115 | issues_views.connect 'issues', :action => 'index' | |
116 | issues_views.connect 'issues.:format', :action => 'index' |
|
116 | issues_views.connect 'issues.:format', :action => 'index' | |
117 | issues_views.connect 'projects/:project_id/issues', :action => 'index' |
|
117 | issues_views.connect 'projects/:project_id/issues', :action => 'index' | |
118 | issues_views.connect 'projects/:project_id/issues.:format', :action => 'index' |
|
118 | issues_views.connect 'projects/:project_id/issues.:format', :action => 'index' | |
119 | issues_views.connect 'projects/:project_id/issues/new', :action => 'new' |
|
119 | issues_views.connect 'projects/:project_id/issues/new', :action => 'new' | |
120 | issues_views.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show' |
|
120 | issues_views.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show' | |
121 | issues_views.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show' |
|
121 | issues_views.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show' | |
122 | issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new' |
|
122 | issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new' | |
123 | issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/ |
|
123 | issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/ | |
124 | issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/ |
|
124 | issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/ | |
125 | issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/ |
|
125 | issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/ | |
126 | end |
|
126 | end | |
127 | issues_routes.with_options :conditions => {:method => :post} do |issues_actions| |
|
127 | issues_routes.with_options :conditions => {:method => :post} do |issues_actions| | |
128 | issues_actions.connect 'issues', :action => 'index' |
|
128 | issues_actions.connect 'issues', :action => 'index' | |
129 | issues_actions.connect 'projects/:project_id/issues', :action => 'create' |
|
129 | issues_actions.connect 'projects/:project_id/issues', :action => 'create' | |
130 | issues_actions.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show' |
|
130 | issues_actions.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show' | |
131 | issues_actions.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show' |
|
131 | issues_actions.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show' | |
132 | issues_actions.connect 'issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/ |
|
132 | issues_actions.connect 'issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/ | |
133 | issues_actions.connect 'issues/:id/:action', :action => /edit|destroy/, :id => /\d+/ |
|
133 | issues_actions.connect 'issues/:id/:action', :action => /edit|destroy/, :id => /\d+/ | |
134 | issues_actions.connect 'issues.:format', :action => 'create', :format => /xml/ |
|
134 | issues_actions.connect 'issues.:format', :action => 'create', :format => /xml/ | |
135 | issues_actions.connect 'issues/bulk_edit', :action => 'bulk_update' |
|
135 | issues_actions.connect 'issues/bulk_edit', :action => 'bulk_update' | |
136 | end |
|
136 | end | |
137 | issues_routes.with_options :conditions => {:method => :put} do |issues_actions| |
|
137 | issues_routes.with_options :conditions => {:method => :put} do |issues_actions| | |
138 | issues_actions.connect 'issues/:id/edit', :action => 'update', :id => /\d+/ |
|
138 | issues_actions.connect 'issues/:id/edit', :action => 'update', :id => /\d+/ | |
139 | issues_actions.connect 'issues/:id.:format', :action => 'update', :id => /\d+/, :format => /xml/ |
|
139 | issues_actions.connect 'issues/:id.:format', :action => 'update', :id => /\d+/, :format => /xml/ | |
140 | end |
|
140 | end | |
141 | issues_routes.with_options :conditions => {:method => :delete} do |issues_actions| |
|
141 | issues_routes.with_options :conditions => {:method => :delete} do |issues_actions| | |
142 | issues_actions.connect 'issues/:id.:format', :action => 'destroy', :id => /\d+/, :format => /xml/ |
|
142 | issues_actions.connect 'issues/:id.:format', :action => 'destroy', :id => /\d+/, :format => /xml/ | |
143 | end |
|
143 | end | |
144 | issues_routes.connect 'issues/gantt', :controller => 'gantts', :action => 'show' |
|
144 | issues_routes.connect 'issues/gantt', :controller => 'gantts', :action => 'show' | |
145 | issues_routes.connect 'issues/calendar', :controller => 'calendars', :action => 'show' |
|
145 | issues_routes.connect 'issues/calendar', :controller => 'calendars', :action => 'show' | |
146 | issues_routes.connect 'issues/:action' |
|
146 | issues_routes.connect 'issues/:action' | |
147 | end |
|
147 | end | |
148 |
|
148 | |||
149 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| |
|
149 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| | |
150 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' |
|
150 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' | |
151 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' |
|
151 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' | |
152 | end |
|
152 | end | |
153 |
|
153 | |||
154 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| |
|
154 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| | |
155 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' |
|
155 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' | |
156 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' |
|
156 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' | |
157 | end |
|
157 | end | |
158 |
|
158 | |||
159 | map.with_options :controller => 'news' do |news_routes| |
|
159 | map.with_options :controller => 'news' do |news_routes| | |
160 | news_routes.with_options :conditions => {:method => :get} do |news_views| |
|
160 | news_routes.with_options :conditions => {:method => :get} do |news_views| | |
161 | news_views.connect 'news', :action => 'index' |
|
161 | news_views.connect 'news', :action => 'index' | |
162 | news_views.connect 'projects/:project_id/news', :action => 'index' |
|
162 | news_views.connect 'projects/:project_id/news', :action => 'index' | |
163 | news_views.connect 'projects/:project_id/news.:format', :action => 'index' |
|
163 | news_views.connect 'projects/:project_id/news.:format', :action => 'index' | |
164 | news_views.connect 'news.:format', :action => 'index' |
|
164 | news_views.connect 'news.:format', :action => 'index' | |
165 | news_views.connect 'projects/:project_id/news/new', :action => 'new' |
|
165 | news_views.connect 'projects/:project_id/news/new', :action => 'new' | |
166 | news_views.connect 'news/:id', :action => 'show' |
|
166 | news_views.connect 'news/:id', :action => 'show' | |
167 | news_views.connect 'news/:id/edit', :action => 'edit' |
|
167 | news_views.connect 'news/:id/edit', :action => 'edit' | |
168 | end |
|
168 | end | |
169 | news_routes.with_options do |news_actions| |
|
169 | news_routes.with_options do |news_actions| | |
170 | news_actions.connect 'projects/:project_id/news', :action => 'new' |
|
170 | news_actions.connect 'projects/:project_id/news', :action => 'new' | |
171 | news_actions.connect 'news/:id/edit', :action => 'edit' |
|
171 | news_actions.connect 'news/:id/edit', :action => 'edit' | |
172 | news_actions.connect 'news/:id/destroy', :action => 'destroy' |
|
172 | news_actions.connect 'news/:id/destroy', :action => 'destroy' | |
173 | end |
|
173 | end | |
174 | end |
|
174 | end | |
175 |
|
175 | |||
176 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
176 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' | |
177 |
|
177 | |||
178 | map.with_options :controller => 'users' do |users| |
|
178 | map.with_options :controller => 'users' do |users| | |
179 | users.with_options :conditions => {:method => :get} do |user_views| |
|
179 | users.with_options :conditions => {:method => :get} do |user_views| | |
180 | user_views.connect 'users', :action => 'index' |
|
180 | user_views.connect 'users', :action => 'index' | |
181 | user_views.connect 'users/:id', :action => 'show', :id => /\d+/ |
|
181 | user_views.connect 'users/:id', :action => 'show', :id => /\d+/ | |
182 | user_views.connect 'users/new', :action => 'add' |
|
182 | user_views.connect 'users/new', :action => 'add' | |
183 | user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil |
|
183 | user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil | |
184 | end |
|
184 | end | |
185 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
185 | users.with_options :conditions => {:method => :post} do |user_actions| | |
186 | user_actions.connect 'users', :action => 'add' |
|
186 | user_actions.connect 'users', :action => 'add' | |
187 | user_actions.connect 'users/new', :action => 'add' |
|
187 | user_actions.connect 'users/new', :action => 'add' | |
188 | user_actions.connect 'users/:id/edit', :action => 'edit' |
|
188 | user_actions.connect 'users/:id/edit', :action => 'edit' | |
189 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
189 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' | |
190 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
190 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' | |
191 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
191 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' | |
192 | end |
|
192 | end | |
193 | end |
|
193 | end | |
194 |
|
194 | |||
195 | map.with_options :controller => 'projects' do |projects| |
|
195 | map.with_options :controller => 'projects' do |projects| | |
196 | projects.with_options :conditions => {:method => :get} do |project_views| |
|
196 | projects.with_options :conditions => {:method => :get} do |project_views| | |
197 | project_views.connect 'projects', :action => 'index' |
|
197 | project_views.connect 'projects', :action => 'index' | |
198 | project_views.connect 'projects.:format', :action => 'index' |
|
198 | project_views.connect 'projects.:format', :action => 'index' | |
199 | project_views.connect 'projects/new', :action => 'new' |
|
199 | project_views.connect 'projects/new', :action => 'new' | |
200 | project_views.connect 'projects/:id', :action => 'show' |
|
200 | project_views.connect 'projects/:id', :action => 'show' | |
201 | project_views.connect 'projects/:id.:format', :action => 'show' |
|
201 | project_views.connect 'projects/:id.:format', :action => 'show' | |
202 | project_views.connect 'projects/:id/:action', :action => /destroy|settings/ |
|
202 | project_views.connect 'projects/:id/:action', :action => /destroy|settings/ | |
203 | project_views.connect 'projects/:id/files', :controller => 'files', :action => 'index' |
|
203 | project_views.connect 'projects/:id/files', :controller => 'files', :action => 'index' | |
204 | project_views.connect 'projects/:id/files/new', :controller => 'files', :action => 'new' |
|
204 | project_views.connect 'projects/:id/files/new', :controller => 'files', :action => 'new' | |
205 | project_views.connect 'projects/:id/settings/:tab', :action => 'settings' |
|
205 | project_views.connect 'projects/:id/settings/:tab', :action => 'settings' | |
206 | end |
|
206 | end | |
207 |
|
207 | |||
208 | projects.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| |
|
208 | projects.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| | |
209 | activity.connect 'projects/:id/activity' |
|
209 | activity.connect 'projects/:id/activity' | |
210 | activity.connect 'projects/:id/activity.:format' |
|
210 | activity.connect 'projects/:id/activity.:format' | |
211 | activity.connect 'activity', :id => nil |
|
211 | activity.connect 'activity', :id => nil | |
212 | activity.connect 'activity.:format', :id => nil |
|
212 | activity.connect 'activity.:format', :id => nil | |
213 | end |
|
213 | end | |
214 |
|
214 | |||
215 | projects.with_options :conditions => {:method => :post} do |project_actions| |
|
215 | projects.with_options :conditions => {:method => :post} do |project_actions| | |
216 | project_actions.connect 'projects/new', :action => 'create' |
|
216 | project_actions.connect 'projects/new', :action => 'create' | |
217 | project_actions.connect 'projects', :action => 'create' |
|
217 | project_actions.connect 'projects', :action => 'create' | |
218 | project_actions.connect 'projects.:format', :action => 'create', :format => /xml/ |
|
218 | project_actions.connect 'projects.:format', :action => 'create', :format => /xml/ | |
219 | project_actions.connect 'projects/:id/edit', :action => 'update' |
|
219 | project_actions.connect 'projects/:id/edit', :action => 'update' | |
220 | project_actions.connect 'projects/:id/:action', :action => /destroy|archive|unarchive/ |
|
220 | project_actions.connect 'projects/:id/:action', :action => /destroy|archive|unarchive/ | |
221 | project_actions.connect 'projects/:id/files/new', :controller => 'files', :action => 'new' |
|
221 | project_actions.connect 'projects/:id/files/new', :controller => 'files', :action => 'new' | |
222 | project_actions.connect 'projects/:id/activities/save', :controller => 'project_enumerations', :action => 'save' |
|
222 | project_actions.connect 'projects/:id/activities/save', :controller => 'project_enumerations', :action => 'save' | |
223 | end |
|
223 | end | |
224 |
|
224 | |||
225 | projects.with_options :conditions => {:method => :put} do |project_actions| |
|
225 | projects.with_options :conditions => {:method => :put} do |project_actions| | |
226 | project_actions.conditions 'projects/:id.:format', :action => 'update', :format => /xml/ |
|
226 | project_actions.conditions 'projects/:id.:format', :action => 'update', :format => /xml/ | |
227 | end |
|
227 | end | |
228 |
|
228 | |||
229 | projects.with_options :conditions => {:method => :delete} do |project_actions| |
|
229 | projects.with_options :conditions => {:method => :delete} do |project_actions| | |
230 | project_actions.conditions 'projects/:id.:format', :action => 'destroy', :format => /xml/ |
|
230 | project_actions.conditions 'projects/:id.:format', :action => 'destroy', :format => /xml/ | |
231 | project_actions.conditions 'projects/:id/reset_activities', :controller => 'project_enumerations', :action => 'destroy' |
|
231 | project_actions.conditions 'projects/:id/reset_activities', :controller => 'project_enumerations', :action => 'destroy' | |
232 | end |
|
232 | end | |
233 | end |
|
233 | end | |
234 |
|
234 | |||
235 | map.with_options :controller => 'versions' do |versions| |
|
235 | map.with_options :controller => 'versions' do |versions| | |
236 | versions.connect 'projects/:project_id/versions/new', :action => 'new' |
|
236 | versions.connect 'projects/:project_id/versions/new', :action => 'new' | |
237 | versions.connect 'projects/:project_id/roadmap', :action => 'index' |
|
237 | versions.connect 'projects/:project_id/roadmap', :action => 'index' | |
238 | versions.connect 'versions/:action/:id', :conditions => {:method => :get} |
|
238 | versions.connect 'versions/:action/:id', :conditions => {:method => :get} | |
239 |
|
239 | |||
240 | versions.with_options :conditions => {:method => :post} do |version_actions| |
|
240 | versions.with_options :conditions => {:method => :post} do |version_actions| | |
|
241 | version_actions.connect 'projects/:project_id/versions', :action => 'create' | |||
241 | version_actions.connect 'versions/update/:id', :action => 'update' |
|
242 | version_actions.connect 'versions/update/:id', :action => 'update' | |
242 | version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed' |
|
243 | version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed' | |
243 | end |
|
244 | end | |
244 | end |
|
245 | end | |
245 |
|
246 | |||
246 | map.with_options :controller => 'issue_categories' do |categories| |
|
247 | map.with_options :controller => 'issue_categories' do |categories| | |
247 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' |
|
248 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' | |
248 | end |
|
249 | end | |
249 |
|
250 | |||
250 | map.with_options :controller => 'repositories' do |repositories| |
|
251 | map.with_options :controller => 'repositories' do |repositories| | |
251 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
252 | repositories.with_options :conditions => {:method => :get} do |repository_views| | |
252 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
253 | repository_views.connect 'projects/:id/repository', :action => 'show' | |
253 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
254 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' | |
254 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
255 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' | |
255 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
256 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' | |
256 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
257 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' | |
257 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
258 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' | |
258 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
259 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' | |
259 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
260 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' | |
260 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
261 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
261 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
262 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
262 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' |
|
263 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' | |
263 | # TODO: why the following route is required? |
|
264 | # TODO: why the following route is required? | |
264 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' |
|
265 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' | |
265 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
266 | repository_views.connect 'projects/:id/repository/:action/*path' | |
266 | end |
|
267 | end | |
267 |
|
268 | |||
268 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
269 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} | |
269 | end |
|
270 | end | |
270 |
|
271 | |||
271 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ |
|
272 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ | |
272 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
273 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ | |
273 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
274 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ | |
274 |
|
275 | |||
275 | map.resources :groups |
|
276 | map.resources :groups | |
276 |
|
277 | |||
277 | #left old routes at the bottom for backwards compat |
|
278 | #left old routes at the bottom for backwards compat | |
278 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' |
|
279 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' | |
279 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' |
|
280 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' | |
280 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' |
|
281 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' | |
281 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
282 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' | |
282 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
283 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' | |
283 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' |
|
284 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' | |
284 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
285 | map.connect 'projects/:project_id/news/:action', :controller => 'news' | |
285 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
286 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ | |
286 | map.with_options :controller => 'repositories' do |omap| |
|
287 | map.with_options :controller => 'repositories' do |omap| | |
287 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
288 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' | |
288 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
289 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' | |
289 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
290 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' | |
290 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
291 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' | |
291 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
292 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' | |
292 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
293 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' | |
293 | end |
|
294 | end | |
294 |
|
295 | |||
295 | map.with_options :controller => 'sys' do |sys| |
|
296 | map.with_options :controller => 'sys' do |sys| | |
296 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
297 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} | |
297 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
298 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} | |
298 | end |
|
299 | end | |
299 |
|
300 | |||
300 | # Install the default route as the lowest priority. |
|
301 | # Install the default route as the lowest priority. | |
301 | map.connect ':controller/:action/:id' |
|
302 | map.connect ':controller/:action/:id' | |
302 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
303 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' | |
303 | # Used for OpenID |
|
304 | # Used for OpenID | |
304 | map.root :controller => 'account', :action => 'login' |
|
305 | map.root :controller => 'account', :action => 'login' | |
305 | end |
|
306 | end |
@@ -1,230 +1,230 | |||||
1 | require 'redmine/access_control' |
|
1 | require 'redmine/access_control' | |
2 | require 'redmine/menu_manager' |
|
2 | require 'redmine/menu_manager' | |
3 | require 'redmine/activity' |
|
3 | require 'redmine/activity' | |
4 | require 'redmine/search' |
|
4 | require 'redmine/search' | |
5 | require 'redmine/custom_field_format' |
|
5 | require 'redmine/custom_field_format' | |
6 | require 'redmine/mime_type' |
|
6 | require 'redmine/mime_type' | |
7 | require 'redmine/core_ext' |
|
7 | require 'redmine/core_ext' | |
8 | require 'redmine/themes' |
|
8 | require 'redmine/themes' | |
9 | require 'redmine/hook' |
|
9 | require 'redmine/hook' | |
10 | require 'redmine/plugin' |
|
10 | require 'redmine/plugin' | |
11 | require 'redmine/wiki_formatting' |
|
11 | require 'redmine/wiki_formatting' | |
12 | require 'redmine/scm/base' |
|
12 | require 'redmine/scm/base' | |
13 |
|
13 | |||
14 | begin |
|
14 | begin | |
15 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) |
|
15 | require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick) | |
16 | rescue LoadError |
|
16 | rescue LoadError | |
17 | # RMagick is not available |
|
17 | # RMagick is not available | |
18 | end |
|
18 | end | |
19 |
|
19 | |||
20 | if RUBY_VERSION < '1.9' |
|
20 | if RUBY_VERSION < '1.9' | |
21 | require 'faster_csv' |
|
21 | require 'faster_csv' | |
22 | else |
|
22 | else | |
23 | require 'csv' |
|
23 | require 'csv' | |
24 | FCSV = CSV |
|
24 | FCSV = CSV | |
25 | end |
|
25 | end | |
26 |
|
26 | |||
27 | Redmine::Scm::Base.add "Subversion" |
|
27 | Redmine::Scm::Base.add "Subversion" | |
28 | Redmine::Scm::Base.add "Darcs" |
|
28 | Redmine::Scm::Base.add "Darcs" | |
29 | Redmine::Scm::Base.add "Mercurial" |
|
29 | Redmine::Scm::Base.add "Mercurial" | |
30 | Redmine::Scm::Base.add "Cvs" |
|
30 | Redmine::Scm::Base.add "Cvs" | |
31 | Redmine::Scm::Base.add "Bazaar" |
|
31 | Redmine::Scm::Base.add "Bazaar" | |
32 | Redmine::Scm::Base.add "Git" |
|
32 | Redmine::Scm::Base.add "Git" | |
33 | Redmine::Scm::Base.add "Filesystem" |
|
33 | Redmine::Scm::Base.add "Filesystem" | |
34 |
|
34 | |||
35 | Redmine::CustomFieldFormat.map do |fields| |
|
35 | Redmine::CustomFieldFormat.map do |fields| | |
36 | fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1) |
|
36 | fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1) | |
37 | fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2) |
|
37 | fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2) | |
38 | fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3) |
|
38 | fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3) | |
39 | fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4) |
|
39 | fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4) | |
40 | fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5) |
|
40 | fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5) | |
41 | fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6) |
|
41 | fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6) | |
42 | fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7) |
|
42 | fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7) | |
43 | end |
|
43 | end | |
44 |
|
44 | |||
45 | # Permissions |
|
45 | # Permissions | |
46 | Redmine::AccessControl.map do |map| |
|
46 | Redmine::AccessControl.map do |map| | |
47 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true |
|
47 | map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true | |
48 | map.permission :search_project, {:search => :index}, :public => true |
|
48 | map.permission :search_project, {:search => :index}, :public => true | |
49 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
|
49 | map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin | |
50 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
50 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member | |
51 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
51 | map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
52 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
52 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member | |
53 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :edit, :update, :close_completed, :destroy]}, :require => :member |
|
53 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member | |
54 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
54 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member | |
55 |
|
55 | |||
56 | map.project_module :issue_tracking do |map| |
|
56 | map.project_module :issue_tracking do |map| | |
57 | # Issue categories |
|
57 | # Issue categories | |
58 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member |
|
58 | map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member | |
59 | # Issues |
|
59 | # Issues | |
60 | map.permission :view_issues, {:issues => [:index, :show], |
|
60 | map.permission :view_issues, {:issues => [:index, :show], | |
61 | :auto_complete => [:issues], |
|
61 | :auto_complete => [:issues], | |
62 | :context_menus => [:issues], |
|
62 | :context_menus => [:issues], | |
63 | :versions => [:index, :show, :status_by], |
|
63 | :versions => [:index, :show, :status_by], | |
64 | :journals => :index, |
|
64 | :journals => :index, | |
65 | :queries => :index, |
|
65 | :queries => :index, | |
66 | :reports => [:issue_report, :issue_report_details]} |
|
66 | :reports => [:issue_report, :issue_report_details]} | |
67 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} |
|
67 | map.permission :add_issues, {:issues => [:new, :create, :update_form]} | |
68 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} |
|
68 | map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]} | |
69 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} |
|
69 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]} | |
70 | map.permission :manage_subtasks, {} |
|
70 | map.permission :manage_subtasks, {} | |
71 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} |
|
71 | map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} | |
72 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin |
|
72 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin | |
73 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin |
|
73 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin | |
74 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin |
|
74 | map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin | |
75 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
75 | map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
76 | # Queries |
|
76 | # Queries | |
77 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member |
|
77 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member | |
78 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin |
|
78 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin | |
79 | # Watchers |
|
79 | # Watchers | |
80 | map.permission :view_issue_watchers, {} |
|
80 | map.permission :view_issue_watchers, {} | |
81 | map.permission :add_issue_watchers, {:watchers => :new} |
|
81 | map.permission :add_issue_watchers, {:watchers => :new} | |
82 | map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
82 | map.permission :delete_issue_watchers, {:watchers => :destroy} | |
83 | end |
|
83 | end | |
84 |
|
84 | |||
85 | map.project_module :time_tracking do |map| |
|
85 | map.project_module :time_tracking do |map| | |
86 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin |
|
86 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin | |
87 | map.permission :view_time_entries, :timelog => [:details, :report] |
|
87 | map.permission :view_time_entries, :timelog => [:details, :report] | |
88 | map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member |
|
88 | map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member | |
89 | map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin |
|
89 | map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin | |
90 | map.permission :manage_project_activities, {:project_enumerations => [:save, :destroy]}, :require => :member |
|
90 | map.permission :manage_project_activities, {:project_enumerations => [:save, :destroy]}, :require => :member | |
91 | end |
|
91 | end | |
92 |
|
92 | |||
93 | map.project_module :news do |map| |
|
93 | map.project_module :news do |map| | |
94 | map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member |
|
94 | map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member | |
95 | map.permission :view_news, {:news => [:index, :show]}, :public => true |
|
95 | map.permission :view_news, {:news => [:index, :show]}, :public => true | |
96 | map.permission :comment_news, {:news => :add_comment} |
|
96 | map.permission :comment_news, {:news => :add_comment} | |
97 | end |
|
97 | end | |
98 |
|
98 | |||
99 | map.project_module :documents do |map| |
|
99 | map.project_module :documents do |map| | |
100 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin |
|
100 | map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin | |
101 | map.permission :view_documents, :documents => [:index, :show, :download] |
|
101 | map.permission :view_documents, :documents => [:index, :show, :download] | |
102 | end |
|
102 | end | |
103 |
|
103 | |||
104 | map.project_module :files do |map| |
|
104 | map.project_module :files do |map| | |
105 | map.permission :manage_files, {:files => :new}, :require => :loggedin |
|
105 | map.permission :manage_files, {:files => :new}, :require => :loggedin | |
106 | map.permission :view_files, :files => :index, :versions => :download |
|
106 | map.permission :view_files, :files => :index, :versions => :download | |
107 | end |
|
107 | end | |
108 |
|
108 | |||
109 | map.project_module :wiki do |map| |
|
109 | map.project_module :wiki do |map| | |
110 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
|
110 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |
111 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
111 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |
112 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
112 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member | |
113 | map.permission :view_wiki_pages, :wiki => [:index, :special] |
|
113 | map.permission :view_wiki_pages, :wiki => [:index, :special] | |
114 | map.permission :export_wiki_pages, {} |
|
114 | map.permission :export_wiki_pages, {} | |
115 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] |
|
115 | map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate] | |
116 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] |
|
116 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment] | |
117 | map.permission :delete_wiki_pages_attachments, {} |
|
117 | map.permission :delete_wiki_pages_attachments, {} | |
118 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
118 | map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member | |
119 | end |
|
119 | end | |
120 |
|
120 | |||
121 | map.project_module :repository do |map| |
|
121 | map.project_module :repository do |map| | |
122 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member |
|
122 | map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member | |
123 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] |
|
123 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] | |
124 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
124 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] | |
125 | map.permission :commit_access, {} |
|
125 | map.permission :commit_access, {} | |
126 | end |
|
126 | end | |
127 |
|
127 | |||
128 | map.project_module :boards do |map| |
|
128 | map.project_module :boards do |map| | |
129 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member |
|
129 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member | |
130 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
130 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true | |
131 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} |
|
131 | map.permission :add_messages, {:messages => [:new, :reply, :quote]} | |
132 | map.permission :edit_messages, {:messages => :edit}, :require => :member |
|
132 | map.permission :edit_messages, {:messages => :edit}, :require => :member | |
133 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin |
|
133 | map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin | |
134 | map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
134 | map.permission :delete_messages, {:messages => :destroy}, :require => :member | |
135 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
135 | map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin | |
136 | end |
|
136 | end | |
137 |
|
137 | |||
138 | map.project_module :calendar do |map| |
|
138 | map.project_module :calendar do |map| | |
139 | map.permission :view_calendar, :calendars => :show |
|
139 | map.permission :view_calendar, :calendars => :show | |
140 | end |
|
140 | end | |
141 |
|
141 | |||
142 | map.project_module :gantt do |map| |
|
142 | map.project_module :gantt do |map| | |
143 | map.permission :view_gantt, :gantts => :show |
|
143 | map.permission :view_gantt, :gantts => :show | |
144 | end |
|
144 | end | |
145 | end |
|
145 | end | |
146 |
|
146 | |||
147 | Redmine::MenuManager.map :top_menu do |menu| |
|
147 | Redmine::MenuManager.map :top_menu do |menu| | |
148 | menu.push :home, :home_path |
|
148 | menu.push :home, :home_path | |
149 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } |
|
149 | menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } | |
150 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural |
|
150 | menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural | |
151 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true |
|
151 | menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true | |
152 | menu.push :help, Redmine::Info.help_url, :last => true |
|
152 | menu.push :help, Redmine::Info.help_url, :last => true | |
153 | end |
|
153 | end | |
154 |
|
154 | |||
155 | Redmine::MenuManager.map :account_menu do |menu| |
|
155 | Redmine::MenuManager.map :account_menu do |menu| | |
156 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } |
|
156 | menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } | |
157 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } |
|
157 | menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } | |
158 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } |
|
158 | menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } | |
159 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } |
|
159 | menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } | |
160 | end |
|
160 | end | |
161 |
|
161 | |||
162 | Redmine::MenuManager.map :application_menu do |menu| |
|
162 | Redmine::MenuManager.map :application_menu do |menu| | |
163 | # Empty |
|
163 | # Empty | |
164 | end |
|
164 | end | |
165 |
|
165 | |||
166 | Redmine::MenuManager.map :admin_menu do |menu| |
|
166 | Redmine::MenuManager.map :admin_menu do |menu| | |
167 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural |
|
167 | menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural | |
168 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural |
|
168 | menu.push :users, {:controller => 'users'}, :caption => :label_user_plural | |
169 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural |
|
169 | menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural | |
170 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions |
|
170 | menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions | |
171 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural |
|
171 | menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural | |
172 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, |
|
172 | menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, | |
173 | :html => {:class => 'issue_statuses'} |
|
173 | :html => {:class => 'issue_statuses'} | |
174 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow |
|
174 | menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow | |
175 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, |
|
175 | menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, | |
176 | :html => {:class => 'custom_fields'} |
|
176 | :html => {:class => 'custom_fields'} | |
177 | menu.push :enumerations, {:controller => 'enumerations'} |
|
177 | menu.push :enumerations, {:controller => 'enumerations'} | |
178 | menu.push :settings, {:controller => 'settings'} |
|
178 | menu.push :settings, {:controller => 'settings'} | |
179 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, |
|
179 | menu.push :ldap_authentication, {:controller => 'ldap_auth_sources', :action => 'index'}, | |
180 | :html => {:class => 'server_authentication'} |
|
180 | :html => {:class => 'server_authentication'} | |
181 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true |
|
181 | menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true | |
182 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true |
|
182 | menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true | |
183 | end |
|
183 | end | |
184 |
|
184 | |||
185 | Redmine::MenuManager.map :project_menu do |menu| |
|
185 | Redmine::MenuManager.map :project_menu do |menu| | |
186 | menu.push :overview, { :controller => 'projects', :action => 'show' } |
|
186 | menu.push :overview, { :controller => 'projects', :action => 'show' } | |
187 | menu.push :activity, { :controller => 'activities', :action => 'index' } |
|
187 | menu.push :activity, { :controller => 'activities', :action => 'index' } | |
188 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, |
|
188 | menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, | |
189 | :if => Proc.new { |p| p.shared_versions.any? } |
|
189 | :if => Proc.new { |p| p.shared_versions.any? } | |
190 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural |
|
190 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural | |
191 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, |
|
191 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, | |
192 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } |
|
192 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } | |
193 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt |
|
193 | menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt | |
194 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar |
|
194 | menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar | |
195 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
195 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural | |
196 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
196 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural | |
197 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, |
|
197 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, | |
198 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } |
|
198 | :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } | |
199 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, |
|
199 | menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, | |
200 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural |
|
200 | :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural | |
201 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural |
|
201 | menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural | |
202 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, |
|
202 | menu.push :repository, { :controller => 'repositories', :action => 'show' }, | |
203 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } |
|
203 | :if => Proc.new { |p| p.repository && !p.repository.new_record? } | |
204 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true |
|
204 | menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true | |
205 | end |
|
205 | end | |
206 |
|
206 | |||
207 | Redmine::Activity.map do |activity| |
|
207 | Redmine::Activity.map do |activity| | |
208 | activity.register :issues, :class_name => %w(Issue Journal) |
|
208 | activity.register :issues, :class_name => %w(Issue Journal) | |
209 | activity.register :changesets |
|
209 | activity.register :changesets | |
210 | activity.register :news |
|
210 | activity.register :news | |
211 | activity.register :documents, :class_name => %w(Document Attachment) |
|
211 | activity.register :documents, :class_name => %w(Document Attachment) | |
212 | activity.register :files, :class_name => 'Attachment' |
|
212 | activity.register :files, :class_name => 'Attachment' | |
213 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false |
|
213 | activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false | |
214 | activity.register :messages, :default => false |
|
214 | activity.register :messages, :default => false | |
215 | activity.register :time_entries, :default => false |
|
215 | activity.register :time_entries, :default => false | |
216 | end |
|
216 | end | |
217 |
|
217 | |||
218 | Redmine::Search.map do |search| |
|
218 | Redmine::Search.map do |search| | |
219 | search.register :issues |
|
219 | search.register :issues | |
220 | search.register :news |
|
220 | search.register :news | |
221 | search.register :documents |
|
221 | search.register :documents | |
222 | search.register :changesets |
|
222 | search.register :changesets | |
223 | search.register :wiki_pages |
|
223 | search.register :wiki_pages | |
224 | search.register :messages |
|
224 | search.register :messages | |
225 | search.register :projects |
|
225 | search.register :projects | |
226 | end |
|
226 | end | |
227 |
|
227 | |||
228 | Redmine::WikiFormatting.map do |format| |
|
228 | Redmine::WikiFormatting.map do |format| | |
229 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper |
|
229 | format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper | |
230 | end |
|
230 | end |
@@ -1,139 +1,139 | |||||
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 'versions_controller' |
|
19 | require 'versions_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class VersionsController; def rescue_action(e) raise e end; end |
|
22 | class VersionsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class VersionsControllerTest < ActionController::TestCase |
|
24 | class VersionsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules |
|
25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = VersionsController.new |
|
28 | @controller = VersionsController.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 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def test_index |
|
34 | def test_index | |
35 | get :index, :project_id => 1 |
|
35 | get :index, :project_id => 1 | |
36 | assert_response :success |
|
36 | assert_response :success | |
37 | assert_template 'index' |
|
37 | assert_template 'index' | |
38 | assert_not_nil assigns(:versions) |
|
38 | assert_not_nil assigns(:versions) | |
39 | # Version with no date set appears |
|
39 | # Version with no date set appears | |
40 | assert assigns(:versions).include?(Version.find(3)) |
|
40 | assert assigns(:versions).include?(Version.find(3)) | |
41 | # Completed version doesn't appear |
|
41 | # Completed version doesn't appear | |
42 | assert !assigns(:versions).include?(Version.find(1)) |
|
42 | assert !assigns(:versions).include?(Version.find(1)) | |
43 | # Context menu on issues |
|
43 | # Context menu on issues | |
44 | assert_select "script", :text => Regexp.new(Regexp.escape("new ContextMenu('/issues/context_menu')")) |
|
44 | assert_select "script", :text => Regexp.new(Regexp.escape("new ContextMenu('/issues/context_menu')")) | |
45 | end |
|
45 | end | |
46 |
|
46 | |||
47 | def test_index_with_completed_versions |
|
47 | def test_index_with_completed_versions | |
48 | get :index, :project_id => 1, :completed => 1 |
|
48 | get :index, :project_id => 1, :completed => 1 | |
49 | assert_response :success |
|
49 | assert_response :success | |
50 | assert_template 'index' |
|
50 | assert_template 'index' | |
51 | assert_not_nil assigns(:versions) |
|
51 | assert_not_nil assigns(:versions) | |
52 | # Version with no date set appears |
|
52 | # Version with no date set appears | |
53 | assert assigns(:versions).include?(Version.find(3)) |
|
53 | assert assigns(:versions).include?(Version.find(3)) | |
54 | # Completed version appears |
|
54 | # Completed version appears | |
55 | assert assigns(:versions).include?(Version.find(1)) |
|
55 | assert assigns(:versions).include?(Version.find(1)) | |
56 | end |
|
56 | end | |
57 |
|
57 | |||
58 | def test_index_showing_subprojects_versions |
|
58 | def test_index_showing_subprojects_versions | |
59 | @subproject_version = Version.generate!(:project => Project.find(3)) |
|
59 | @subproject_version = Version.generate!(:project => Project.find(3)) | |
60 | get :index, :project_id => 1, :with_subprojects => 1 |
|
60 | get :index, :project_id => 1, :with_subprojects => 1 | |
61 | assert_response :success |
|
61 | assert_response :success | |
62 | assert_template 'index' |
|
62 | assert_template 'index' | |
63 | assert_not_nil assigns(:versions) |
|
63 | assert_not_nil assigns(:versions) | |
64 |
|
64 | |||
65 | assert assigns(:versions).include?(Version.find(4)), "Shared version not found" |
|
65 | assert assigns(:versions).include?(Version.find(4)), "Shared version not found" | |
66 | assert assigns(:versions).include?(@subproject_version), "Subproject version not found" |
|
66 | assert assigns(:versions).include?(@subproject_version), "Subproject version not found" | |
67 | end |
|
67 | end | |
68 |
|
68 | |||
69 | def test_show |
|
69 | def test_show | |
70 | get :show, :id => 2 |
|
70 | get :show, :id => 2 | |
71 | assert_response :success |
|
71 | assert_response :success | |
72 | assert_template 'show' |
|
72 | assert_template 'show' | |
73 | assert_not_nil assigns(:version) |
|
73 | assert_not_nil assigns(:version) | |
74 |
|
74 | |||
75 | assert_tag :tag => 'h2', :content => /1.0/ |
|
75 | assert_tag :tag => 'h2', :content => /1.0/ | |
76 | end |
|
76 | end | |
77 |
|
77 | |||
78 |
def test_ |
|
78 | def test_create | |
79 | @request.session[:user_id] = 2 # manager |
|
79 | @request.session[:user_id] = 2 # manager | |
80 | assert_difference 'Version.count' do |
|
80 | assert_difference 'Version.count' do | |
81 |
post : |
|
81 | post :create, :project_id => '1', :version => {:name => 'test_add_version'} | |
82 | end |
|
82 | end | |
83 | assert_redirected_to '/projects/ecookbook/settings/versions' |
|
83 | assert_redirected_to '/projects/ecookbook/settings/versions' | |
84 | version = Version.find_by_name('test_add_version') |
|
84 | version = Version.find_by_name('test_add_version') | |
85 | assert_not_nil version |
|
85 | assert_not_nil version | |
86 | assert_equal 1, version.project_id |
|
86 | assert_equal 1, version.project_id | |
87 | end |
|
87 | end | |
88 |
|
88 | |||
89 |
def test_ |
|
89 | def test_create_from_issue_form | |
90 | @request.session[:user_id] = 2 # manager |
|
90 | @request.session[:user_id] = 2 # manager | |
91 | assert_difference 'Version.count' do |
|
91 | assert_difference 'Version.count' do | |
92 |
xhr :post, : |
|
92 | xhr :post, :create, :project_id => '1', :version => {:name => 'test_add_version_from_issue_form'} | |
93 | end |
|
93 | end | |
94 | assert_response :success |
|
94 | assert_response :success | |
95 | assert_select_rjs :replace, 'issue_fixed_version_id' |
|
95 | assert_select_rjs :replace, 'issue_fixed_version_id' | |
96 | version = Version.find_by_name('test_add_version_from_issue_form') |
|
96 | version = Version.find_by_name('test_add_version_from_issue_form') | |
97 | assert_not_nil version |
|
97 | assert_not_nil version | |
98 | assert_equal 1, version.project_id |
|
98 | assert_equal 1, version.project_id | |
99 | end |
|
99 | end | |
100 |
|
100 | |||
101 | def test_get_edit |
|
101 | def test_get_edit | |
102 | @request.session[:user_id] = 2 |
|
102 | @request.session[:user_id] = 2 | |
103 | get :edit, :id => 2 |
|
103 | get :edit, :id => 2 | |
104 | assert_response :success |
|
104 | assert_response :success | |
105 | assert_template 'edit' |
|
105 | assert_template 'edit' | |
106 | end |
|
106 | end | |
107 |
|
107 | |||
108 | def test_close_completed |
|
108 | def test_close_completed | |
109 | Version.update_all("status = 'open'") |
|
109 | Version.update_all("status = 'open'") | |
110 | @request.session[:user_id] = 2 |
|
110 | @request.session[:user_id] = 2 | |
111 | post :close_completed, :project_id => 'ecookbook' |
|
111 | post :close_completed, :project_id => 'ecookbook' | |
112 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' |
|
112 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' | |
113 | assert_not_nil Version.find_by_status('closed') |
|
113 | assert_not_nil Version.find_by_status('closed') | |
114 | end |
|
114 | end | |
115 |
|
115 | |||
116 | def test_post_update |
|
116 | def test_post_update | |
117 | @request.session[:user_id] = 2 |
|
117 | @request.session[:user_id] = 2 | |
118 | post :update, :id => 2, |
|
118 | post :update, :id => 2, | |
119 | :version => { :name => 'New version name', |
|
119 | :version => { :name => 'New version name', | |
120 | :effective_date => Date.today.strftime("%Y-%m-%d")} |
|
120 | :effective_date => Date.today.strftime("%Y-%m-%d")} | |
121 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' |
|
121 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' | |
122 | version = Version.find(2) |
|
122 | version = Version.find(2) | |
123 | assert_equal 'New version name', version.name |
|
123 | assert_equal 'New version name', version.name | |
124 | assert_equal Date.today, version.effective_date |
|
124 | assert_equal Date.today, version.effective_date | |
125 | end |
|
125 | end | |
126 |
|
126 | |||
127 | def test_destroy |
|
127 | def test_destroy | |
128 | @request.session[:user_id] = 2 |
|
128 | @request.session[:user_id] = 2 | |
129 | post :destroy, :id => 3 |
|
129 | post :destroy, :id => 3 | |
130 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' |
|
130 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' | |
131 | assert_nil Version.find_by_id(3) |
|
131 | assert_nil Version.find_by_id(3) | |
132 | end |
|
132 | end | |
133 |
|
133 | |||
134 | def test_issue_status_by |
|
134 | def test_issue_status_by | |
135 | xhr :get, :status_by, :id => 2 |
|
135 | xhr :get, :status_by, :id => 2 | |
136 | assert_response :success |
|
136 | assert_response :success | |
137 | assert_template '_issue_counts' |
|
137 | assert_template '_issue_counts' | |
138 | end |
|
138 | end | |
139 | end |
|
139 | end |
@@ -1,297 +1,297 | |||||
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 :post, "/issues/calendar", :controller => 'calendars', :action => 'show' |
|
94 | should_route :post, "/issues/calendar", :controller => 'calendars', :action => 'show' | |
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 :post, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' |
|
96 | should_route :post, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :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 :post, "/issues/gantt", :controller => 'gantts', :action => 'show' |
|
99 | should_route :post, "/issues/gantt", :controller => 'gantts', :action => 'show' | |
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 :post, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' |
|
101 | should_route :post, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :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 |
|
159 | |||
160 | should_route :post, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
160 | should_route :post, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' | |
161 | should_route :post, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' |
|
161 | should_route :post, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' | |
162 | should_route :post, "/news/567/destroy", :controller => 'news', :action => 'destroy', :id => '567' |
|
162 | should_route :post, "/news/567/destroy", :controller => 'news', :action => 'destroy', :id => '567' | |
163 | end |
|
163 | end | |
164 |
|
164 | |||
165 | context "projects" do |
|
165 | context "projects" do | |
166 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
166 | should_route :get, "/projects", :controller => 'projects', :action => 'index' | |
167 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
167 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' | |
168 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
168 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' | |
169 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' |
|
169 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' | |
170 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
170 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' | |
171 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
171 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' | |
172 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
172 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' | |
173 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' |
|
173 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' | |
174 | should_route :get, "/projects/567/destroy", :controller => 'projects', :action => 'destroy', :id => '567' |
|
174 | should_route :get, "/projects/567/destroy", :controller => 'projects', :action => 'destroy', :id => '567' | |
175 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :id => '33' |
|
175 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :id => '33' | |
176 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :id => '33' |
|
176 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :id => '33' | |
177 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' |
|
177 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' | |
178 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' |
|
178 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' | |
179 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' |
|
179 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' | |
180 |
|
180 | |||
181 | should_route :post, "/projects/new", :controller => 'projects', :action => 'create' |
|
181 | should_route :post, "/projects/new", :controller => 'projects', :action => 'create' | |
182 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' |
|
182 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' | |
183 | should_route :post, "/projects/4223/edit", :controller => 'projects', :action => 'update', :id => '4223' |
|
183 | should_route :post, "/projects/4223/edit", :controller => 'projects', :action => 'update', :id => '4223' | |
184 | should_route :post, "/projects/64/destroy", :controller => 'projects', :action => 'destroy', :id => '64' |
|
184 | should_route :post, "/projects/64/destroy", :controller => 'projects', :action => 'destroy', :id => '64' | |
185 | should_route :post, "/projects/33/files/new", :controller => 'files', :action => 'new', :id => '33' |
|
185 | should_route :post, "/projects/33/files/new", :controller => 'files', :action => 'new', :id => '33' | |
186 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' |
|
186 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' | |
187 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' |
|
187 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' | |
188 | should_route :post, "/projects/64/activities/save", :controller => 'project_enumerations', :action => 'save', :id => '64' |
|
188 | should_route :post, "/projects/64/activities/save", :controller => 'project_enumerations', :action => 'save', :id => '64' | |
189 |
|
189 | |||
190 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' |
|
190 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' | |
191 |
|
191 | |||
192 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' |
|
192 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' | |
193 | should_route :delete, "/projects/64/reset_activities", :controller => 'project_enumerations', :action => 'destroy', :id => '64' |
|
193 | should_route :delete, "/projects/64/reset_activities", :controller => 'project_enumerations', :action => 'destroy', :id => '64' | |
194 | end |
|
194 | end | |
195 |
|
195 | |||
196 | context "repositories" do |
|
196 | context "repositories" do | |
197 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' |
|
197 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' | |
198 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
198 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
199 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' |
|
199 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' | |
200 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' |
|
200 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' | |
201 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' |
|
201 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' | |
202 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' |
|
202 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' | |
203 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' |
|
203 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' | |
204 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] |
|
204 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] | |
205 | 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' |
|
205 | 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' | |
206 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] |
|
206 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] | |
207 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] |
|
207 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] | |
208 | 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' |
|
208 | 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' | |
209 | 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' |
|
209 | 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' | |
210 | 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' |
|
210 | 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' | |
211 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] |
|
211 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] | |
212 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] |
|
212 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] | |
213 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' |
|
213 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' | |
214 |
|
214 | |||
215 |
|
215 | |||
216 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
216 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
217 | end |
|
217 | end | |
218 |
|
218 | |||
219 | context "timelogs" do |
|
219 | context "timelogs" do | |
220 | should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567' |
|
220 | should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567' | |
221 | should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook' |
|
221 | should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook' | |
222 | should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567' |
|
222 | should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567' | |
223 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' |
|
223 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' | |
224 | should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report' |
|
224 | should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report' | |
225 | should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567' |
|
225 | should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567' | |
226 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv' |
|
226 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv' | |
227 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'details' |
|
227 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'details' | |
228 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv' |
|
228 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv' | |
229 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom' |
|
229 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom' | |
230 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567' |
|
230 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567' | |
231 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv' |
|
231 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv' | |
232 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom' |
|
232 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom' | |
233 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234' |
|
233 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234' | |
234 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv' |
|
234 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv' | |
235 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom' |
|
235 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom' | |
236 | should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123' |
|
236 | should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123' | |
237 |
|
237 | |||
238 | should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55' |
|
238 | should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55' | |
239 | end |
|
239 | end | |
240 |
|
240 | |||
241 | context "users" do |
|
241 | context "users" do | |
242 | should_route :get, "/users", :controller => 'users', :action => 'index' |
|
242 | should_route :get, "/users", :controller => 'users', :action => 'index' | |
243 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' |
|
243 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' | |
244 | should_route :get, "/users/new", :controller => 'users', :action => 'add' |
|
244 | should_route :get, "/users/new", :controller => 'users', :action => 'add' | |
245 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
245 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' | |
246 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' |
|
246 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' | |
247 |
|
247 | |||
248 | should_route :post, "/users/new", :controller => 'users', :action => 'add' |
|
248 | should_route :post, "/users/new", :controller => 'users', :action => 'add' | |
249 | should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
249 | should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' | |
250 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' |
|
250 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' | |
251 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' |
|
251 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' | |
252 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
252 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' | |
253 | end |
|
253 | end | |
254 |
|
254 | |||
255 | # TODO: should they all be scoped under /projects/:project_id ? |
|
255 | # TODO: should they all be scoped under /projects/:project_id ? | |
256 | context "versions" do |
|
256 | context "versions" do | |
257 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
257 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' | |
258 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' |
|
258 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' | |
259 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' |
|
259 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' | |
260 |
|
260 | |||
261 |
should_route :post, "/projects/foo/versions |
|
261 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' | |
262 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' |
|
262 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' | |
263 |
|
263 | |||
264 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' |
|
264 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' | |
265 | end |
|
265 | end | |
266 |
|
266 | |||
267 | context "wiki (singular, project's pages)" do |
|
267 | context "wiki (singular, project's pages)" do | |
268 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567' |
|
268 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567' | |
269 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala' |
|
269 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala' | |
270 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' |
|
270 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' | |
271 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation' |
|
271 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation' | |
272 | 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' |
|
272 | 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' | |
273 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2' |
|
273 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2' | |
274 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' |
|
274 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' | |
275 | should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index' |
|
275 | should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index' | |
276 | should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index' |
|
276 | should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index' | |
277 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index' |
|
277 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index' | |
278 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export' |
|
278 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'special', :id => '567', :page => 'export' | |
279 |
|
279 | |||
280 | should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' |
|
280 | should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' | |
281 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation' |
|
281 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation' | |
282 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' |
|
282 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida' | |
283 | should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida' |
|
283 | should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida' | |
284 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida' |
|
284 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida' | |
285 | end |
|
285 | end | |
286 |
|
286 | |||
287 | context "wikis (plural, admin setup)" do |
|
287 | context "wikis (plural, admin setup)" do | |
288 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
288 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
289 |
|
289 | |||
290 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' |
|
290 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' | |
291 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
291 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
292 | end |
|
292 | end | |
293 |
|
293 | |||
294 | context "administration panel" do |
|
294 | context "administration panel" do | |
295 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' |
|
295 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' | |
296 | end |
|
296 | end | |
297 | end |
|
297 | end |
General Comments 0
You need to be logged in to leave comments.
Login now