@@ -1,276 +1,277 | |||||
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 'diff' |
|
18 | require 'diff' | |
19 |
|
19 | |||
20 | # The WikiController follows the Rails REST controller pattern but with |
|
20 | # The WikiController follows the Rails REST controller pattern but with | |
21 | # a few differences |
|
21 | # a few differences | |
22 | # |
|
22 | # | |
23 | # * index - shows a list of WikiPages grouped by page or date |
|
23 | # * index - shows a list of WikiPages grouped by page or date | |
24 | # * new - not used |
|
24 | # * new - not used | |
25 | # * create - not used |
|
25 | # * create - not used | |
26 | # * show - will also show the form for creating a new wiki page |
|
26 | # * show - will also show the form for creating a new wiki page | |
27 | # * edit - used to edit an existing or new page |
|
27 | # * edit - used to edit an existing or new page | |
28 | # * update - used to save a wiki page update to the database, including new pages |
|
28 | # * update - used to save a wiki page update to the database, including new pages | |
29 | # * destroy - normal |
|
29 | # * destroy - normal | |
30 | # |
|
30 | # | |
31 | # Other member and collection methods are also used |
|
31 | # Other member and collection methods are also used | |
32 | # |
|
32 | # | |
33 | # TODO: still being worked on |
|
33 | # TODO: still being worked on | |
34 | class WikiController < ApplicationController |
|
34 | class WikiController < ApplicationController | |
35 | default_search_scope :wiki_pages |
|
35 | default_search_scope :wiki_pages | |
36 | before_filter :find_wiki, :authorize |
|
36 | before_filter :find_wiki, :authorize | |
37 | before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy] |
|
37 | before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy] | |
38 |
|
38 | |||
39 |
verify :method => :post, :only => [ |
|
39 | verify :method => :post, :only => [:protect], :redirect_to => { :action => :show } | |
40 |
|
40 | |||
41 | helper :attachments |
|
41 | helper :attachments | |
42 | include AttachmentsHelper |
|
42 | include AttachmentsHelper | |
43 | helper :watchers |
|
43 | helper :watchers | |
44 |
|
44 | |||
45 | # List of pages, sorted alphabetically and by parent (hierarchy) |
|
45 | # List of pages, sorted alphabetically and by parent (hierarchy) | |
46 | def index |
|
46 | def index | |
47 | load_pages_grouped_by_date_without_content |
|
47 | load_pages_grouped_by_date_without_content | |
48 | end |
|
48 | end | |
49 |
|
49 | |||
50 | # display a page (in editing mode if it doesn't exist) |
|
50 | # display a page (in editing mode if it doesn't exist) | |
51 | def show |
|
51 | def show | |
52 | page_title = params[:page] |
|
52 | page_title = params[:page] | |
53 | @page = @wiki.find_or_new_page(page_title) |
|
53 | @page = @wiki.find_or_new_page(page_title) | |
54 | if @page.new_record? |
|
54 | if @page.new_record? | |
55 | if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? |
|
55 | if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? | |
56 | edit |
|
56 | edit | |
57 | render :action => 'edit' |
|
57 | render :action => 'edit' | |
58 | else |
|
58 | else | |
59 | render_404 |
|
59 | render_404 | |
60 | end |
|
60 | end | |
61 | return |
|
61 | return | |
62 | end |
|
62 | end | |
63 | if params[:version] && !User.current.allowed_to?(:view_wiki_edits, @project) |
|
63 | if params[:version] && !User.current.allowed_to?(:view_wiki_edits, @project) | |
64 | # Redirects user to the current version if he's not allowed to view previous versions |
|
64 | # Redirects user to the current version if he's not allowed to view previous versions | |
65 | redirect_to :version => nil |
|
65 | redirect_to :version => nil | |
66 | return |
|
66 | return | |
67 | end |
|
67 | end | |
68 | @content = @page.content_for_version(params[:version]) |
|
68 | @content = @page.content_for_version(params[:version]) | |
69 | if User.current.allowed_to?(:export_wiki_pages, @project) |
|
69 | if User.current.allowed_to?(:export_wiki_pages, @project) | |
70 | if params[:format] == 'html' |
|
70 | if params[:format] == 'html' | |
71 | export = render_to_string :action => 'export', :layout => false |
|
71 | export = render_to_string :action => 'export', :layout => false | |
72 | send_data(export, :type => 'text/html', :filename => "#{@page.title}.html") |
|
72 | send_data(export, :type => 'text/html', :filename => "#{@page.title}.html") | |
73 | return |
|
73 | return | |
74 | elsif params[:format] == 'txt' |
|
74 | elsif params[:format] == 'txt' | |
75 | send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt") |
|
75 | send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt") | |
76 | return |
|
76 | return | |
77 | end |
|
77 | end | |
78 | end |
|
78 | end | |
79 | @editable = editable? |
|
79 | @editable = editable? | |
80 | render :action => 'show' |
|
80 | render :action => 'show' | |
81 | end |
|
81 | end | |
82 |
|
82 | |||
83 | # edit an existing page or a new one |
|
83 | # edit an existing page or a new one | |
84 | def edit |
|
84 | def edit | |
85 | @page = @wiki.find_or_new_page(params[:page]) |
|
85 | @page = @wiki.find_or_new_page(params[:page]) | |
86 | return render_403 unless editable? |
|
86 | return render_403 unless editable? | |
87 | @page.content = WikiContent.new(:page => @page) if @page.new_record? |
|
87 | @page.content = WikiContent.new(:page => @page) if @page.new_record? | |
88 |
|
88 | |||
89 | @content = @page.content_for_version(params[:version]) |
|
89 | @content = @page.content_for_version(params[:version]) | |
90 | @content.text = initial_page_content(@page) if @content.text.blank? |
|
90 | @content.text = initial_page_content(@page) if @content.text.blank? | |
91 | # don't keep previous comment |
|
91 | # don't keep previous comment | |
92 | @content.comments = nil |
|
92 | @content.comments = nil | |
93 |
|
93 | |||
94 | # To prevent StaleObjectError exception when reverting to a previous version |
|
94 | # To prevent StaleObjectError exception when reverting to a previous version | |
95 | @content.version = @page.content.version |
|
95 | @content.version = @page.content.version | |
96 | rescue ActiveRecord::StaleObjectError |
|
96 | rescue ActiveRecord::StaleObjectError | |
97 | # Optimistic locking exception |
|
97 | # Optimistic locking exception | |
98 | flash[:error] = l(:notice_locking_conflict) |
|
98 | flash[:error] = l(:notice_locking_conflict) | |
99 | end |
|
99 | end | |
100 |
|
100 | |||
101 | verify :method => :post, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } |
|
101 | verify :method => :post, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } | |
102 | # Creates a new page or updates an existing one |
|
102 | # Creates a new page or updates an existing one | |
103 | def update |
|
103 | def update | |
104 | @page = @wiki.find_or_new_page(params[:page]) |
|
104 | @page = @wiki.find_or_new_page(params[:page]) | |
105 | return render_403 unless editable? |
|
105 | return render_403 unless editable? | |
106 | @page.content = WikiContent.new(:page => @page) if @page.new_record? |
|
106 | @page.content = WikiContent.new(:page => @page) if @page.new_record? | |
107 |
|
107 | |||
108 | @content = @page.content_for_version(params[:version]) |
|
108 | @content = @page.content_for_version(params[:version]) | |
109 | @content.text = initial_page_content(@page) if @content.text.blank? |
|
109 | @content.text = initial_page_content(@page) if @content.text.blank? | |
110 | # don't keep previous comment |
|
110 | # don't keep previous comment | |
111 | @content.comments = nil |
|
111 | @content.comments = nil | |
112 |
|
112 | |||
113 | if !@page.new_record? && params[:content].present? && @content.text == params[:content][:text] |
|
113 | if !@page.new_record? && params[:content].present? && @content.text == params[:content][:text] | |
114 | attachments = Attachment.attach_files(@page, params[:attachments]) |
|
114 | attachments = Attachment.attach_files(@page, params[:attachments]) | |
115 | render_attachment_warning_if_needed(@page) |
|
115 | render_attachment_warning_if_needed(@page) | |
116 | # don't save if text wasn't changed |
|
116 | # don't save if text wasn't changed | |
117 | redirect_to :action => 'show', :project_id => @project, :page => @page.title |
|
117 | redirect_to :action => 'show', :project_id => @project, :page => @page.title | |
118 | return |
|
118 | return | |
119 | end |
|
119 | end | |
120 | @content.attributes = params[:content] |
|
120 | @content.attributes = params[:content] | |
121 | @content.author = User.current |
|
121 | @content.author = User.current | |
122 | # if page is new @page.save will also save content, but not if page isn't a new record |
|
122 | # if page is new @page.save will also save content, but not if page isn't a new record | |
123 | if (@page.new_record? ? @page.save : @content.save) |
|
123 | if (@page.new_record? ? @page.save : @content.save) | |
124 | attachments = Attachment.attach_files(@page, params[:attachments]) |
|
124 | attachments = Attachment.attach_files(@page, params[:attachments]) | |
125 | render_attachment_warning_if_needed(@page) |
|
125 | render_attachment_warning_if_needed(@page) | |
126 | call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page}) |
|
126 | call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page}) | |
127 | redirect_to :action => 'show', :project_id => @project, :page => @page.title |
|
127 | redirect_to :action => 'show', :project_id => @project, :page => @page.title | |
128 | end |
|
128 | end | |
129 |
|
129 | |||
130 | rescue ActiveRecord::StaleObjectError |
|
130 | rescue ActiveRecord::StaleObjectError | |
131 | # Optimistic locking exception |
|
131 | # Optimistic locking exception | |
132 | flash[:error] = l(:notice_locking_conflict) |
|
132 | flash[:error] = l(:notice_locking_conflict) | |
133 | end |
|
133 | end | |
134 |
|
134 | |||
135 | # rename a page |
|
135 | # rename a page | |
136 | def rename |
|
136 | def rename | |
137 | return render_403 unless editable? |
|
137 | return render_403 unless editable? | |
138 | @page.redirect_existing_links = true |
|
138 | @page.redirect_existing_links = true | |
139 | # used to display the *original* title if some AR validation errors occur |
|
139 | # used to display the *original* title if some AR validation errors occur | |
140 | @original_title = @page.pretty_title |
|
140 | @original_title = @page.pretty_title | |
141 | if request.post? && @page.update_attributes(params[:wiki_page]) |
|
141 | if request.post? && @page.update_attributes(params[:wiki_page]) | |
142 | flash[:notice] = l(:notice_successful_update) |
|
142 | flash[:notice] = l(:notice_successful_update) | |
143 | redirect_to :action => 'show', :project_id => @project, :page => @page.title |
|
143 | redirect_to :action => 'show', :project_id => @project, :page => @page.title | |
144 | end |
|
144 | end | |
145 | end |
|
145 | end | |
146 |
|
146 | |||
147 | def protect |
|
147 | def protect | |
148 | @page.update_attribute :protected, params[:protected] |
|
148 | @page.update_attribute :protected, params[:protected] | |
149 | redirect_to :action => 'show', :project_id => @project, :page => @page.title |
|
149 | redirect_to :action => 'show', :project_id => @project, :page => @page.title | |
150 | end |
|
150 | end | |
151 |
|
151 | |||
152 | # show page history |
|
152 | # show page history | |
153 | def history |
|
153 | def history | |
154 | @version_count = @page.content.versions.count |
|
154 | @version_count = @page.content.versions.count | |
155 | @version_pages = Paginator.new self, @version_count, per_page_option, params['p'] |
|
155 | @version_pages = Paginator.new self, @version_count, per_page_option, params['p'] | |
156 | # don't load text |
|
156 | # don't load text | |
157 | @versions = @page.content.versions.find :all, |
|
157 | @versions = @page.content.versions.find :all, | |
158 | :select => "id, author_id, comments, updated_on, version", |
|
158 | :select => "id, author_id, comments, updated_on, version", | |
159 | :order => 'version DESC', |
|
159 | :order => 'version DESC', | |
160 | :limit => @version_pages.items_per_page + 1, |
|
160 | :limit => @version_pages.items_per_page + 1, | |
161 | :offset => @version_pages.current.offset |
|
161 | :offset => @version_pages.current.offset | |
162 |
|
162 | |||
163 | render :layout => false if request.xhr? |
|
163 | render :layout => false if request.xhr? | |
164 | end |
|
164 | end | |
165 |
|
165 | |||
166 | def diff |
|
166 | def diff | |
167 | @diff = @page.diff(params[:version], params[:version_from]) |
|
167 | @diff = @page.diff(params[:version], params[:version_from]) | |
168 | render_404 unless @diff |
|
168 | render_404 unless @diff | |
169 | end |
|
169 | end | |
170 |
|
170 | |||
171 | def annotate |
|
171 | def annotate | |
172 | @annotate = @page.annotate(params[:version]) |
|
172 | @annotate = @page.annotate(params[:version]) | |
173 | render_404 unless @annotate |
|
173 | render_404 unless @annotate | |
174 | end |
|
174 | end | |
175 |
|
175 | |||
|
176 | verify :method => :delete, :only => [:destroy], :redirect_to => { :action => :show } | |||
176 | # Removes a wiki page and its history |
|
177 | # Removes a wiki page and its history | |
177 | # Children can be either set as root pages, removed or reassigned to another parent page |
|
178 | # Children can be either set as root pages, removed or reassigned to another parent page | |
178 | def destroy |
|
179 | def destroy | |
179 | return render_403 unless editable? |
|
180 | return render_403 unless editable? | |
180 |
|
181 | |||
181 | @descendants_count = @page.descendants.size |
|
182 | @descendants_count = @page.descendants.size | |
182 | if @descendants_count > 0 |
|
183 | if @descendants_count > 0 | |
183 | case params[:todo] |
|
184 | case params[:todo] | |
184 | when 'nullify' |
|
185 | when 'nullify' | |
185 | # Nothing to do |
|
186 | # Nothing to do | |
186 | when 'destroy' |
|
187 | when 'destroy' | |
187 | # Removes all its descendants |
|
188 | # Removes all its descendants | |
188 | @page.descendants.each(&:destroy) |
|
189 | @page.descendants.each(&:destroy) | |
189 | when 'reassign' |
|
190 | when 'reassign' | |
190 | # Reassign children to another parent page |
|
191 | # Reassign children to another parent page | |
191 | reassign_to = @wiki.pages.find_by_id(params[:reassign_to_id].to_i) |
|
192 | reassign_to = @wiki.pages.find_by_id(params[:reassign_to_id].to_i) | |
192 | return unless reassign_to |
|
193 | return unless reassign_to | |
193 | @page.children.each do |child| |
|
194 | @page.children.each do |child| | |
194 | child.update_attribute(:parent, reassign_to) |
|
195 | child.update_attribute(:parent, reassign_to) | |
195 | end |
|
196 | end | |
196 | else |
|
197 | else | |
197 | @reassignable_to = @wiki.pages - @page.self_and_descendants |
|
198 | @reassignable_to = @wiki.pages - @page.self_and_descendants | |
198 | return |
|
199 | return | |
199 | end |
|
200 | end | |
200 | end |
|
201 | end | |
201 | @page.destroy |
|
202 | @page.destroy | |
202 | redirect_to :action => 'index', :project_id => @project |
|
203 | redirect_to :action => 'index', :project_id => @project | |
203 | end |
|
204 | end | |
204 |
|
205 | |||
205 | # Export wiki to a single html file |
|
206 | # Export wiki to a single html file | |
206 | def export |
|
207 | def export | |
207 | if User.current.allowed_to?(:export_wiki_pages, @project) |
|
208 | if User.current.allowed_to?(:export_wiki_pages, @project) | |
208 | @pages = @wiki.pages.find :all, :order => 'title' |
|
209 | @pages = @wiki.pages.find :all, :order => 'title' | |
209 | export = render_to_string :action => 'export_multiple', :layout => false |
|
210 | export = render_to_string :action => 'export_multiple', :layout => false | |
210 | send_data(export, :type => 'text/html', :filename => "wiki.html") |
|
211 | send_data(export, :type => 'text/html', :filename => "wiki.html") | |
211 | else |
|
212 | else | |
212 | redirect_to :action => 'show', :project_id => @project, :page => nil |
|
213 | redirect_to :action => 'show', :project_id => @project, :page => nil | |
213 | end |
|
214 | end | |
214 | end |
|
215 | end | |
215 |
|
216 | |||
216 | def date_index |
|
217 | def date_index | |
217 | load_pages_grouped_by_date_without_content |
|
218 | load_pages_grouped_by_date_without_content | |
218 | end |
|
219 | end | |
219 |
|
220 | |||
220 | def preview |
|
221 | def preview | |
221 | page = @wiki.find_page(params[:page]) |
|
222 | page = @wiki.find_page(params[:page]) | |
222 | # page is nil when previewing a new page |
|
223 | # page is nil when previewing a new page | |
223 | return render_403 unless page.nil? || editable?(page) |
|
224 | return render_403 unless page.nil? || editable?(page) | |
224 | if page |
|
225 | if page | |
225 | @attachements = page.attachments |
|
226 | @attachements = page.attachments | |
226 | @previewed = page.content |
|
227 | @previewed = page.content | |
227 | end |
|
228 | end | |
228 | @text = params[:content][:text] |
|
229 | @text = params[:content][:text] | |
229 | render :partial => 'common/preview' |
|
230 | render :partial => 'common/preview' | |
230 | end |
|
231 | end | |
231 |
|
232 | |||
232 | def add_attachment |
|
233 | def add_attachment | |
233 | return render_403 unless editable? |
|
234 | return render_403 unless editable? | |
234 | attachments = Attachment.attach_files(@page, params[:attachments]) |
|
235 | attachments = Attachment.attach_files(@page, params[:attachments]) | |
235 | render_attachment_warning_if_needed(@page) |
|
236 | render_attachment_warning_if_needed(@page) | |
236 | redirect_to :action => 'show', :page => @page.title |
|
237 | redirect_to :action => 'show', :page => @page.title | |
237 | end |
|
238 | end | |
238 |
|
239 | |||
239 | private |
|
240 | private | |
240 |
|
241 | |||
241 | def find_wiki |
|
242 | def find_wiki | |
242 | @project = Project.find(params[:project_id]) |
|
243 | @project = Project.find(params[:project_id]) | |
243 | @wiki = @project.wiki |
|
244 | @wiki = @project.wiki | |
244 | render_404 unless @wiki |
|
245 | render_404 unless @wiki | |
245 | rescue ActiveRecord::RecordNotFound |
|
246 | rescue ActiveRecord::RecordNotFound | |
246 | render_404 |
|
247 | render_404 | |
247 | end |
|
248 | end | |
248 |
|
249 | |||
249 | # Finds the requested page and returns a 404 error if it doesn't exist |
|
250 | # Finds the requested page and returns a 404 error if it doesn't exist | |
250 | def find_existing_page |
|
251 | def find_existing_page | |
251 | @page = @wiki.find_page(params[:page]) |
|
252 | @page = @wiki.find_page(params[:page]) | |
252 | render_404 if @page.nil? |
|
253 | render_404 if @page.nil? | |
253 | end |
|
254 | end | |
254 |
|
255 | |||
255 | # Returns true if the current user is allowed to edit the page, otherwise false |
|
256 | # Returns true if the current user is allowed to edit the page, otherwise false | |
256 | def editable?(page = @page) |
|
257 | def editable?(page = @page) | |
257 | page.editable_by?(User.current) |
|
258 | page.editable_by?(User.current) | |
258 | end |
|
259 | end | |
259 |
|
260 | |||
260 | # Returns the default content of a new wiki page |
|
261 | # Returns the default content of a new wiki page | |
261 | def initial_page_content(page) |
|
262 | def initial_page_content(page) | |
262 | helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting) |
|
263 | helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting) | |
263 | extend helper unless self.instance_of?(helper) |
|
264 | extend helper unless self.instance_of?(helper) | |
264 | helper.instance_method(:initial_page_content).bind(self).call(page) |
|
265 | helper.instance_method(:initial_page_content).bind(self).call(page) | |
265 | end |
|
266 | end | |
266 |
|
267 | |||
267 | # eager load information about last updates, without loading text |
|
268 | # eager load information about last updates, without loading text | |
268 | def load_pages_grouped_by_date_without_content |
|
269 | def load_pages_grouped_by_date_without_content | |
269 | @pages = @wiki.pages.find :all, :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on", |
|
270 | @pages = @wiki.pages.find :all, :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on", | |
270 | :joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id", |
|
271 | :joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id", | |
271 | :order => 'title' |
|
272 | :order => 'title' | |
272 | @pages_by_date = @pages.group_by {|p| p.updated_on.to_date} |
|
273 | @pages_by_date = @pages.group_by {|p| p.updated_on.to_date} | |
273 | @pages_by_parent_id = @pages.group_by(&:parent_id) |
|
274 | @pages_by_parent_id = @pages.group_by(&:parent_id) | |
274 | end |
|
275 | end | |
275 |
|
276 | |||
276 | end |
|
277 | end |
@@ -1,19 +1,19 | |||||
1 | <h2><%=h @page.pretty_title %></h2> |
|
1 | <h2><%=h @page.pretty_title %></h2> | |
2 |
|
2 | |||
3 | <% form_tag({}) do %> |
|
3 | <% form_tag({}, :method => :delete) do %> | |
4 | <div class="box"> |
|
4 | <div class="box"> | |
5 | <p><strong><%= l(:text_wiki_page_destroy_question, :descendants => @descendants_count) %></strong></p> |
|
5 | <p><strong><%= l(:text_wiki_page_destroy_question, :descendants => @descendants_count) %></strong></p> | |
6 | <p><label><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_wiki_page_nullify_children) %></label><br /> |
|
6 | <p><label><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_wiki_page_nullify_children) %></label><br /> | |
7 | <label><%= radio_button_tag 'todo', 'destroy', false %> <%= l(:text_wiki_page_destroy_children) %></label> |
|
7 | <label><%= radio_button_tag 'todo', 'destroy', false %> <%= l(:text_wiki_page_destroy_children) %></label> | |
8 | <% if @reassignable_to.any? %> |
|
8 | <% if @reassignable_to.any? %> | |
9 | <br /> |
|
9 | <br /> | |
10 | <label><%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_wiki_page_reassign_children) %></label>: |
|
10 | <label><%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_wiki_page_reassign_children) %></label>: | |
11 | <%= select_tag 'reassign_to_id', wiki_page_options_for_select(@reassignable_to), |
|
11 | <%= select_tag 'reassign_to_id', wiki_page_options_for_select(@reassignable_to), | |
12 | :onclick => "$('todo_reassign').checked = true;" %> |
|
12 | :onclick => "$('todo_reassign').checked = true;" %> | |
13 | <% end %> |
|
13 | <% end %> | |
14 | </p> |
|
14 | </p> | |
15 | </div> |
|
15 | </div> | |
16 |
|
16 | |||
17 | <%= submit_tag l(:button_apply) %> |
|
17 | <%= submit_tag l(:button_apply) %> | |
18 | <%= link_to l(:button_cancel), :controller => 'wiki', :action => 'show', :project_id => @project, :page => @page.title %> |
|
18 | <%= link_to l(:button_cancel), :controller => 'wiki', :action => 'show', :project_id => @project, :page => @page.title %> | |
19 | <% end %> |
|
19 | <% end %> |
@@ -1,61 +1,61 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <% if @editable %> |
|
2 | <% if @editable %> | |
3 | <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %> |
|
3 | <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %> | |
4 | <%= watcher_tag(@page, User.current) %> |
|
4 | <%= watcher_tag(@page, User.current) %> | |
5 | <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :page => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> |
|
5 | <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :page => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> | |
6 | <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :page => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> |
|
6 | <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :page => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> | |
7 | <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> |
|
7 | <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> | |
8 |
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => : |
|
8 | <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> | |
9 | <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> |
|
9 | <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> | |
10 | <% end %> |
|
10 | <% end %> | |
11 | <%= link_to_if_authorized(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %> |
|
11 | <%= link_to_if_authorized(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %> | |
12 | </div> |
|
12 | </div> | |
13 |
|
13 | |||
14 | <%= breadcrumb(@page.ancestors.reverse.collect {|parent| link_to h(parent.pretty_title), {:page => parent.title}}) %> |
|
14 | <%= breadcrumb(@page.ancestors.reverse.collect {|parent| link_to h(parent.pretty_title), {:page => parent.title}}) %> | |
15 |
|
15 | |||
16 | <% if @content.version != @page.content.version %> |
|
16 | <% if @content.version != @page.content.version %> | |
17 | <p> |
|
17 | <p> | |
18 | <%= link_to(('« ' + l(:label_previous)), :action => 'show', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %> |
|
18 | <%= link_to(('« ' + l(:label_previous)), :action => 'show', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %> | |
19 | <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> |
|
19 | <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> | |
20 | <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :page => @page.title, :version => @content.version) + ')' if @content.version > 1 %> - |
|
20 | <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :page => @page.title, :version => @content.version) + ')' if @content.version > 1 %> - | |
21 | <%= link_to((l(:label_next) + ' »'), :action => 'show', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> |
|
21 | <%= link_to((l(:label_next) + ' »'), :action => 'show', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> | |
22 | <%= link_to(l(:label_current_version), :action => 'show', :page => @page.title) %> |
|
22 | <%= link_to(l(:label_current_version), :action => 'show', :page => @page.title) %> | |
23 | <br /> |
|
23 | <br /> | |
24 | <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br /> |
|
24 | <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br /> | |
25 | <%=h @content.comments %> |
|
25 | <%=h @content.comments %> | |
26 | </p> |
|
26 | </p> | |
27 | <hr /> |
|
27 | <hr /> | |
28 | <% end %> |
|
28 | <% end %> | |
29 |
|
29 | |||
30 | <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> |
|
30 | <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> | |
31 |
|
31 | |||
32 | <%= link_to_attachments @page %> |
|
32 | <%= link_to_attachments @page %> | |
33 |
|
33 | |||
34 | <% if @editable && authorize_for('wiki', 'add_attachment') %> |
|
34 | <% if @editable && authorize_for('wiki', 'add_attachment') %> | |
35 | <div id="wiki_add_attachment"> |
|
35 | <div id="wiki_add_attachment"> | |
36 | <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", |
|
36 | <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", | |
37 | :id => 'attach_files_link' %></p> |
|
37 | :id => 'attach_files_link' %></p> | |
38 | <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :page => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> |
|
38 | <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :page => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> | |
39 | <div class="box"> |
|
39 | <div class="box"> | |
40 | <p><%= render :partial => 'attachments/form' %></p> |
|
40 | <p><%= render :partial => 'attachments/form' %></p> | |
41 | </div> |
|
41 | </div> | |
42 | <%= submit_tag l(:button_add) %> |
|
42 | <%= submit_tag l(:button_add) %> | |
43 | <%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %> |
|
43 | <%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %> | |
44 | <% end %> |
|
44 | <% end %> | |
45 | </div> |
|
45 | </div> | |
46 | <% end %> |
|
46 | <% end %> | |
47 |
|
47 | |||
48 | <% other_formats_links do |f| %> |
|
48 | <% other_formats_links do |f| %> | |
49 | <%= f.link_to 'HTML', :url => {:page => @page.title, :version => @content.version} %> |
|
49 | <%= f.link_to 'HTML', :url => {:page => @page.title, :version => @content.version} %> | |
50 | <%= f.link_to 'TXT', :url => {:page => @page.title, :version => @content.version} %> |
|
50 | <%= f.link_to 'TXT', :url => {:page => @page.title, :version => @content.version} %> | |
51 | <% end if User.current.allowed_to?(:export_wiki_pages, @project) %> |
|
51 | <% end if User.current.allowed_to?(:export_wiki_pages, @project) %> | |
52 |
|
52 | |||
53 | <% content_for :header_tags do %> |
|
53 | <% content_for :header_tags do %> | |
54 | <%= stylesheet_link_tag 'scm' %> |
|
54 | <%= stylesheet_link_tag 'scm' %> | |
55 | <% end %> |
|
55 | <% end %> | |
56 |
|
56 | |||
57 | <% content_for :sidebar do %> |
|
57 | <% content_for :sidebar do %> | |
58 | <%= render :partial => 'sidebar' %> |
|
58 | <%= render :partial => 'sidebar' %> | |
59 | <% end %> |
|
59 | <% end %> | |
60 |
|
60 | |||
61 | <% html_title @page.pretty_title %> |
|
61 | <% html_title @page.pretty_title %> |
@@ -1,250 +1,252 | |||||
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 'projects/:project_id/time_entries/report', :controller => 'time_entry_reports', :action => 'report' |
|
17 | map.connect 'projects/:project_id/time_entries/report', :controller => 'time_entry_reports', :action => 'report' | |
18 | map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| |
|
18 | map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| | |
19 | time_report.connect 'time_entries/report' |
|
19 | time_report.connect 'time_entries/report' | |
20 | time_report.connect 'time_entries/report.:format' |
|
20 | time_report.connect 'time_entries/report.:format' | |
21 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
21 | time_report.connect 'projects/:project_id/time_entries/report.:format' | |
22 | end |
|
22 | end | |
23 |
|
23 | |||
24 | # TODO: wasteful since this is also nested under issues, projects, and projects/issues |
|
24 | # TODO: wasteful since this is also nested under issues, projects, and projects/issues | |
25 | map.resources :time_entries, :controller => 'timelog' |
|
25 | map.resources :time_entries, :controller => 'timelog' | |
26 |
|
26 | |||
27 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
27 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} | |
28 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
28 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} | |
29 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} |
|
29 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} | |
30 | map.with_options :controller => 'wiki' do |wiki_routes| |
|
30 | map.with_options :controller => 'wiki' do |wiki_routes| | |
31 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| |
|
31 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| | |
32 | wiki_views.connect 'projects/:project_id/wiki/export', :action => 'export' |
|
32 | wiki_views.connect 'projects/:project_id/wiki/export', :action => 'export' | |
33 | wiki_views.connect 'projects/:project_id/wiki/index', :action => 'index' |
|
33 | wiki_views.connect 'projects/:project_id/wiki/index', :action => 'index' | |
34 | wiki_views.connect 'projects/:project_id/wiki/date_index', :action => 'date_index' |
|
34 | wiki_views.connect 'projects/:project_id/wiki/date_index', :action => 'date_index' | |
35 | wiki_views.connect 'projects/:project_id/wiki/:page', :action => 'show', :page => nil |
|
35 | wiki_views.connect 'projects/:project_id/wiki/:page', :action => 'show', :page => nil | |
36 | wiki_views.connect 'projects/:project_id/wiki/:page/edit', :action => 'edit' |
|
36 | wiki_views.connect 'projects/:project_id/wiki/:page/edit', :action => 'edit' | |
37 | wiki_views.connect 'projects/:project_id/wiki/:page/rename', :action => 'rename' |
|
37 | wiki_views.connect 'projects/:project_id/wiki/:page/rename', :action => 'rename' | |
38 | wiki_views.connect 'projects/:project_id/wiki/:page/history', :action => 'history' |
|
38 | wiki_views.connect 'projects/:project_id/wiki/:page/history', :action => 'history' | |
39 | wiki_views.connect 'projects/:project_id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' |
|
39 | wiki_views.connect 'projects/:project_id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' | |
40 | wiki_views.connect 'projects/:project_id/wiki/:page/annotate/:version', :action => 'annotate' |
|
40 | wiki_views.connect 'projects/:project_id/wiki/:page/annotate/:version', :action => 'annotate' | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | wiki_routes.connect 'projects/:project_id/wiki/:page/:action', |
|
43 | wiki_routes.connect 'projects/:project_id/wiki/:page/:action', | |
44 |
:action => /rename| |
|
44 | :action => /rename|preview|protect|add_attachment/, | |
45 | :conditions => {:method => :post} |
|
45 | :conditions => {:method => :post} | |
46 |
|
46 | |||
47 | wiki_routes.connect 'projects/:project_id/wiki/:page/edit', :action => 'update', :conditions => {:method => :post} |
|
47 | wiki_routes.connect 'projects/:project_id/wiki/:page/edit', :action => 'update', :conditions => {:method => :post} | |
|
48 | ||||
|
49 | wiki_routes.connect 'projects/:project_id/wiki/:page', :action => 'destroy', :conditions => {:method => :delete} | |||
48 | end |
|
50 | end | |
49 |
|
51 | |||
50 | map.with_options :controller => 'messages' do |messages_routes| |
|
52 | map.with_options :controller => 'messages' do |messages_routes| | |
51 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
53 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| | |
52 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
54 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' | |
53 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
55 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' | |
54 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
56 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | |
55 | end |
|
57 | end | |
56 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
58 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| | |
57 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
59 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' | |
58 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
60 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' | |
59 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ |
|
61 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ | |
60 | end |
|
62 | end | |
61 | end |
|
63 | end | |
62 |
|
64 | |||
63 | map.with_options :controller => 'boards' do |board_routes| |
|
65 | map.with_options :controller => 'boards' do |board_routes| | |
64 | board_routes.with_options :conditions => {:method => :get} do |board_views| |
|
66 | board_routes.with_options :conditions => {:method => :get} do |board_views| | |
65 | board_views.connect 'projects/:project_id/boards', :action => 'index' |
|
67 | board_views.connect 'projects/:project_id/boards', :action => 'index' | |
66 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' |
|
68 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' | |
67 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' |
|
69 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' | |
68 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' |
|
70 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' | |
69 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' |
|
71 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' | |
70 | end |
|
72 | end | |
71 | board_routes.with_options :conditions => {:method => :post} do |board_actions| |
|
73 | board_routes.with_options :conditions => {:method => :post} do |board_actions| | |
72 | board_actions.connect 'projects/:project_id/boards', :action => 'new' |
|
74 | board_actions.connect 'projects/:project_id/boards', :action => 'new' | |
73 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ |
|
75 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ | |
74 | end |
|
76 | end | |
75 | end |
|
77 | end | |
76 |
|
78 | |||
77 | map.with_options :controller => 'documents' do |document_routes| |
|
79 | map.with_options :controller => 'documents' do |document_routes| | |
78 | document_routes.with_options :conditions => {:method => :get} do |document_views| |
|
80 | document_routes.with_options :conditions => {:method => :get} do |document_views| | |
79 | document_views.connect 'projects/:project_id/documents', :action => 'index' |
|
81 | document_views.connect 'projects/:project_id/documents', :action => 'index' | |
80 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' |
|
82 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' | |
81 | document_views.connect 'documents/:id', :action => 'show' |
|
83 | document_views.connect 'documents/:id', :action => 'show' | |
82 | document_views.connect 'documents/:id/edit', :action => 'edit' |
|
84 | document_views.connect 'documents/:id/edit', :action => 'edit' | |
83 | end |
|
85 | end | |
84 | document_routes.with_options :conditions => {:method => :post} do |document_actions| |
|
86 | document_routes.with_options :conditions => {:method => :post} do |document_actions| | |
85 | document_actions.connect 'projects/:project_id/documents', :action => 'new' |
|
87 | document_actions.connect 'projects/:project_id/documents', :action => 'new' | |
86 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ |
|
88 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ | |
87 | end |
|
89 | end | |
88 | end |
|
90 | end | |
89 |
|
91 | |||
90 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' |
|
92 | map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' | |
91 |
|
93 | |||
92 | # Misc issue routes. TODO: move into resources |
|
94 | # Misc issue routes. TODO: move into resources | |
93 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' |
|
95 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' | |
94 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview |
|
96 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview | |
95 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' |
|
97 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' | |
96 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' |
|
98 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' | |
97 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } |
|
99 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } | |
98 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } |
|
100 | map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } | |
99 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } |
|
101 | map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } | |
100 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy |
|
102 | map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy | |
101 |
|
103 | |||
102 | map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update] |
|
104 | map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update] | |
103 | map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update] |
|
105 | map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update] | |
104 | map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update] |
|
106 | map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update] | |
105 | map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update] |
|
107 | map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update] | |
106 |
|
108 | |||
107 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| |
|
109 | map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| | |
108 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' |
|
110 | reports.connect 'projects/:id/issues/report', :action => 'issue_report' | |
109 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' |
|
111 | reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' | |
110 | end |
|
112 | end | |
111 |
|
113 | |||
112 | # Following two routes conflict with the resources because #index allows POST |
|
114 | # Following two routes conflict with the resources because #index allows POST | |
113 | map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
115 | map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } | |
114 | map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } |
|
116 | map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } | |
115 |
|
117 | |||
116 | map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues| |
|
118 | map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues| | |
117 | issues.resources :time_entries, :controller => 'timelog' |
|
119 | issues.resources :time_entries, :controller => 'timelog' | |
118 | end |
|
120 | end | |
119 |
|
121 | |||
120 | map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues| |
|
122 | map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues| | |
121 | issues.resources :time_entries, :controller => 'timelog' |
|
123 | issues.resources :time_entries, :controller => 'timelog' | |
122 | end |
|
124 | end | |
123 |
|
125 | |||
124 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| |
|
126 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| | |
125 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' |
|
127 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' | |
126 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' |
|
128 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' | |
127 | end |
|
129 | end | |
128 |
|
130 | |||
129 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
131 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' | |
130 |
|
132 | |||
131 | map.with_options :controller => 'users' do |users| |
|
133 | map.with_options :controller => 'users' do |users| | |
132 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} |
|
134 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} | |
133 |
|
135 | |||
134 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
136 | users.with_options :conditions => {:method => :post} do |user_actions| | |
135 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
137 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' | |
136 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
138 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' | |
137 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
139 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' | |
138 | end |
|
140 | end | |
139 | end |
|
141 | end | |
140 |
|
142 | |||
141 | map.resources :users, :member => { |
|
143 | map.resources :users, :member => { | |
142 | :edit_membership => :post, |
|
144 | :edit_membership => :post, | |
143 | :destroy_membership => :post |
|
145 | :destroy_membership => :post | |
144 | }, |
|
146 | }, | |
145 | :except => [:destroy] |
|
147 | :except => [:destroy] | |
146 |
|
148 | |||
147 | # For nice "roadmap" in the url for the index action |
|
149 | # For nice "roadmap" in the url for the index action | |
148 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' |
|
150 | map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' | |
149 |
|
151 | |||
150 | map.all_news 'news', :controller => 'news', :action => 'index' |
|
152 | map.all_news 'news', :controller => 'news', :action => 'index' | |
151 | map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' |
|
153 | map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' | |
152 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' |
|
154 | map.preview_news '/news/preview', :controller => 'previews', :action => 'news' | |
153 | map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} |
|
155 | map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} | |
154 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} |
|
156 | map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} | |
155 |
|
157 | |||
156 | map.resources :projects, :member => { |
|
158 | map.resources :projects, :member => { | |
157 | :copy => [:get, :post], |
|
159 | :copy => [:get, :post], | |
158 | :settings => :get, |
|
160 | :settings => :get, | |
159 | :modules => :post, |
|
161 | :modules => :post, | |
160 | :archive => :post, |
|
162 | :archive => :post, | |
161 | :unarchive => :post |
|
163 | :unarchive => :post | |
162 | } do |project| |
|
164 | } do |project| | |
163 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] |
|
165 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] | |
164 | project.resources :files, :only => [:index, :new, :create] |
|
166 | project.resources :files, :only => [:index, :new, :create] | |
165 | project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post} |
|
167 | project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post} | |
166 | project.resources :news, :shallow => true |
|
168 | project.resources :news, :shallow => true | |
167 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' |
|
169 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' | |
168 |
|
170 | |||
169 |
|
171 | |||
170 | end |
|
172 | end | |
171 |
|
173 | |||
172 | # Destroy uses a get request to prompt the user before the actual DELETE request |
|
174 | # Destroy uses a get request to prompt the user before the actual DELETE request | |
173 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} |
|
175 | map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} | |
174 |
|
176 | |||
175 | # TODO: port to be part of the resources route(s) |
|
177 | # TODO: port to be part of the resources route(s) | |
176 | map.with_options :controller => 'projects' do |project_mapper| |
|
178 | map.with_options :controller => 'projects' do |project_mapper| | |
177 | project_mapper.with_options :conditions => {:method => :get} do |project_views| |
|
179 | project_mapper.with_options :conditions => {:method => :get} do |project_views| | |
178 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' |
|
180 | project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' | |
179 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' |
|
181 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' | |
180 | end |
|
182 | end | |
181 | end |
|
183 | end | |
182 |
|
184 | |||
183 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| |
|
185 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| | |
184 | activity.connect 'projects/:id/activity' |
|
186 | activity.connect 'projects/:id/activity' | |
185 | activity.connect 'projects/:id/activity.:format' |
|
187 | activity.connect 'projects/:id/activity.:format' | |
186 | activity.connect 'activity', :id => nil |
|
188 | activity.connect 'activity', :id => nil | |
187 | activity.connect 'activity.:format', :id => nil |
|
189 | activity.connect 'activity.:format', :id => nil | |
188 | end |
|
190 | end | |
189 |
|
191 | |||
190 |
|
192 | |||
191 | map.with_options :controller => 'issue_categories' do |categories| |
|
193 | map.with_options :controller => 'issue_categories' do |categories| | |
192 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' |
|
194 | categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' | |
193 | end |
|
195 | end | |
194 |
|
196 | |||
195 | map.with_options :controller => 'repositories' do |repositories| |
|
197 | map.with_options :controller => 'repositories' do |repositories| | |
196 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
198 | repositories.with_options :conditions => {:method => :get} do |repository_views| | |
197 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
199 | repository_views.connect 'projects/:id/repository', :action => 'show' | |
198 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
200 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' | |
199 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
201 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' | |
200 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
202 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' | |
201 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
203 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' | |
202 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
204 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' | |
203 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
205 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' | |
204 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
206 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' | |
205 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
207 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
206 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } |
|
208 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | |
207 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' |
|
209 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' | |
208 | # TODO: why the following route is required? |
|
210 | # TODO: why the following route is required? | |
209 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' |
|
211 | repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' | |
210 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
212 | repository_views.connect 'projects/:id/repository/:action/*path' | |
211 | end |
|
213 | end | |
212 |
|
214 | |||
213 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
215 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} | |
214 | end |
|
216 | end | |
215 |
|
217 | |||
216 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ |
|
218 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ | |
217 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
219 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ | |
218 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
220 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ | |
219 |
|
221 | |||
220 | map.resources :groups |
|
222 | map.resources :groups | |
221 |
|
223 | |||
222 | #left old routes at the bottom for backwards compat |
|
224 | #left old routes at the bottom for backwards compat | |
223 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' |
|
225 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' | |
224 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' |
|
226 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' | |
225 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' |
|
227 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' | |
226 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
228 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' | |
227 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
229 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' | |
228 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' |
|
230 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' | |
229 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
231 | map.connect 'projects/:project_id/news/:action', :controller => 'news' | |
230 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
232 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ | |
231 | map.with_options :controller => 'repositories' do |omap| |
|
233 | map.with_options :controller => 'repositories' do |omap| | |
232 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
234 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' | |
233 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
235 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' | |
234 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
236 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' | |
235 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
237 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' | |
236 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
238 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' | |
237 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
239 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' | |
238 | end |
|
240 | end | |
239 |
|
241 | |||
240 | map.with_options :controller => 'sys' do |sys| |
|
242 | map.with_options :controller => 'sys' do |sys| | |
241 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
243 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} | |
242 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
244 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} | |
243 | end |
|
245 | end | |
244 |
|
246 | |||
245 | # Install the default route as the lowest priority. |
|
247 | # Install the default route as the lowest priority. | |
246 | map.connect ':controller/:action/:id' |
|
248 | map.connect ':controller/:action/:id' | |
247 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
249 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' | |
248 | # Used for OpenID |
|
250 | # Used for OpenID | |
249 | map.root :controller => 'account', :action => 'login' |
|
251 | map.root :controller => 'account', :action => 'login' | |
250 | end |
|
252 | end |
@@ -1,365 +1,365 | |||||
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 'wiki_controller' |
|
19 | require 'wiki_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class WikiController; def rescue_action(e) raise e end; end |
|
22 | class WikiController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class WikiControllerTest < ActionController::TestCase |
|
24 | class WikiControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = WikiController.new |
|
28 | @controller = WikiController.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_show_start_page |
|
34 | def test_show_start_page | |
35 | get :show, :project_id => 'ecookbook' |
|
35 | get :show, :project_id => 'ecookbook' | |
36 | assert_response :success |
|
36 | assert_response :success | |
37 | assert_template 'show' |
|
37 | assert_template 'show' | |
38 | assert_tag :tag => 'h1', :content => /CookBook documentation/ |
|
38 | assert_tag :tag => 'h1', :content => /CookBook documentation/ | |
39 |
|
39 | |||
40 | # child_pages macro |
|
40 | # child_pages macro | |
41 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, |
|
41 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, | |
42 | :child => { :tag => 'li', |
|
42 | :child => { :tag => 'li', | |
43 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, |
|
43 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, | |
44 | :content => 'Page with an inline image' } } |
|
44 | :content => 'Page with an inline image' } } | |
45 | end |
|
45 | end | |
46 |
|
46 | |||
47 | def test_show_page_with_name |
|
47 | def test_show_page_with_name | |
48 | get :show, :project_id => 1, :page => 'Another_page' |
|
48 | get :show, :project_id => 1, :page => 'Another_page' | |
49 | assert_response :success |
|
49 | assert_response :success | |
50 | assert_template 'show' |
|
50 | assert_template 'show' | |
51 | assert_tag :tag => 'h1', :content => /Another page/ |
|
51 | assert_tag :tag => 'h1', :content => /Another page/ | |
52 | # Included page with an inline image |
|
52 | # Included page with an inline image | |
53 | assert_tag :tag => 'p', :content => /This is an inline image/ |
|
53 | assert_tag :tag => 'p', :content => /This is an inline image/ | |
54 | assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', |
|
54 | assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', | |
55 | :alt => 'This is a logo' } |
|
55 | :alt => 'This is a logo' } | |
56 | end |
|
56 | end | |
57 |
|
57 | |||
58 | def test_show_with_sidebar |
|
58 | def test_show_with_sidebar | |
59 | page = Project.find(1).wiki.pages.new(:title => 'Sidebar') |
|
59 | page = Project.find(1).wiki.pages.new(:title => 'Sidebar') | |
60 | page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') |
|
60 | page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') | |
61 | page.save! |
|
61 | page.save! | |
62 |
|
62 | |||
63 | get :show, :project_id => 1, :page => 'Another_page' |
|
63 | get :show, :project_id => 1, :page => 'Another_page' | |
64 | assert_response :success |
|
64 | assert_response :success | |
65 | assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, |
|
65 | assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, | |
66 | :content => /Side bar content for test_show_with_sidebar/ |
|
66 | :content => /Side bar content for test_show_with_sidebar/ | |
67 | end |
|
67 | end | |
68 |
|
68 | |||
69 | def test_show_unexistent_page_without_edit_right |
|
69 | def test_show_unexistent_page_without_edit_right | |
70 | get :show, :project_id => 1, :page => 'Unexistent page' |
|
70 | get :show, :project_id => 1, :page => 'Unexistent page' | |
71 | assert_response 404 |
|
71 | assert_response 404 | |
72 | end |
|
72 | end | |
73 |
|
73 | |||
74 | def test_show_unexistent_page_with_edit_right |
|
74 | def test_show_unexistent_page_with_edit_right | |
75 | @request.session[:user_id] = 2 |
|
75 | @request.session[:user_id] = 2 | |
76 | get :show, :project_id => 1, :page => 'Unexistent page' |
|
76 | get :show, :project_id => 1, :page => 'Unexistent page' | |
77 | assert_response :success |
|
77 | assert_response :success | |
78 | assert_template 'edit' |
|
78 | assert_template 'edit' | |
79 | end |
|
79 | end | |
80 |
|
80 | |||
81 | def test_create_page |
|
81 | def test_create_page | |
82 | @request.session[:user_id] = 2 |
|
82 | @request.session[:user_id] = 2 | |
83 | post :update, :project_id => 1, |
|
83 | post :update, :project_id => 1, | |
84 | :page => 'New page', |
|
84 | :page => 'New page', | |
85 | :content => {:comments => 'Created the page', |
|
85 | :content => {:comments => 'Created the page', | |
86 | :text => "h1. New page\n\nThis is a new page", |
|
86 | :text => "h1. New page\n\nThis is a new page", | |
87 | :version => 0} |
|
87 | :version => 0} | |
88 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'New_page' |
|
88 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'New_page' | |
89 | page = Project.find(1).wiki.find_page('New page') |
|
89 | page = Project.find(1).wiki.find_page('New page') | |
90 | assert !page.new_record? |
|
90 | assert !page.new_record? | |
91 | assert_not_nil page.content |
|
91 | assert_not_nil page.content | |
92 | assert_equal 'Created the page', page.content.comments |
|
92 | assert_equal 'Created the page', page.content.comments | |
93 | end |
|
93 | end | |
94 |
|
94 | |||
95 | def test_create_page_with_attachments |
|
95 | def test_create_page_with_attachments | |
96 | @request.session[:user_id] = 2 |
|
96 | @request.session[:user_id] = 2 | |
97 | assert_difference 'WikiPage.count' do |
|
97 | assert_difference 'WikiPage.count' do | |
98 | assert_difference 'Attachment.count' do |
|
98 | assert_difference 'Attachment.count' do | |
99 | post :update, :project_id => 1, |
|
99 | post :update, :project_id => 1, | |
100 | :page => 'New page', |
|
100 | :page => 'New page', | |
101 | :content => {:comments => 'Created the page', |
|
101 | :content => {:comments => 'Created the page', | |
102 | :text => "h1. New page\n\nThis is a new page", |
|
102 | :text => "h1. New page\n\nThis is a new page", | |
103 | :version => 0}, |
|
103 | :version => 0}, | |
104 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
|
104 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} | |
105 | end |
|
105 | end | |
106 | end |
|
106 | end | |
107 | page = Project.find(1).wiki.find_page('New page') |
|
107 | page = Project.find(1).wiki.find_page('New page') | |
108 | assert_equal 1, page.attachments.count |
|
108 | assert_equal 1, page.attachments.count | |
109 | assert_equal 'testfile.txt', page.attachments.first.filename |
|
109 | assert_equal 'testfile.txt', page.attachments.first.filename | |
110 | end |
|
110 | end | |
111 |
|
111 | |||
112 | def test_preview |
|
112 | def test_preview | |
113 | @request.session[:user_id] = 2 |
|
113 | @request.session[:user_id] = 2 | |
114 | xhr :post, :preview, :project_id => 1, :page => 'CookBook_documentation', |
|
114 | xhr :post, :preview, :project_id => 1, :page => 'CookBook_documentation', | |
115 | :content => { :comments => '', |
|
115 | :content => { :comments => '', | |
116 | :text => 'this is a *previewed text*', |
|
116 | :text => 'this is a *previewed text*', | |
117 | :version => 3 } |
|
117 | :version => 3 } | |
118 | assert_response :success |
|
118 | assert_response :success | |
119 | assert_template 'common/_preview' |
|
119 | assert_template 'common/_preview' | |
120 | assert_tag :tag => 'strong', :content => /previewed text/ |
|
120 | assert_tag :tag => 'strong', :content => /previewed text/ | |
121 | end |
|
121 | end | |
122 |
|
122 | |||
123 | def test_preview_new_page |
|
123 | def test_preview_new_page | |
124 | @request.session[:user_id] = 2 |
|
124 | @request.session[:user_id] = 2 | |
125 | xhr :post, :preview, :project_id => 1, :page => 'New page', |
|
125 | xhr :post, :preview, :project_id => 1, :page => 'New page', | |
126 | :content => { :text => 'h1. New page', |
|
126 | :content => { :text => 'h1. New page', | |
127 | :comments => '', |
|
127 | :comments => '', | |
128 | :version => 0 } |
|
128 | :version => 0 } | |
129 | assert_response :success |
|
129 | assert_response :success | |
130 | assert_template 'common/_preview' |
|
130 | assert_template 'common/_preview' | |
131 | assert_tag :tag => 'h1', :content => /New page/ |
|
131 | assert_tag :tag => 'h1', :content => /New page/ | |
132 | end |
|
132 | end | |
133 |
|
133 | |||
134 | def test_history |
|
134 | def test_history | |
135 | get :history, :project_id => 1, :page => 'CookBook_documentation' |
|
135 | get :history, :project_id => 1, :page => 'CookBook_documentation' | |
136 | assert_response :success |
|
136 | assert_response :success | |
137 | assert_template 'history' |
|
137 | assert_template 'history' | |
138 | assert_not_nil assigns(:versions) |
|
138 | assert_not_nil assigns(:versions) | |
139 | assert_equal 3, assigns(:versions).size |
|
139 | assert_equal 3, assigns(:versions).size | |
140 | assert_select "input[type=submit][name=commit]" |
|
140 | assert_select "input[type=submit][name=commit]" | |
141 | end |
|
141 | end | |
142 |
|
142 | |||
143 | def test_history_with_one_version |
|
143 | def test_history_with_one_version | |
144 | get :history, :project_id => 1, :page => 'Another_page' |
|
144 | get :history, :project_id => 1, :page => 'Another_page' | |
145 | assert_response :success |
|
145 | assert_response :success | |
146 | assert_template 'history' |
|
146 | assert_template 'history' | |
147 | assert_not_nil assigns(:versions) |
|
147 | assert_not_nil assigns(:versions) | |
148 | assert_equal 1, assigns(:versions).size |
|
148 | assert_equal 1, assigns(:versions).size | |
149 | assert_select "input[type=submit][name=commit]", false |
|
149 | assert_select "input[type=submit][name=commit]", false | |
150 | end |
|
150 | end | |
151 |
|
151 | |||
152 | def test_diff |
|
152 | def test_diff | |
153 | get :diff, :project_id => 1, :page => 'CookBook_documentation', :version => 2, :version_from => 1 |
|
153 | get :diff, :project_id => 1, :page => 'CookBook_documentation', :version => 2, :version_from => 1 | |
154 | assert_response :success |
|
154 | assert_response :success | |
155 | assert_template 'diff' |
|
155 | assert_template 'diff' | |
156 | assert_tag :tag => 'span', :attributes => { :class => 'diff_in'}, |
|
156 | assert_tag :tag => 'span', :attributes => { :class => 'diff_in'}, | |
157 | :content => /updated/ |
|
157 | :content => /updated/ | |
158 | end |
|
158 | end | |
159 |
|
159 | |||
160 | def test_annotate |
|
160 | def test_annotate | |
161 | get :annotate, :project_id => 1, :page => 'CookBook_documentation', :version => 2 |
|
161 | get :annotate, :project_id => 1, :page => 'CookBook_documentation', :version => 2 | |
162 | assert_response :success |
|
162 | assert_response :success | |
163 | assert_template 'annotate' |
|
163 | assert_template 'annotate' | |
164 | # Line 1 |
|
164 | # Line 1 | |
165 | assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1' }, |
|
165 | assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1' }, | |
166 | :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/ }, |
|
166 | :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/ }, | |
167 | :child => { :tag => 'td', :content => /h1\. CookBook documentation/ } |
|
167 | :child => { :tag => 'td', :content => /h1\. CookBook documentation/ } | |
168 | # Line 2 |
|
168 | # Line 2 | |
169 | assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '2' }, |
|
169 | assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '2' }, | |
170 | :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/ }, |
|
170 | :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/ }, | |
171 | :child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ } |
|
171 | :child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ } | |
172 | end |
|
172 | end | |
173 |
|
173 | |||
174 | def test_rename_with_redirect |
|
174 | def test_rename_with_redirect | |
175 | @request.session[:user_id] = 2 |
|
175 | @request.session[:user_id] = 2 | |
176 | post :rename, :project_id => 1, :page => 'Another_page', |
|
176 | post :rename, :project_id => 1, :page => 'Another_page', | |
177 | :wiki_page => { :title => 'Another renamed page', |
|
177 | :wiki_page => { :title => 'Another renamed page', | |
178 | :redirect_existing_links => 1 } |
|
178 | :redirect_existing_links => 1 } | |
179 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_renamed_page' |
|
179 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_renamed_page' | |
180 | wiki = Project.find(1).wiki |
|
180 | wiki = Project.find(1).wiki | |
181 | # Check redirects |
|
181 | # Check redirects | |
182 | assert_not_nil wiki.find_page('Another page') |
|
182 | assert_not_nil wiki.find_page('Another page') | |
183 | assert_nil wiki.find_page('Another page', :with_redirect => false) |
|
183 | assert_nil wiki.find_page('Another page', :with_redirect => false) | |
184 | end |
|
184 | end | |
185 |
|
185 | |||
186 | def test_rename_without_redirect |
|
186 | def test_rename_without_redirect | |
187 | @request.session[:user_id] = 2 |
|
187 | @request.session[:user_id] = 2 | |
188 | post :rename, :project_id => 1, :page => 'Another_page', |
|
188 | post :rename, :project_id => 1, :page => 'Another_page', | |
189 | :wiki_page => { :title => 'Another renamed page', |
|
189 | :wiki_page => { :title => 'Another renamed page', | |
190 | :redirect_existing_links => "0" } |
|
190 | :redirect_existing_links => "0" } | |
191 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_renamed_page' |
|
191 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_renamed_page' | |
192 | wiki = Project.find(1).wiki |
|
192 | wiki = Project.find(1).wiki | |
193 | # Check that there's no redirects |
|
193 | # Check that there's no redirects | |
194 | assert_nil wiki.find_page('Another page') |
|
194 | assert_nil wiki.find_page('Another page') | |
195 | end |
|
195 | end | |
196 |
|
196 | |||
197 | def test_destroy_child |
|
197 | def test_destroy_child | |
198 | @request.session[:user_id] = 2 |
|
198 | @request.session[:user_id] = 2 | |
199 |
|
|
199 | delete :destroy, :project_id => 1, :page => 'Child_1' | |
200 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
200 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
201 | end |
|
201 | end | |
202 |
|
202 | |||
203 | def test_destroy_parent |
|
203 | def test_destroy_parent | |
204 | @request.session[:user_id] = 2 |
|
204 | @request.session[:user_id] = 2 | |
205 | assert_no_difference('WikiPage.count') do |
|
205 | assert_no_difference('WikiPage.count') do | |
206 |
|
|
206 | delete :destroy, :project_id => 1, :page => 'Another_page' | |
207 | end |
|
207 | end | |
208 | assert_response :success |
|
208 | assert_response :success | |
209 | assert_template 'destroy' |
|
209 | assert_template 'destroy' | |
210 | end |
|
210 | end | |
211 |
|
211 | |||
212 | def test_destroy_parent_with_nullify |
|
212 | def test_destroy_parent_with_nullify | |
213 | @request.session[:user_id] = 2 |
|
213 | @request.session[:user_id] = 2 | |
214 | assert_difference('WikiPage.count', -1) do |
|
214 | assert_difference('WikiPage.count', -1) do | |
215 |
|
|
215 | delete :destroy, :project_id => 1, :page => 'Another_page', :todo => 'nullify' | |
216 | end |
|
216 | end | |
217 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
217 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
218 | assert_nil WikiPage.find_by_id(2) |
|
218 | assert_nil WikiPage.find_by_id(2) | |
219 | end |
|
219 | end | |
220 |
|
220 | |||
221 | def test_destroy_parent_with_cascade |
|
221 | def test_destroy_parent_with_cascade | |
222 | @request.session[:user_id] = 2 |
|
222 | @request.session[:user_id] = 2 | |
223 | assert_difference('WikiPage.count', -3) do |
|
223 | assert_difference('WikiPage.count', -3) do | |
224 |
|
|
224 | delete :destroy, :project_id => 1, :page => 'Another_page', :todo => 'destroy' | |
225 | end |
|
225 | end | |
226 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
226 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
227 | assert_nil WikiPage.find_by_id(2) |
|
227 | assert_nil WikiPage.find_by_id(2) | |
228 | assert_nil WikiPage.find_by_id(5) |
|
228 | assert_nil WikiPage.find_by_id(5) | |
229 | end |
|
229 | end | |
230 |
|
230 | |||
231 | def test_destroy_parent_with_reassign |
|
231 | def test_destroy_parent_with_reassign | |
232 | @request.session[:user_id] = 2 |
|
232 | @request.session[:user_id] = 2 | |
233 | assert_difference('WikiPage.count', -1) do |
|
233 | assert_difference('WikiPage.count', -1) do | |
234 |
|
|
234 | delete :destroy, :project_id => 1, :page => 'Another_page', :todo => 'reassign', :reassign_to_id => 1 | |
235 | end |
|
235 | end | |
236 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
236 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
237 | assert_nil WikiPage.find_by_id(2) |
|
237 | assert_nil WikiPage.find_by_id(2) | |
238 | assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent |
|
238 | assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent | |
239 | end |
|
239 | end | |
240 |
|
240 | |||
241 | def test_index |
|
241 | def test_index | |
242 | get :index, :project_id => 'ecookbook' |
|
242 | get :index, :project_id => 'ecookbook' | |
243 | assert_response :success |
|
243 | assert_response :success | |
244 | assert_template 'index' |
|
244 | assert_template 'index' | |
245 | pages = assigns(:pages) |
|
245 | pages = assigns(:pages) | |
246 | assert_not_nil pages |
|
246 | assert_not_nil pages | |
247 | assert_equal Project.find(1).wiki.pages.size, pages.size |
|
247 | assert_equal Project.find(1).wiki.pages.size, pages.size | |
248 |
|
248 | |||
249 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, |
|
249 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, | |
250 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' }, |
|
250 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' }, | |
251 | :content => 'CookBook documentation' }, |
|
251 | :content => 'CookBook documentation' }, | |
252 | :child => { :tag => 'ul', |
|
252 | :child => { :tag => 'ul', | |
253 | :child => { :tag => 'li', |
|
253 | :child => { :tag => 'li', | |
254 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, |
|
254 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, | |
255 | :content => 'Page with an inline image' } } } }, |
|
255 | :content => 'Page with an inline image' } } } }, | |
256 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' }, |
|
256 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' }, | |
257 | :content => 'Another page' } } |
|
257 | :content => 'Another page' } } | |
258 | end |
|
258 | end | |
259 |
|
259 | |||
260 | context "GET :export" do |
|
260 | context "GET :export" do | |
261 | context "with an authorized user to export the wiki" do |
|
261 | context "with an authorized user to export the wiki" do | |
262 | setup do |
|
262 | setup do | |
263 | @request.session[:user_id] = 2 |
|
263 | @request.session[:user_id] = 2 | |
264 | get :export, :project_id => 'ecookbook' |
|
264 | get :export, :project_id => 'ecookbook' | |
265 | end |
|
265 | end | |
266 |
|
266 | |||
267 | should_respond_with :success |
|
267 | should_respond_with :success | |
268 | should_assign_to :pages |
|
268 | should_assign_to :pages | |
269 | should_respond_with_content_type "text/html" |
|
269 | should_respond_with_content_type "text/html" | |
270 | should "export all of the wiki pages to a single html file" do |
|
270 | should "export all of the wiki pages to a single html file" do | |
271 | assert_select "a[name=?]", "CookBook_documentation" |
|
271 | assert_select "a[name=?]", "CookBook_documentation" | |
272 | assert_select "a[name=?]", "Another_page" |
|
272 | assert_select "a[name=?]", "Another_page" | |
273 | assert_select "a[name=?]", "Page_with_an_inline_image" |
|
273 | assert_select "a[name=?]", "Page_with_an_inline_image" | |
274 | end |
|
274 | end | |
275 |
|
275 | |||
276 | end |
|
276 | end | |
277 |
|
277 | |||
278 | context "with an unauthorized user" do |
|
278 | context "with an unauthorized user" do | |
279 | setup do |
|
279 | setup do | |
280 | get :export, :project_id => 'ecookbook' |
|
280 | get :export, :project_id => 'ecookbook' | |
281 |
|
281 | |||
282 | should_respond_with :redirect |
|
282 | should_respond_with :redirect | |
283 | should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :page => nil} } |
|
283 | should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :page => nil} } | |
284 | end |
|
284 | end | |
285 | end |
|
285 | end | |
286 | end |
|
286 | end | |
287 |
|
287 | |||
288 | context "GET :date_index" do |
|
288 | context "GET :date_index" do | |
289 | setup do |
|
289 | setup do | |
290 | get :date_index, :project_id => 'ecookbook' |
|
290 | get :date_index, :project_id => 'ecookbook' | |
291 | end |
|
291 | end | |
292 |
|
292 | |||
293 | should_respond_with :success |
|
293 | should_respond_with :success | |
294 | should_assign_to :pages |
|
294 | should_assign_to :pages | |
295 | should_assign_to :pages_by_date |
|
295 | should_assign_to :pages_by_date | |
296 | should_render_template 'wiki/date_index' |
|
296 | should_render_template 'wiki/date_index' | |
297 |
|
297 | |||
298 | end |
|
298 | end | |
299 |
|
299 | |||
300 | def test_not_found |
|
300 | def test_not_found | |
301 | get :show, :project_id => 999 |
|
301 | get :show, :project_id => 999 | |
302 | assert_response 404 |
|
302 | assert_response 404 | |
303 | end |
|
303 | end | |
304 |
|
304 | |||
305 | def test_protect_page |
|
305 | def test_protect_page | |
306 | page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page') |
|
306 | page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page') | |
307 | assert !page.protected? |
|
307 | assert !page.protected? | |
308 | @request.session[:user_id] = 2 |
|
308 | @request.session[:user_id] = 2 | |
309 | post :protect, :project_id => 1, :page => page.title, :protected => '1' |
|
309 | post :protect, :project_id => 1, :page => page.title, :protected => '1' | |
310 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_page' |
|
310 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'Another_page' | |
311 | assert page.reload.protected? |
|
311 | assert page.reload.protected? | |
312 | end |
|
312 | end | |
313 |
|
313 | |||
314 | def test_unprotect_page |
|
314 | def test_unprotect_page | |
315 | page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation') |
|
315 | page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation') | |
316 | assert page.protected? |
|
316 | assert page.protected? | |
317 | @request.session[:user_id] = 2 |
|
317 | @request.session[:user_id] = 2 | |
318 | post :protect, :project_id => 1, :page => page.title, :protected => '0' |
|
318 | post :protect, :project_id => 1, :page => page.title, :protected => '0' | |
319 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'CookBook_documentation' |
|
319 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :page => 'CookBook_documentation' | |
320 | assert !page.reload.protected? |
|
320 | assert !page.reload.protected? | |
321 | end |
|
321 | end | |
322 |
|
322 | |||
323 | def test_show_page_with_edit_link |
|
323 | def test_show_page_with_edit_link | |
324 | @request.session[:user_id] = 2 |
|
324 | @request.session[:user_id] = 2 | |
325 | get :show, :project_id => 1 |
|
325 | get :show, :project_id => 1 | |
326 | assert_response :success |
|
326 | assert_response :success | |
327 | assert_template 'show' |
|
327 | assert_template 'show' | |
328 | assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } |
|
328 | assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } | |
329 | end |
|
329 | end | |
330 |
|
330 | |||
331 | def test_show_page_without_edit_link |
|
331 | def test_show_page_without_edit_link | |
332 | @request.session[:user_id] = 4 |
|
332 | @request.session[:user_id] = 4 | |
333 | get :show, :project_id => 1 |
|
333 | get :show, :project_id => 1 | |
334 | assert_response :success |
|
334 | assert_response :success | |
335 | assert_template 'show' |
|
335 | assert_template 'show' | |
336 | assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } |
|
336 | assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } | |
337 | end |
|
337 | end | |
338 |
|
338 | |||
339 | def test_edit_unprotected_page |
|
339 | def test_edit_unprotected_page | |
340 | # Non members can edit unprotected wiki pages |
|
340 | # Non members can edit unprotected wiki pages | |
341 | @request.session[:user_id] = 4 |
|
341 | @request.session[:user_id] = 4 | |
342 | get :edit, :project_id => 1, :page => 'Another_page' |
|
342 | get :edit, :project_id => 1, :page => 'Another_page' | |
343 | assert_response :success |
|
343 | assert_response :success | |
344 | assert_template 'edit' |
|
344 | assert_template 'edit' | |
345 | end |
|
345 | end | |
346 |
|
346 | |||
347 | def test_edit_protected_page_by_nonmember |
|
347 | def test_edit_protected_page_by_nonmember | |
348 | # Non members can't edit protected wiki pages |
|
348 | # Non members can't edit protected wiki pages | |
349 | @request.session[:user_id] = 4 |
|
349 | @request.session[:user_id] = 4 | |
350 | get :edit, :project_id => 1, :page => 'CookBook_documentation' |
|
350 | get :edit, :project_id => 1, :page => 'CookBook_documentation' | |
351 | assert_response 403 |
|
351 | assert_response 403 | |
352 | end |
|
352 | end | |
353 |
|
353 | |||
354 | def test_edit_protected_page_by_member |
|
354 | def test_edit_protected_page_by_member | |
355 | @request.session[:user_id] = 2 |
|
355 | @request.session[:user_id] = 2 | |
356 | get :edit, :project_id => 1, :page => 'CookBook_documentation' |
|
356 | get :edit, :project_id => 1, :page => 'CookBook_documentation' | |
357 | assert_response :success |
|
357 | assert_response :success | |
358 | assert_template 'edit' |
|
358 | assert_template 'edit' | |
359 | end |
|
359 | end | |
360 |
|
360 | |||
361 | def test_history_of_non_existing_page_should_return_404 |
|
361 | def test_history_of_non_existing_page_should_return_404 | |
362 | get :history, :project_id => 1, :page => 'Unknown_page' |
|
362 | get :history, :project_id => 1, :page => 'Unknown_page' | |
363 | assert_response 404 |
|
363 | assert_response 404 | |
364 | end |
|
364 | end | |
365 | end |
|
365 | end |
@@ -1,343 +1,344 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2010 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2010 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require "#{File.dirname(__FILE__)}/../test_helper" |
|
18 | require "#{File.dirname(__FILE__)}/../test_helper" | |
19 |
|
19 | |||
20 | class RoutingTest < ActionController::IntegrationTest |
|
20 | class RoutingTest < ActionController::IntegrationTest | |
21 | context "activities" do |
|
21 | context "activities" do | |
22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil |
|
22 | should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil | |
23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' |
|
23 | should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' | |
24 | end |
|
24 | end | |
25 |
|
25 | |||
26 | context "attachments" do |
|
26 | context "attachments" do | |
27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' |
|
27 | should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' | |
28 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' |
|
28 | should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' | |
29 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' |
|
29 | should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' | |
30 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' |
|
30 | should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' | |
31 | end |
|
31 | end | |
32 |
|
32 | |||
33 | context "boards" do |
|
33 | context "boards" do | |
34 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' |
|
34 | should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' | |
35 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
35 | should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |
36 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' |
|
36 | should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' | |
37 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' |
|
37 | should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' | |
38 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
38 | should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' | |
39 |
|
39 | |||
40 | should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
40 | should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |
41 | should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' |
|
41 | should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' | |
42 | should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' |
|
42 | should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' | |
43 |
|
43 | |||
44 | end |
|
44 | end | |
45 |
|
45 | |||
46 | context "documents" do |
|
46 | context "documents" do | |
47 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' |
|
47 | should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' | |
48 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
48 | should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' | |
49 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' |
|
49 | should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' | |
50 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' |
|
50 | should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' | |
51 |
|
51 | |||
52 | should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' |
|
52 | should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' | |
53 | should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' |
|
53 | should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' | |
54 | should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' |
|
54 | should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' | |
55 | end |
|
55 | end | |
56 |
|
56 | |||
57 | context "issues" do |
|
57 | context "issues" do | |
58 | # REST actions |
|
58 | # REST actions | |
59 | should_route :get, "/issues", :controller => 'issues', :action => 'index' |
|
59 | should_route :get, "/issues", :controller => 'issues', :action => 'index' | |
60 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' |
|
60 | should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' | |
61 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' |
|
61 | should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' | |
62 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' |
|
62 | should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' | |
63 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' |
|
63 | should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' | |
64 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' |
|
64 | should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' | |
65 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' |
|
65 | should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' | |
66 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' |
|
66 | should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' | |
67 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' |
|
67 | should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' | |
68 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' |
|
68 | should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' | |
69 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' |
|
69 | should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' | |
70 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' |
|
70 | should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' | |
71 |
|
71 | |||
72 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' |
|
72 | should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' | |
73 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' |
|
73 | should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' | |
74 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' |
|
74 | should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' | |
75 |
|
75 | |||
76 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
76 | should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' | |
77 | # TODO: Should use PUT |
|
77 | # TODO: Should use PUT | |
78 | should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' |
|
78 | should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' | |
79 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' |
|
79 | should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' | |
80 |
|
80 | |||
81 | # TODO: Should use DELETE |
|
81 | # TODO: Should use DELETE | |
82 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' |
|
82 | should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' | |
83 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' |
|
83 | should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' | |
84 |
|
84 | |||
85 | # Extra actions |
|
85 | # Extra actions | |
86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' |
|
86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' | |
87 |
|
87 | |||
88 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' |
|
88 | should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' | |
89 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' |
|
89 | should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' | |
90 |
|
90 | |||
91 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' |
|
91 | should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' | |
92 |
|
92 | |||
93 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' |
|
93 | should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' | |
94 | should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update' |
|
94 | should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update' | |
95 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' |
|
95 | should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name' | |
96 | should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name' |
|
96 | should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name' | |
97 |
|
97 | |||
98 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' |
|
98 | should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show' | |
99 | should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update' |
|
99 | should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update' | |
100 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' |
|
100 | should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name' | |
101 | should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name' |
|
101 | should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name' | |
102 |
|
102 | |||
103 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' |
|
103 | should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues' | |
104 |
|
104 | |||
105 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
105 | should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' | |
106 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
106 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' | |
107 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
107 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' | |
108 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
108 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' | |
109 |
|
109 | |||
110 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' |
|
110 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' | |
111 |
|
111 | |||
112 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' |
|
112 | should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit' | |
113 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' |
|
113 | should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update' | |
114 | end |
|
114 | end | |
115 |
|
115 | |||
116 | context "issue categories" do |
|
116 | context "issue categories" do | |
117 | should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
117 | should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' | |
118 |
|
118 | |||
119 | should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' |
|
119 | should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' | |
120 | end |
|
120 | end | |
121 |
|
121 | |||
122 | context "issue relations" do |
|
122 | context "issue relations" do | |
123 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' |
|
123 | should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' | |
124 | should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' |
|
124 | should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' | |
125 | end |
|
125 | end | |
126 |
|
126 | |||
127 | context "issue reports" do |
|
127 | context "issue reports" do | |
128 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' |
|
128 | should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' | |
129 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' |
|
129 | should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' | |
130 | end |
|
130 | end | |
131 |
|
131 | |||
132 | context "members" do |
|
132 | context "members" do | |
133 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' |
|
133 | should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' | |
134 | end |
|
134 | end | |
135 |
|
135 | |||
136 | context "messages" do |
|
136 | context "messages" do | |
137 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' |
|
137 | should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' | |
138 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
138 | should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |
139 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
139 | should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |
140 |
|
140 | |||
141 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' |
|
141 | should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |
142 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' |
|
142 | should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |
143 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' |
|
143 | should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' | |
144 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' |
|
144 | should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' | |
145 | end |
|
145 | end | |
146 |
|
146 | |||
147 | context "news" do |
|
147 | context "news" do | |
148 | should_route :get, "/news", :controller => 'news', :action => 'index' |
|
148 | should_route :get, "/news", :controller => 'news', :action => 'index' | |
149 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' |
|
149 | should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' | |
150 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' |
|
150 | should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' | |
151 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' |
|
151 | should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' | |
152 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' |
|
152 | should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' | |
153 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' |
|
153 | should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' | |
154 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' |
|
154 | should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' | |
155 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' |
|
155 | should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' | |
156 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' |
|
156 | should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' | |
157 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' |
|
157 | should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' | |
158 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' |
|
158 | should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' | |
159 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' |
|
159 | should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' | |
160 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' |
|
160 | should_route :get, "/news/preview", :controller => 'previews', :action => 'news' | |
161 |
|
161 | |||
162 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' |
|
162 | should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' | |
163 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' |
|
163 | should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' | |
164 |
|
164 | |||
165 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' |
|
165 | should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' | |
166 |
|
166 | |||
167 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' |
|
167 | should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' | |
168 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' |
|
168 | should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' | |
169 | end |
|
169 | end | |
170 |
|
170 | |||
171 | context "projects" do |
|
171 | context "projects" do | |
172 | should_route :get, "/projects", :controller => 'projects', :action => 'index' |
|
172 | should_route :get, "/projects", :controller => 'projects', :action => 'index' | |
173 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' |
|
173 | should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' | |
174 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' |
|
174 | should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' | |
175 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' |
|
175 | should_route :get, "/projects/new", :controller => 'projects', :action => 'new' | |
176 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' |
|
176 | should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' | |
177 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' |
|
177 | should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' | |
178 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' |
|
178 | should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' | |
179 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' |
|
179 | should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' | |
180 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' |
|
180 | should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' | |
181 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' |
|
181 | should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' | |
182 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' |
|
182 | should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' | |
183 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' |
|
183 | should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' | |
184 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' |
|
184 | should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' | |
185 |
|
185 | |||
186 | should_route :post, "/projects", :controller => 'projects', :action => 'create' |
|
186 | should_route :post, "/projects", :controller => 'projects', :action => 'create' | |
187 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' |
|
187 | should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' | |
188 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' |
|
188 | should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' | |
189 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' |
|
189 | should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' | |
190 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' |
|
190 | should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' | |
191 |
|
191 | |||
192 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' |
|
192 | should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' | |
193 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' |
|
193 | should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' | |
194 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' |
|
194 | should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' | |
195 |
|
195 | |||
196 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' |
|
196 | should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' | |
197 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' |
|
197 | should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' | |
198 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' |
|
198 | should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' | |
199 | end |
|
199 | end | |
200 |
|
200 | |||
201 | context "repositories" do |
|
201 | context "repositories" do | |
202 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' |
|
202 | should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' | |
203 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
203 | should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
204 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' |
|
204 | should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' | |
205 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' |
|
205 | should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' | |
206 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' |
|
206 | should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' | |
207 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' |
|
207 | should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' | |
208 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' |
|
208 | should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' | |
209 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] |
|
209 | should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] | |
210 | should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2' |
|
210 | should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2' | |
211 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] |
|
211 | should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] | |
212 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] |
|
212 | should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] | |
213 | should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2' |
|
213 | should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2' | |
214 | should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw' |
|
214 | should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw' | |
215 | should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw' |
|
215 | should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw' | |
216 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] |
|
216 | should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] | |
217 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] |
|
217 | should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] | |
218 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' |
|
218 | should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' | |
219 |
|
219 | |||
220 |
|
220 | |||
221 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' |
|
221 | should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |
222 | end |
|
222 | end | |
223 |
|
223 | |||
224 | context "timelogs (global)" do |
|
224 | context "timelogs (global)" do | |
225 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'index' |
|
225 | should_route :get, "/time_entries", :controller => 'timelog', :action => 'index' | |
226 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv' |
|
226 | should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv' | |
227 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom' |
|
227 | should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom' | |
228 | should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new' |
|
228 | should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new' | |
229 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' |
|
229 | should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' | |
230 |
|
230 | |||
231 | should_route :post, "/time_entries", :controller => 'timelog', :action => 'create' |
|
231 | should_route :post, "/time_entries", :controller => 'timelog', :action => 'create' | |
232 |
|
232 | |||
233 | should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22' |
|
233 | should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22' | |
234 |
|
234 | |||
235 | should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55' |
|
235 | should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55' | |
236 | end |
|
236 | end | |
237 |
|
237 | |||
238 | context "timelogs (scoped under project)" do |
|
238 | context "timelogs (scoped under project)" do | |
239 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' |
|
239 | should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' | |
240 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' |
|
240 | should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' | |
241 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom' |
|
241 | should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom' | |
242 | should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567' |
|
242 | should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567' | |
243 | should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567' |
|
243 | should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567' | |
244 |
|
244 | |||
245 | should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567' |
|
245 | should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567' | |
246 |
|
246 | |||
247 | should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567' |
|
247 | should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567' | |
248 |
|
248 | |||
249 | should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567' |
|
249 | should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567' | |
250 | end |
|
250 | end | |
251 |
|
251 | |||
252 | context "timelogs (scoped under issues)" do |
|
252 | context "timelogs (scoped under issues)" do | |
253 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234' |
|
253 | should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234' | |
254 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv' |
|
254 | should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv' | |
255 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom' |
|
255 | should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom' | |
256 | should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234' |
|
256 | should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234' | |
257 | should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234' |
|
257 | should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234' | |
258 |
|
258 | |||
259 | should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234' |
|
259 | should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234' | |
260 |
|
260 | |||
261 | should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234' |
|
261 | should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234' | |
262 |
|
262 | |||
263 | should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234' |
|
263 | should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234' | |
264 | end |
|
264 | end | |
265 |
|
265 | |||
266 | context "timelogs (scoped under project and issues)" do |
|
266 | context "timelogs (scoped under project and issues)" do | |
267 | should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook' |
|
267 | should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook' | |
268 | should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' |
|
268 | should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' | |
269 | should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' |
|
269 | should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' | |
270 | should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook' |
|
270 | should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook' | |
271 | should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
271 | should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook' | |
272 |
|
272 | |||
273 | should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook' |
|
273 | should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook' | |
274 |
|
274 | |||
275 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
275 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' | |
276 |
|
276 | |||
277 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' |
|
277 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' | |
278 | end |
|
278 | end | |
279 |
|
279 | |||
280 | context "time_entry_reports" do |
|
280 | context "time_entry_reports" do | |
281 | should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report' |
|
281 | should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report' | |
282 | should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567' |
|
282 | should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567' | |
283 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' |
|
283 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' | |
284 | end |
|
284 | end | |
285 |
|
285 | |||
286 | context "users" do |
|
286 | context "users" do | |
287 | should_route :get, "/users", :controller => 'users', :action => 'index' |
|
287 | should_route :get, "/users", :controller => 'users', :action => 'index' | |
288 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' |
|
288 | should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' | |
289 | should_route :get, "/users/new", :controller => 'users', :action => 'new' |
|
289 | should_route :get, "/users/new", :controller => 'users', :action => 'new' | |
290 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' |
|
290 | should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' | |
291 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' |
|
291 | should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' | |
292 |
|
292 | |||
293 | should_route :post, "/users", :controller => 'users', :action => 'create' |
|
293 | should_route :post, "/users", :controller => 'users', :action => 'create' | |
294 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' |
|
294 | should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123' | |
295 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' |
|
295 | should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55' | |
296 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
296 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' | |
297 |
|
297 | |||
298 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' |
|
298 | should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444' | |
299 | end |
|
299 | end | |
300 |
|
300 | |||
301 | # TODO: should they all be scoped under /projects/:project_id ? |
|
301 | # TODO: should they all be scoped under /projects/:project_id ? | |
302 | context "versions" do |
|
302 | context "versions" do | |
303 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
303 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' | |
304 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' |
|
304 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' | |
305 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' |
|
305 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' | |
306 |
|
306 | |||
307 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' |
|
307 | should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' | |
308 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' |
|
308 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' | |
309 |
|
309 | |||
310 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' |
|
310 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' | |
311 | end |
|
311 | end | |
312 |
|
312 | |||
313 | context "wiki (singular, project's pages)" do |
|
313 | context "wiki (singular, project's pages)" do | |
314 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' |
|
314 | should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' | |
315 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :page => 'lalala' |
|
315 | should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :page => 'lalala' | |
316 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :page => 'my_page' |
|
316 | should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :page => 'my_page' | |
317 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :page => 'CookBook_documentation' |
|
317 | should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :page => 'CookBook_documentation' | |
318 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1' |
|
318 | should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1' | |
319 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :page => 'CookBook_documentation', :version => '2' |
|
319 | should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :page => 'CookBook_documentation', :version => '2' | |
320 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :page => 'ladida' |
|
320 | should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :page => 'ladida' | |
321 | should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' |
|
321 | should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' | |
322 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' |
|
322 | should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' | |
323 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' |
|
323 | should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' | |
324 |
|
324 | |||
325 | should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'update', :project_id => '567', :page => 'my_page' |
|
325 | should_route :post, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'update', :project_id => '567', :page => 'my_page' | |
326 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :page => 'CookBook_documentation' |
|
326 | should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :page => 'CookBook_documentation' | |
327 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :page => 'ladida' |
|
327 | should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :page => 'ladida' | |
328 | should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :project_id => '22', :page => 'ladida' |
|
|||
329 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :page => 'ladida' |
|
328 | should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :page => 'ladida' | |
330 | should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :page => 'ladida' |
|
329 | should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :page => 'ladida' | |
|
330 | ||||
|
331 | should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :page => 'ladida' | |||
331 | end |
|
332 | end | |
332 |
|
333 | |||
333 | context "wikis (plural, admin setup)" do |
|
334 | context "wikis (plural, admin setup)" do | |
334 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
335 | should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
335 |
|
336 | |||
336 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' |
|
337 | should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' | |
337 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' |
|
338 | should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |
338 | end |
|
339 | end | |
339 |
|
340 | |||
340 | context "administration panel" do |
|
341 | context "administration panel" do | |
341 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' |
|
342 | should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' | |
342 | end |
|
343 | end | |
343 | end |
|
344 | end |
General Comments 0
You need to be logged in to leave comments.
Login now