##// END OF EJS Templates
Resourcified enumerations....
Jean-Philippe Lang -
r8069:0471de41ff48
parent child
Show More
@@ -1,85 +1,86
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class EnumerationsController < ApplicationController
19 19 layout 'admin'
20 20
21 21 before_filter :require_admin
22 before_filter :build_new_enumeration, :only => [:new, :create]
23 before_filter :find_enumeration, :only => [:edit, :update, :destroy]
22 24
23 25 helper :custom_fields
24 include CustomFieldsHelper
25 26
26 27 def index
27 28 end
28 29
29 verify :method => :post, :only => [ :destroy, :create, :update ],
30 :redirect_to => { :action => :index }
31
32 30 def new
33 begin
34 @enumeration = params[:type].constantize.new
35 rescue NameError
36 @enumeration = Enumeration.new
37 end
38 31 end
39 32
40 33 def create
41 @enumeration = Enumeration.new(params[:enumeration])
42 @enumeration.type = params[:enumeration][:type]
43 if @enumeration.save
34 if request.post? && @enumeration.save
44 35 flash[:notice] = l(:notice_successful_create)
45 36 redirect_to :action => 'index', :type => @enumeration.type
46 37 else
47 38 render :action => 'new'
48 39 end
49 40 end
50 41
51 42 def edit
52 @enumeration = Enumeration.find(params[:id])
53 43 end
54 44
55 45 def update
56 @enumeration = Enumeration.find(params[:id])
57 @enumeration.type = params[:enumeration][:type] if params[:enumeration][:type]
58 if @enumeration.update_attributes(params[:enumeration])
46 if request.put? && @enumeration.update_attributes(params[:enumeration])
59 47 flash[:notice] = l(:notice_successful_update)
60 48 redirect_to :action => 'index', :type => @enumeration.type
61 49 else
62 50 render :action => 'edit'
63 51 end
64 52 end
65 53
54 verify :method => :delete, :only => :destroy, :render => { :nothing => true, :status => :method_not_allowed }
66 55 def destroy
67 @enumeration = Enumeration.find(params[:id])
68 56 if !@enumeration.in_use?
69 57 # No associated objects
70 58 @enumeration.destroy
71 59 redirect_to :action => 'index'
72 60 return
73 61 elsif params[:reassign_to_id]
74 62 if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id])
75 63 @enumeration.destroy(reassign_to)
76 64 redirect_to :action => 'index'
77 65 return
78 66 end
79 67 end
80 @enumerations = @enumeration.class.find(:all) - [@enumeration]
81 #rescue
82 # flash[:error] = 'Unable to delete enumeration'
83 # redirect_to :action => 'index'
68 @enumerations = @enumeration.class.all - [@enumeration]
69 end
70
71 private
72
73 def build_new_enumeration
74 class_name = params[:enumeration] && params[:enumeration][:type] || params[:type]
75 @enumeration = Enumeration.new_subclass_instance(class_name, params[:enumeration])
76 if @enumeration.nil?
77 render_404
78 end
79 end
80
81 def find_enumeration
82 @enumeration = Enumeration.find(params[:id])
83 rescue ActiveRecord::RecordNotFound
84 render_404
84 85 end
85 86 end
@@ -1,136 +1,140
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class Enumeration < ActiveRecord::Base
19 include Redmine::SubclassFactory
20
19 21 default_scope :order => "#{Enumeration.table_name}.position ASC"
20 22
21 23 belongs_to :project
22 24
23 25 acts_as_list :scope => 'type = \'#{type}\''
24 26 acts_as_customizable
25 27 acts_as_tree :order => 'position ASC'
26 28
27 29 before_destroy :check_integrity
28 30 before_save :check_default
29 31
32 attr_protected :type
33
30 34 validates_presence_of :name
31 35 validates_uniqueness_of :name, :scope => [:type, :project_id]
32 36 validates_length_of :name, :maximum => 30
33 37
34 38 named_scope :shared, :conditions => { :project_id => nil }
35 39 named_scope :active, :conditions => { :active => true }
36 40 named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
37 41
38 42 def self.default
39 43 # Creates a fake default scope so Enumeration.default will check
40 44 # it's type. STI subclasses will automatically add their own
41 45 # types to the finder.
42 46 if self.descends_from_active_record?
43 47 find(:first, :conditions => { :is_default => true, :type => 'Enumeration' })
44 48 else
45 49 # STI classes are
46 50 find(:first, :conditions => { :is_default => true })
47 51 end
48 52 end
49 53
50 54 # Overloaded on concrete classes
51 55 def option_name
52 56 nil
53 57 end
54 58
55 59 def check_default
56 60 if is_default? && is_default_changed?
57 61 Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
58 62 end
59 63 end
60 64
61 65 # Overloaded on concrete classes
62 66 def objects_count
63 67 0
64 68 end
65 69
66 70 def in_use?
67 71 self.objects_count != 0
68 72 end
69 73
70 74 # Is this enumeration overiding a system level enumeration?
71 75 def is_override?
72 76 !self.parent.nil?
73 77 end
74 78
75 79 alias :destroy_without_reassign :destroy
76 80
77 81 # Destroy the enumeration
78 82 # If a enumeration is specified, objects are reassigned
79 83 def destroy(reassign_to = nil)
80 84 if reassign_to && reassign_to.is_a?(Enumeration)
81 85 self.transfer_relations(reassign_to)
82 86 end
83 87 destroy_without_reassign
84 88 end
85 89
86 90 def <=>(enumeration)
87 91 position <=> enumeration.position
88 92 end
89 93
90 94 def to_s; name end
91 95
92 96 # Returns the Subclasses of Enumeration. Each Subclass needs to be
93 97 # required in development mode.
94 98 #
95 99 # Note: subclasses is protected in ActiveRecord
96 100 def self.get_subclasses
97 101 @@subclasses[Enumeration]
98 102 end
99 103
100 104 # Does the +new+ Hash override the previous Enumeration?
101 105 def self.overridding_change?(new, previous)
102 106 if (same_active_state?(new['active'], previous.active)) && same_custom_values?(new,previous)
103 107 return false
104 108 else
105 109 return true
106 110 end
107 111 end
108 112
109 113 # Does the +new+ Hash have the same custom values as the previous Enumeration?
110 114 def self.same_custom_values?(new, previous)
111 115 previous.custom_field_values.each do |custom_value|
112 116 if custom_value.value != new["custom_field_values"][custom_value.custom_field_id.to_s]
113 117 return false
114 118 end
115 119 end
116 120
117 121 return true
118 122 end
119 123
120 124 # Are the new and previous fields equal?
121 125 def self.same_active_state?(new, previous)
122 126 new = (new == "1" ? true : false)
123 127 return new == previous
124 128 end
125 129
126 130 private
127 131 def check_integrity
128 132 raise "Can't delete enumeration" if self.in_use?
129 133 end
130 134
131 135 end
132 136
133 137 # Force load the subclasses in development mode
134 138 require_dependency 'time_entry_activity'
135 139 require_dependency 'document_category'
136 140 require_dependency 'issue_priority'
@@ -1,19 +1,11
1 1 <%= error_messages_for 'enumeration' %>
2 <div class="box">
3 <!--[form:optvalue]-->
4 <%= hidden_field 'enumeration', 'type' %>
5 2
6 <p><label for="enumeration_name"><%=l(:field_name)%></label>
7 <%= text_field 'enumeration', 'name' %></p>
3 <div class="box tabular">
4 <p><%= f.text_field :name %></p>
5 <p><%= f.check_box :active %></p>
6 <p><%= f.check_box :is_default %></p>
8 7
9 <p><label for="enumeration_active"><%=l(:field_active)%></label>
10 <%= check_box 'enumeration', 'active' %></p>
11
12 <p><label for="enumeration_is_default"><%=l(:field_is_default)%></label>
13 <%= check_box 'enumeration', 'is_default' %></p>
14 <!--[eoform:optvalue]-->
15
16 <% @enumeration.custom_field_values.each do |value| %>
17 <p><%= custom_field_tag_with_label :enumeration, value %></p>
18 <% end %>
8 <% @enumeration.custom_field_values.each do |value| %>
9 <p><%= custom_field_tag_with_label :enumeration, value %></p>
10 <% end %>
19 11 </div>
@@ -1,12 +1,12
1 1 <h2><%= l(@enumeration.option_name) %>: <%=h @enumeration %></h2>
2 2
3 <% form_tag({}) do %>
3 <% form_tag({}, :method => :delete) do %>
4 4 <div class="box">
5 5 <p><strong><%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %></strong></p>
6 6 <p><label for='reassign_to_id'><%= l(:text_enumeration_category_reassign_to) %></label>
7 7 <%= select_tag 'reassign_to_id', ("<option>--- #{l(:actionview_instancetag_blank_option)} ---</option>" + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p>
8 8 </div>
9 9
10 10 <%= submit_tag l(:button_apply) %>
11 <%= link_to l(:button_cancel), :controller => 'enumerations', :action => 'index' %>
11 <%= link_to l(:button_cancel), enumerations_path %>
12 12 <% end %>
@@ -1,6 +1,6
1 <h2><%= link_to l(@enumeration.option_name), :controller => 'enumerations', :action => 'index' %> &#187; <%=h @enumeration %></h2>
1 <h2><%= link_to l(@enumeration.option_name), enumerations_path %> &#187; <%=h @enumeration %></h2>
2 2
3 <% form_tag({:action => 'update', :id => @enumeration}, :class => "tabular") do %>
4 <%= render :partial => 'form' %>
3 <% labelled_form_for :enumeration, @enumeration, :url => enumeration_path(@enumeration), :html => {:method => :put} do |f| %>
4 <%= render :partial => 'form', :locals => {:f => f} %>
5 5 <%= submit_tag l(:button_save) %>
6 6 <% end %>
@@ -1,37 +1,37
1 1 <h2><%=l(:label_enumerations)%></h2>
2 2
3 3 <% Enumeration.get_subclasses.each do |klass| %>
4 4 <h3><%= l(klass::OptionName) %></h3>
5 5
6 6 <% enumerations = klass.shared %>
7 7 <% if enumerations.any? %>
8 8 <table class="list"><thead>
9 9 <tr>
10 10 <th><%= l(:field_name) %></th>
11 11 <th style="width:15%;"><%= l(:field_is_default) %></th>
12 12 <th style="width:15%;"><%= l(:field_active) %></th>
13 13 <th style="width:15%;"></th>
14 14 <th align="center" style="width:10%;"> </th>
15 15 </tr></thead>
16 16 <% enumerations.each do |enumeration| %>
17 17 <tr class="<%= cycle('odd', 'even') %>">
18 <td><%= link_to h(enumeration), :action => 'edit', :id => enumeration %></td>
18 <td><%= link_to h(enumeration), edit_enumeration_path(enumeration) %></td>
19 19 <td class="center" style="width:15%;"><%= checked_image enumeration.is_default? %></td>
20 20 <td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td>
21 <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %></td>
21 <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}, :put) %></td>
22 22 <td class="buttons">
23 <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration },
24 :method => :post,
23 <%= link_to l(:button_delete), enumeration_path(enumeration),
24 :method => :delete,
25 25 :confirm => l(:text_are_you_sure),
26 26 :class => 'icon icon-del' %>
27 27 </td>
28 28 </tr>
29 29 <% end %>
30 30 </table>
31 31 <% reset_cycle %>
32 32 <% end %>
33 33
34 <p><%= link_to l(:label_enumeration_new), { :action => 'new', :type => klass.name } %></p>
34 <p><%= link_to l(:label_enumeration_new), new_enumeration_path(:type => klass.name) %></p>
35 35 <% end %>
36 36
37 37 <% html_title(l(:label_enumerations)) -%>
@@ -1,6 +1,7
1 <h2><%= link_to l(@enumeration.option_name), :controller => 'enumerations', :action => 'index' %> &#187; <%=l(:label_enumeration_new)%></h2>
1 <h2><%= link_to l(@enumeration.option_name), enumerations_path %> &#187; <%=l(:label_enumeration_new)%></h2>
2 2
3 <% form_tag({:action => 'create'}, :class => "tabular") do %>
4 <%= render :partial => 'form' %>
3 <% labelled_form_for :enumeration, @enumeration, :url => enumerations_path do |f| %>
4 <%= f.hidden_field :type %>
5 <%= render :partial => 'form', :locals => {:f => f} %>
5 6 <%= submit_tag l(:button_create) %>
6 7 <% end %>
@@ -1,267 +1,262
1 1 ActionController::Routing::Routes.draw do |map|
2 2 # Add your own custom routes here.
3 3 # The priority is based upon order of creation: first created -> highest priority.
4 4
5 5 # Here's a sample route:
6 6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 7 # Keep in mind you can assign values other than :controller and :action
8 8
9 9 map.home '', :controller => 'welcome', :conditions => {:method => :get}
10 10
11 11 map.signin 'login', :controller => 'account', :action => 'login', :conditions => {:method => [:get, :post]}
12 12 map.signout 'logout', :controller => 'account', :action => 'logout', :conditions => {:method => :get}
13 13 map.connect 'account/register', :controller => 'account', :action => 'register', :conditions => {:method => [:get, :post]}
14 14 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password', :conditions => {:method => [:get, :post]}
15 15 map.connect 'account/activate', :controller => 'account', :action => 'activate', :conditions => {:method => :get}
16 16
17 17 map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
18 18
19 19 map.connect 'help/:ctrl/:page', :controller => 'help', :conditions => {:method => :get}
20 20
21 21 map.connect '/time_entries/destroy',
22 22 :controller => 'timelog', :action => 'destroy', :conditions => { :method => :delete }
23 23 map.time_entries_context_menu '/time_entries/context_menu',
24 24 :controller => 'context_menus', :action => 'time_entries'
25 25
26 26 map.resources :time_entries, :controller => 'timelog', :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
27 27
28 28 map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
29 29 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => [:get, :post]}
30 30
31 31 map.with_options :controller => 'messages' do |messages_routes|
32 32 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
33 33 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
34 34 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
35 35 messages_views.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
36 36 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
37 37 end
38 38 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
39 39 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
40 40 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
41 41 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
42 42 messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
43 43 end
44 44 end
45 45
46 46 map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
47 47 map.resources :queries, :except => [:show]
48 48
49 49 # Misc issue routes. TODO: move into resources
50 50 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues', :conditions => { :method => :get }
51 51 map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
52 52 map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
53 53 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
54 54 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
55 55
56 56 map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff', :id => /\d+/, :conditions => { :method => :get }
57 57 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit', :id => /\d+/, :conditions => { :method => [:get, :post] }
58 58
59 59 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
60 60 gantts_routes.connect '/projects/:project_id/issues/gantt'
61 61 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
62 62 gantts_routes.connect '/issues/gantt.:format'
63 63 end
64 64
65 65 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
66 66 calendars_routes.connect '/projects/:project_id/issues/calendar'
67 67 calendars_routes.connect '/issues/calendar'
68 68 end
69 69
70 70 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
71 71 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
72 72 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
73 73 end
74 74
75 75 map.connect 'my/account', :controller => 'my', :action => 'account', :conditions => {:method => [:get, :post]}
76 76 map.connect 'my/page', :controller => 'my', :action => 'page', :conditions => {:method => :get}
77 77 map.connect 'my', :controller => 'my', :action => 'index', :conditions => {:method => :get} # Redirects to my/page
78 78 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :conditions => {:method => :post}
79 79 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :conditions => {:method => :post}
80 80 map.connect 'my/password', :controller => 'my', :action => 'password', :conditions => {:method => [:get, :post]}
81 81 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout', :conditions => {:method => :get}
82 82 map.connect 'my/add_block', :controller => 'my', :action => 'add_block', :conditions => {:method => :post}
83 83 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block', :conditions => {:method => :post}
84 84 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :conditions => {:method => :post}
85 85
86 86 map.resources :issues, :collection => {:bulk_edit => :get, :bulk_update => :post} do |issues|
87 87 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
88 88 issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
89 89 end
90 90 # Bulk deletion
91 91 map.connect '/issues', :controller => 'issues', :action => 'destroy', :conditions => {:method => :delete}
92 92
93 93 map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new', :conditions => { :method => :post }
94 94 map.connect 'members/edit/:id', :controller => 'members', :action => 'edit', :id => /\d+/, :conditions => { :method => :post }
95 95 map.connect 'members/destroy/:id', :controller => 'members', :action => 'destroy', :id => /\d+/, :conditions => { :method => :post }
96 96 map.connect 'members/autocomplete_for_member/:id', :controller => 'members', :action => 'autocomplete_for_member', :conditions => { :method => :post }
97 97
98 98 map.resources :users
99 99 map.with_options :controller => 'users' do |users|
100 100 users.user_memberships 'users/:id/memberships', :action => 'edit_membership', :conditions => {:method => :post}
101 101 users.user_membership 'users/:id/memberships/:membership_id', :action => 'edit_membership', :conditions => {:method => :put}
102 102 users.connect 'users/:id/memberships/:membership_id', :action => 'destroy_membership', :conditions => {:method => :delete}
103 103 end
104 104
105 105 # For nice "roadmap" in the url for the index action
106 106 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
107 107
108 108 map.all_news 'news', :controller => 'news', :action => 'index'
109 109 map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
110 110 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
111 111 map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
112 112 map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
113 113
114 114 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new', :conditions => {:method => [:get, :post]}
115 115 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :conditions => {:method => :post}
116 116 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch', :conditions => {:method => :post}
117 117 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :conditions => {:method => :post}
118 118
119 119 map.resources :projects, :member => {
120 120 :copy => [:get, :post],
121 121 :settings => :get,
122 122 :modules => :post,
123 123 :archive => :post,
124 124 :unarchive => :post
125 125 } do |project|
126 126 project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
127 127 project.resources :issues, :only => [:index, :new, :create] do |issues|
128 128 issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
129 129 end
130 130 project.resources :files, :only => [:index, :new, :create]
131 131 project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
132 132 project.resources :news, :shallow => true
133 133 project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id', :collection => {:report => :get}
134 134 project.resources :queries, :only => [:new, :create]
135 135 project.resources :issue_categories, :shallow => true
136 136 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
137 137 project.resources :boards
138 138
139 139 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
140 140 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
141 141 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
142 142 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
143 143 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
144 144 project.resources :wiki, :except => [:new, :create], :member => {
145 145 :rename => [:get, :post],
146 146 :history => :get,
147 147 :preview => :any,
148 148 :protect => :post,
149 149 :add_attachment => :post
150 150 }, :collection => {
151 151 :export => :get,
152 152 :date_index => :get
153 153 }
154 154
155 155 end
156 156
157 157 # TODO: port to be part of the resources route(s)
158 158 map.with_options :controller => 'projects' do |project_mapper|
159 159 project_mapper.with_options :conditions => {:method => :get} do |project_views|
160 160 project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
161 161 project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
162 162 end
163 163 end
164 164
165 165 map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
166 166 activity.connect 'projects/:id/activity'
167 167 activity.connect 'projects/:id/activity.:format'
168 168 activity.connect 'activity', :id => nil
169 169 activity.connect 'activity.:format', :id => nil
170 170 end
171 171
172 172 map.with_options :controller => 'repositories' do |repositories|
173 173 repositories.with_options :conditions => {:method => :get} do |repository_views|
174 174 repository_views.connect 'projects/:id/repository', :action => 'show'
175 175 repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
176 176 repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
177 177 repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
178 178 repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
179 179 repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
180 180 repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
181 181 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
182 182 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
183 183 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
184 184 repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
185 185 repository_views.connect 'projects/:id/repository/browse/*path', :action => 'browse'
186 186 repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
187 187 repository_views.connect 'projects/:id/repository/changes/*path', :action => 'changes'
188 188 repository_views.connect 'projects/:id/repository/annotate/*path', :action => 'annotate'
189 189 repository_views.connect 'projects/:id/repository/diff/*path', :action => 'diff'
190 190 repository_views.connect 'projects/:id/repository/graph', :action => 'graph'
191 191 end
192 192
193 193 repositories.connect 'projects/:id/repository/revision', :action => 'revision', :conditions => {:method => [:get, :post]}
194 194 repositories.connect 'projects/:id/repository/committers', :action => 'committers', :conditions => {:method => [:get, :post]}
195 195 repositories.connect 'projects/:id/repository/edit', :action => 'edit', :conditions => {:method => :post}
196 196 repositories.connect 'projects/:id/repository/destroy', :action => 'destroy', :conditions => {:method => :post}
197 197 end
198 198
199 199 map.resources :attachments, :only => [:show, :destroy]
200 200 # additional routes for having the file name at the end of url
201 201 map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
202 202 map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :conditions => {:method => :get}
203 203 map.connect 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :conditions => {:method => :get}
204 204
205 205 map.resources :groups, :member => {:autocomplete_for_user => :get}
206 206 map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
207 207 map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
208 208 map.connect 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :conditions => {:method => :post}
209 209 map.connect 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :conditions => {:method => :post}
210 210
211 211 map.resources :trackers, :except => :show
212 212 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
213 213 map.resources :custom_fields, :except => :show
214 214 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
215 map.resources :enumerations, :except => :show
215 216
216 217 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
217 218
218 219 map.connect 'mail_handler', :controller => 'mail_handler', :action => 'index', :conditions => {:method => :post}
219 220
220 221 map.connect 'admin', :controller => 'admin', :action => 'index', :conditions => {:method => :get}
221 222 map.connect 'admin/projects', :controller => 'admin', :action => 'projects', :conditions => {:method => :get}
222 223 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins', :conditions => {:method => :get}
223 224 map.connect 'admin/info', :controller => 'admin', :action => 'info', :conditions => {:method => :get}
224 225 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email', :conditions => {:method => :get}
225 226 map.connect 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :conditions => {:method => :post}
226 227
227 228 # Used by AuthSourcesControllerTest
228 229 # TODO : refactor *AuthSourcesController to remove these routes
229 230 map.connect 'auth_sources', :controller => 'auth_sources', :action => 'index', :conditions => {:method => :get}
230 231 map.connect 'auth_sources/new', :controller => 'auth_sources', :action => 'new', :conditions => {:method => :get}
231 232 map.connect 'auth_sources/create', :controller => 'auth_sources', :action => 'create', :conditions => {:method => :post}
232 233 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
233 234 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources', :action => 'test_connection', :conditions => {:method => :get}
234 235 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
235 236 map.connect 'auth_sources/update/:id', :controller => 'auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
236 237
237 238 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources', :action => 'index', :conditions => {:method => :get}
238 239 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources', :action => 'new', :conditions => {:method => :get}
239 240 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources', :action => 'create', :conditions => {:method => :post}
240 241 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
241 242 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources', :action => 'test_connection', :conditions => {:method => :get}
242 243 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
243 244 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
244 245 map.connect 'workflows', :controller => 'workflows', :action => 'index', :conditions => {:method => :get}
245 246 map.connect 'workflows/edit', :controller => 'workflows', :action => 'edit', :conditions => {:method => [:get, :post]}
246 247 map.connect 'workflows/copy', :controller => 'workflows', :action => 'copy', :conditions => {:method => [:get, :post]}
247 map.connect 'enumerations', :controller => 'enumerations', :action => 'index', :conditions => {:method => :get}
248 map.connect 'enumerations/new', :controller => 'enumerations', :action => 'new', :conditions => {:method => :get}
249 map.connect 'enumerations/create', :controller => 'enumerations', :action => 'create', :conditions => {:method => :post}
250 map.connect 'enumerations/edit/:id', :controller => 'enumerations', :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
251 map.connect 'enumerations/update/:id', :controller => 'enumerations', :action => 'update', :id => /\d+/, :conditions => {:method => :post}
252 map.connect 'enumerations/destroy/:id', :controller => 'enumerations', :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
253 248 map.connect 'settings', :controller => 'settings', :action => 'index', :conditions => {:method => :get}
254 249 map.connect 'settings/edit', :controller => 'settings', :action => 'edit', :conditions => {:method => [:get, :post]}
255 250 map.connect 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :conditions => {:method => [:get, :post]}
256 251
257 252 map.with_options :controller => 'sys' do |sys|
258 253 sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
259 254 sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
260 255 sys.connect 'sys/fetch_changesets', :action => 'fetch_changesets', :conditions => {:method => :get}
261 256 end
262 257
263 258 map.connect 'robots.txt', :controller => 'welcome', :action => 'robots', :conditions => {:method => :get}
264 259
265 260 # Used for OpenID
266 261 map.root :controller => 'account', :action => 'login'
267 262 end
@@ -1,101 +1,110
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class EnumerationsControllerTest < ActionController::TestCase
21 21 fixtures :enumerations, :issues, :users
22 22
23 23 def setup
24 24 @request.session[:user_id] = 1 # admin
25 25 end
26 26
27 27 def test_index
28 28 get :index
29 29 assert_response :success
30 30 assert_template 'index'
31 31 end
32 32
33 33 def test_new
34 34 get :new, :type => 'IssuePriority'
35 35 assert_response :success
36 36 assert_template 'new'
37 37 assert_kind_of IssuePriority, assigns(:enumeration)
38 assert_tag 'input', :attributes => {:name => 'enumeration[type]', :value => 'IssuePriority'}
39 assert_tag 'input', :attributes => {:name => 'enumeration[name]'}
38 40 end
39 41
40 42 def test_create
41 43 assert_difference 'IssuePriority.count' do
42 44 post :create, :enumeration => {:type => 'IssuePriority', :name => 'Lowest'}
43 45 end
44 46 assert_redirected_to '/enumerations?type=IssuePriority'
45 47 e = IssuePriority.first(:order => 'id DESC')
46 48 assert_equal 'Lowest', e.name
47 49 end
48 50
49 51 def test_create_with_failure
50 52 assert_no_difference 'IssuePriority.count' do
51 53 post :create, :enumeration => {:type => 'IssuePriority', :name => ''}
52 54 end
53 55 assert_response :success
54 56 assert_template 'new'
55 57 end
56 58
57 59 def test_edit
58 60 get :edit, :id => 6
59 61 assert_response :success
60 62 assert_template 'edit'
63 assert_tag 'input', :attributes => {:name => 'enumeration[name]', :value => 'High'}
61 64 end
62 65
63 66 def test_update
64 67 assert_no_difference 'IssuePriority.count' do
65 post :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'}
68 put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'}
66 69 end
67 70 assert_redirected_to '/enumerations?type=IssuePriority'
68 71 e = IssuePriority.find(6)
69 72 assert_equal 'New name', e.name
70 73 end
71 74
72 75 def test_update_with_failure
73 76 assert_no_difference 'IssuePriority.count' do
74 post :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => ''}
77 put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => ''}
75 78 end
76 79 assert_response :success
77 80 assert_template 'edit'
78 81 end
79 82
80 83 def test_destroy_enumeration_not_in_use
81 post :destroy, :id => 7
84 assert_difference 'IssuePriority.count', -1 do
85 delete :destroy, :id => 7
86 end
82 87 assert_redirected_to :controller => 'enumerations', :action => 'index'
83 88 assert_nil Enumeration.find_by_id(7)
84 89 end
85 90
86 91 def test_destroy_enumeration_in_use
87 post :destroy, :id => 4
92 assert_no_difference 'IssuePriority.count' do
93 delete :destroy, :id => 4
94 end
88 95 assert_response :success
89 96 assert_template 'destroy'
90 97 assert_not_nil Enumeration.find_by_id(4)
91 98 end
92 99
93 100 def test_destroy_enumeration_in_use_with_reassignment
94 101 issue = Issue.find(:first, :conditions => {:priority_id => 4})
95 post :destroy, :id => 4, :reassign_to_id => 6
102 assert_difference 'IssuePriority.count', -1 do
103 delete :destroy, :id => 4, :reassign_to_id => 6
104 end
96 105 assert_redirected_to :controller => 'enumerations', :action => 'index'
97 106 assert_nil Enumeration.find_by_id(4)
98 107 # check that the issue was reassign
99 108 assert_equal 6, issue.reload.priority_id
100 109 end
101 110 end
@@ -1,443 +1,452
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RoutingTest < ActionController::IntegrationTest
21 21 context "activities" do
22 22 should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil
23 23 should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom'
24 24 end
25 25
26 26 context "attachments" do
27 27 should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1'
28 28 should_route :get, "/attachments/1.xml", :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml'
29 29 should_route :get, "/attachments/1.json", :controller => 'attachments', :action => 'show', :id => '1', :format => 'json'
30 30 should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
31 31 should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
32 32 should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
33 33 end
34 34
35 35 context "boards" do
36 36 should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
37 37 should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
38 38 should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
39 39 should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
40 40 should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
41 41
42 42 should_route :post, "/projects/world_domination/boards", :controller => 'boards', :action => 'create', :project_id => 'world_domination'
43 43 should_route :put, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44'
44 44 should_route :delete, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
45 45
46 46 end
47 47
48 48 context "custom_fields" do
49 49 should_route :get, "/custom_fields", :controller => 'custom_fields', :action => 'index'
50 50 should_route :get, "/custom_fields/new", :controller => 'custom_fields', :action => 'new'
51 51 should_route :post, "/custom_fields", :controller => 'custom_fields', :action => 'create'
52 52 should_route :get, "/custom_fields/2/edit", :controller => 'custom_fields', :action => 'edit', :id => 2
53 53 should_route :put, "/custom_fields/2", :controller => 'custom_fields', :action => 'update', :id => 2
54 54 should_route :delete, "/custom_fields/2", :controller => 'custom_fields', :action => 'destroy', :id => 2
55 55 end
56 56
57 57 context "documents" do
58 58 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
59 59 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
60 60 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
61 61 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
62 62
63 63 should_route :post, "/projects/567/documents", :controller => 'documents', :action => 'create', :project_id => '567'
64 64 should_route :put, "/documents/22", :controller => 'documents', :action => 'update', :id => '22'
65 65 should_route :delete, "/documents/22", :controller => 'documents', :action => 'destroy', :id => '22'
66 66
67 67 should_route :post, "/documents/22/add_attachment", :controller => 'documents', :action => 'add_attachment', :id => '22'
68 68 end
69
70 context "roles" do
71 should_route :get, "/enumerations", :controller => 'enumerations', :action => 'index'
72 should_route :get, "/enumerations/new", :controller => 'enumerations', :action => 'new'
73 should_route :post, "/enumerations", :controller => 'enumerations', :action => 'create'
74 should_route :get, "/enumerations/2/edit", :controller => 'enumerations', :action => 'edit', :id => 2
75 should_route :put, "/enumerations/2", :controller => 'enumerations', :action => 'update', :id => 2
76 should_route :delete, "/enumerations/2", :controller => 'enumerations', :action => 'destroy', :id => 2
77 end
69 78
70 79 context "groups" do
71 80 should_route :post, "/groups/567/users", :controller => 'groups', :action => 'add_users', :id => '567'
72 81 should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12'
73 82 end
74 83
75 84 context "issues" do
76 85 # REST actions
77 86 should_route :get, "/issues", :controller => 'issues', :action => 'index'
78 87 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
79 88 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
80 89 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
81 90 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
82 91 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
83 92 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
84 93 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
85 94 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
86 95 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
87 96 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
88 97 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
89 98
90 99 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
91 100 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
92 101 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
93 102
94 103 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
95 104 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
96 105
97 106 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
98 107
99 108 # Extra actions
100 109 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
101 110
102 111 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
103 112 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
104 113
105 114 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
106 115
107 116 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
108 117 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
109 118
110 119 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
111 120 should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf'
112 121 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
113 122 should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf'
114 123
115 124 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
116 125
117 126 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
118 127 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
119 128 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
120 129 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
121 130
122 131 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
123 132
124 133 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
125 134 should_route :post, "/issues/bulk_update", :controller => 'issues', :action => 'bulk_update'
126 135 end
127 136
128 137 context "issue categories" do
129 138 should_route :get, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'index', :project_id => 'foo'
130 139 should_route :get, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'xml'
131 140 should_route :get, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'json'
132 141
133 142 should_route :get, "/projects/foo/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'foo'
134 143
135 144 should_route :post, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'create', :project_id => 'foo'
136 145 should_route :post, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'xml'
137 146 should_route :post, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'json'
138 147
139 148 should_route :get, "/issue_categories/1", :controller => 'issue_categories', :action => 'show', :id => '1'
140 149 should_route :get, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'xml'
141 150 should_route :get, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'json'
142 151
143 152 should_route :get, "/issue_categories/1/edit", :controller => 'issue_categories', :action => 'edit', :id => '1'
144 153
145 154 should_route :put, "/issue_categories/1", :controller => 'issue_categories', :action => 'update', :id => '1'
146 155 should_route :put, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'xml'
147 156 should_route :put, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'json'
148 157
149 158 should_route :delete, "/issue_categories/1", :controller => 'issue_categories', :action => 'destroy', :id => '1'
150 159 should_route :delete, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'xml'
151 160 should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json'
152 161 end
153 162
154 163 context "issue relations" do
155 164 should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1'
156 165 should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml'
157 166 should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json'
158 167
159 168 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1'
160 169 should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml'
161 170 should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json'
162 171
163 172 should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23'
164 173 should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml'
165 174 should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json'
166 175
167 176 should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23'
168 177 should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml'
169 178 should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json'
170 179 end
171 180
172 181 context "issue reports" do
173 182 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
174 183 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
175 184 end
176 185
177 186 context "members" do
178 187 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
179 188 end
180 189
181 190 context "messages" do
182 191 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
183 192 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
184 193 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
185 194
186 195 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
187 196 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
188 197 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
189 198 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
190 199 end
191 200
192 201 context "news" do
193 202 should_route :get, "/news", :controller => 'news', :action => 'index'
194 203 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
195 204 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
196 205 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
197 206 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
198 207 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
199 208 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
200 209 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
201 210 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
202 211 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
203 212 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
204 213 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
205 214 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
206 215
207 216 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
208 217 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
209 218
210 219 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
211 220
212 221 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
213 222 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
214 223 end
215 224
216 225 context "projects" do
217 226 should_route :get, "/projects", :controller => 'projects', :action => 'index'
218 227 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
219 228 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
220 229 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
221 230 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
222 231 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
223 232 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
224 233 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
225 234 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
226 235 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
227 236 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
228 237 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
229 238 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
230 239
231 240 should_route :post, "/projects", :controller => 'projects', :action => 'create'
232 241 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
233 242 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
234 243 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
235 244 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
236 245
237 246 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
238 247 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
239 248 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
240 249
241 250 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
242 251 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
243 252 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
244 253 end
245 254
246 255 context "queries" do
247 256 should_route :get, "/queries.xml", :controller => 'queries', :action => 'index', :format => 'xml'
248 257 should_route :get, "/queries.json", :controller => 'queries', :action => 'index', :format => 'json'
249 258
250 259 should_route :get, "/queries/new", :controller => 'queries', :action => 'new'
251 260 should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
252 261
253 262 should_route :post, "/queries", :controller => 'queries', :action => 'create'
254 263 should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine'
255 264
256 265 should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1'
257 266
258 267 should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1'
259 268
260 269 should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1'
261 270 end
262 271
263 272 context "repositories" do
264 273 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
265 274 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
266 275 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
267 276 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
268 277 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
269 278 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
270 279 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
271 280 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
272 281 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'
273 282 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
274 283 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
275 284 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'
276 285 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'
277 286 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'
278 287 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
279 288 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
280 289 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
281 290
282 291 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
283 292 end
284 293
285 294 context "roles" do
286 295 should_route :get, "/roles", :controller => 'roles', :action => 'index'
287 296 should_route :get, "/roles/new", :controller => 'roles', :action => 'new'
288 297 should_route :post, "/roles", :controller => 'roles', :action => 'create'
289 298 should_route :get, "/roles/2/edit", :controller => 'roles', :action => 'edit', :id => 2
290 299 should_route :put, "/roles/2", :controller => 'roles', :action => 'update', :id => 2
291 300 should_route :delete, "/roles/2", :controller => 'roles', :action => 'destroy', :id => 2
292 301 should_route :get, "/roles/permissions", :controller => 'roles', :action => 'permissions'
293 302 should_route :post, "/roles/permissions", :controller => 'roles', :action => 'permissions'
294 303 end
295 304
296 305 context "timelogs (global)" do
297 306 should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
298 307 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
299 308 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
300 309 should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
301 310 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
302 311
303 312 should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
304 313
305 314 should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
306 315
307 316 should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
308 317 end
309 318
310 319 context "timelogs (scoped under project)" do
311 320 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
312 321 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
313 322 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
314 323 should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
315 324 should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
316 325
317 326 should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
318 327
319 328 should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
320 329
321 330 should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
322 331 end
323 332
324 333 context "timelogs (scoped under issues)" do
325 334 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
326 335 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
327 336 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
328 337 should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
329 338 should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
330 339
331 340 should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
332 341
333 342 should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
334 343
335 344 should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
336 345 end
337 346
338 347 context "timelogs (scoped under project and issues)" do
339 348 should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
340 349 should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
341 350 should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
342 351 should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
343 352 should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
344 353
345 354 should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
346 355
347 356 should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
348 357
349 358 should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
350 359
351 360 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
352 361 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
353 362 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
354 363 end
355 364
356 365 context "users" do
357 366 should_route :get, "/users", :controller => 'users', :action => 'index'
358 367 should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
359 368 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
360 369 should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
361 370 should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
362 371 should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
363 372 should_route :get, "/users/new", :controller => 'users', :action => 'new'
364 373 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
365 374
366 375 should_route :post, "/users", :controller => 'users', :action => 'create'
367 376 should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
368 377
369 378 should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
370 379 should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
371 380
372 381 should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
373 382 should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
374 383
375 384 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
376 385 should_route :put, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
377 386 should_route :delete, "/users/123/memberships/55", :controller => 'users', :action => 'destroy_membership', :id => '123', :membership_id => '55'
378 387 end
379 388
380 389 context "versions" do
381 390 # /projects/foo/versions is /projects/foo/roadmap
382 391 should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
383 392 should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
384 393
385 394 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
386 395
387 396 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
388 397 should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
389 398 should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
390 399
391 400 should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
392 401 should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
393 402 should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
394 403
395 404 should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
396 405
397 406 should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
398 407 should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
399 408 should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
400 409
401 410 should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
402 411 should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
403 412 should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
404 413
405 414 should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
406 415 should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
407 416 end
408 417
409 418 context "wiki (singular, project's pages)" do
410 419 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
411 420 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
412 421 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
413 422 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
414 423 should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
415 424 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
416 425 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1'
417 426 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
418 427 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
419 428 should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
420 429 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
421 430 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
422 431
423 432 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
424 433 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
425 434 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
426 435 should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
427 436
428 437 should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
429 438
430 439 should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
431 440 end
432 441
433 442 context "wikis (plural, admin setup)" do
434 443 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
435 444
436 445 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
437 446 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
438 447 end
439 448
440 449 context "administration panel" do
441 450 should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
442 451 end
443 452 end
General Comments 0
You need to be logged in to leave comments. Login now