##// END OF EJS Templates
route: split issue preview route to adding and editing...
Toshi MARUYAMA -
r8766:84dd4ecbd4a0
parent child
Show More
@@ -1,50 +1,50
1 <% labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %>
1 <% labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %>
2 <%= error_messages_for 'issue', 'time_entry' %>
2 <%= error_messages_for 'issue', 'time_entry' %>
3 <%= render :partial => 'conflict' if @conflict %>
3 <%= render :partial => 'conflict' if @conflict %>
4 <div class="box">
4 <div class="box">
5 <% if @edit_allowed || !@allowed_statuses.empty? %>
5 <% if @edit_allowed || !@allowed_statuses.empty? %>
6 <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend>
6 <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend>
7 <div id="all_attributes">
7 <div id="all_attributes">
8 <%= render :partial => 'form', :locals => {:f => f} %>
8 <%= render :partial => 'form', :locals => {:f => f} %>
9 </div>
9 </div>
10 </fieldset>
10 </fieldset>
11 <% end %>
11 <% end %>
12 <% if User.current.allowed_to?(:log_time, @project) %>
12 <% if User.current.allowed_to?(:log_time, @project) %>
13 <fieldset class="tabular"><legend><%= l(:button_log_time) %></legend>
13 <fieldset class="tabular"><legend><%= l(:button_log_time) %></legend>
14 <% labelled_fields_for :time_entry, @time_entry do |time_entry| %>
14 <% labelled_fields_for :time_entry, @time_entry do |time_entry| %>
15 <div class="splitcontentleft">
15 <div class="splitcontentleft">
16 <p><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p>
16 <p><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p>
17 </div>
17 </div>
18 <div class="splitcontentright">
18 <div class="splitcontentright">
19 <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
19 <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
20 </div>
20 </div>
21 <p><%= time_entry.text_field :comments, :size => 60 %></p>
21 <p><%= time_entry.text_field :comments, :size => 60 %></p>
22 <% @time_entry.custom_field_values.each do |value| %>
22 <% @time_entry.custom_field_values.each do |value| %>
23 <p><%= custom_field_tag_with_label :time_entry, value %></p>
23 <p><%= custom_field_tag_with_label :time_entry, value %></p>
24 <% end %>
24 <% end %>
25 <% end %>
25 <% end %>
26 </fieldset>
26 </fieldset>
27 <% end %>
27 <% end %>
28
28
29 <fieldset><legend><%= l(:field_notes) %></legend>
29 <fieldset><legend><%= l(:field_notes) %></legend>
30 <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
30 <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
31 <%= wikitoolbar_for 'notes' %>
31 <%= wikitoolbar_for 'notes' %>
32 <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %>
32 <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %>
33
33
34 <p><%=l(:label_attachment_plural)%><br /><%= render :partial => 'attachments/form' %></p>
34 <p><%=l(:label_attachment_plural)%><br /><%= render :partial => 'attachments/form' %></p>
35 </fieldset>
35 </fieldset>
36 </div>
36 </div>
37
37
38 <%= f.hidden_field :lock_version %>
38 <%= f.hidden_field :lock_version %>
39 <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %>
39 <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %>
40 <%= submit_tag l(:button_submit) %>
40 <%= submit_tag l(:button_submit) %>
41 <%= link_to_remote l(:label_preview),
41 <%= link_to_remote l(:label_preview),
42 { :url => preview_issue_path(:project_id => @project, :id => @issue),
42 { :url => preview_edit_issue_path(:project_id => @project, :id => @issue),
43 :method => 'post',
43 :method => 'post',
44 :update => 'preview',
44 :update => 'preview',
45 :with => 'Form.serialize("issue-form")',
45 :with => 'Form.serialize("issue-form")',
46 :complete => "Element.scrollTo('preview')"
46 :complete => "Element.scrollTo('preview')"
47 }, :accesskey => accesskey(:preview) %>
47 }, :accesskey => accesskey(:preview) %>
48 <% end %>
48 <% end %>
49
49
50 <div id="preview" class="wiki"></div>
50 <div id="preview" class="wiki"></div>
@@ -1,50 +1,50
1 <h2><%=l(:label_issue_new)%></h2>
1 <h2><%=l(:label_issue_new)%></h2>
2
2
3 <%= call_hook(:view_issues_new_top, {:issue => @issue}) %>
3 <%= call_hook(:view_issues_new_top, {:issue => @issue}) %>
4
4
5 <% labelled_form_for @issue, :url => project_issues_path(@project),
5 <% labelled_form_for @issue, :url => project_issues_path(@project),
6 :html => {:id => 'issue-form', :multipart => true} do |f| %>
6 :html => {:id => 'issue-form', :multipart => true} do |f| %>
7 <%= error_messages_for 'issue' %>
7 <%= error_messages_for 'issue' %>
8 <%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %>
8 <%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %>
9 <div class="box tabular">
9 <div class="box tabular">
10 <div id="all_attributes">
10 <div id="all_attributes">
11 <%= render :partial => 'issues/form', :locals => {:f => f} %>
11 <%= render :partial => 'issues/form', :locals => {:f => f} %>
12 </div>
12 </div>
13
13
14 <% if @copy_from && @copy_from.attachments.any? %>
14 <% if @copy_from && @copy_from.attachments.any? %>
15 <p>
15 <p>
16 <label for="copy_attachments"><%= l(:label_copy_attachments) %></label>
16 <label for="copy_attachments"><%= l(:label_copy_attachments) %></label>
17 <%= check_box_tag 'copy_attachments', '1', @copy_attachments %>
17 <%= check_box_tag 'copy_attachments', '1', @copy_attachments %>
18 </p>
18 </p>
19 <% end %>
19 <% end %>
20
20
21 <p id="attachments_form"><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %></p>
21 <p id="attachments_form"><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %></p>
22
22
23 <% if @issue.safe_attribute? 'watcher_user_ids' -%>
23 <% if @issue.safe_attribute? 'watcher_user_ids' -%>
24 <p id="watchers_form"><label><%= l(:label_issue_watchers) %></label>
24 <p id="watchers_form"><label><%= l(:label_issue_watchers) %></label>
25 <% @issue.project.users.sort.each do |user| -%>
25 <% @issue.project.users.sort.each do |user| -%>
26 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watched_by?(user), :id => nil %> <%=h user %></label>
26 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watched_by?(user), :id => nil %> <%=h user %></label>
27 <% end -%>
27 <% end -%>
28 </p>
28 </p>
29 <% end %>
29 <% end %>
30 </div>
30 </div>
31
31
32 <%= submit_tag l(:button_create) %>
32 <%= submit_tag l(:button_create) %>
33 <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
33 <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
34 <%= link_to_remote l(:label_preview),
34 <%= link_to_remote l(:label_preview),
35 { :url => preview_issue_path(:project_id => @project),
35 { :url => preview_new_issue_path(:project_id => @project),
36 :method => 'post',
36 :method => 'post',
37 :update => 'preview',
37 :update => 'preview',
38 :with => "Form.serialize('issue-form')",
38 :with => "Form.serialize('issue-form')",
39 :complete => "Element.scrollTo('preview')"
39 :complete => "Element.scrollTo('preview')"
40 }, :accesskey => accesskey(:preview) %>
40 }, :accesskey => accesskey(:preview) %>
41
41
42 <%= javascript_tag "Form.Element.focus('issue_subject');" %>
42 <%= javascript_tag "Form.Element.focus('issue_subject');" %>
43 <% end %>
43 <% end %>
44
44
45 <div id="preview" class="wiki"></div>
45 <div id="preview" class="wiki"></div>
46
46
47 <% content_for :header_tags do %>
47 <% content_for :header_tags do %>
48 <%= stylesheet_link_tag 'scm' %>
48 <%= stylesheet_link_tag 'scm' %>
49 <%= robot_exclusion_tag %>
49 <%= robot_exclusion_tag %>
50 <% end %>
50 <% end %>
@@ -1,22 +1,22
1 <% form_remote_tag(:url => {}, :html => { :id => "journal-#{@journal.id}-form" }) do %>
1 <% form_remote_tag(:url => {}, :html => { :id => "journal-#{@journal.id}-form" }) do %>
2 <%= label_tag "notes", l(:description_notes), :class => "hidden-for-sighted" %>
2 <%= label_tag "notes", l(:description_notes), :class => "hidden-for-sighted" %>
3 <%= text_area_tag :notes, @journal.notes,
3 <%= text_area_tag :notes, @journal.notes,
4 :id => "journal_#{@journal.id}_notes",
4 :id => "journal_#{@journal.id}_notes",
5 :class => 'wiki-edit',
5 :class => 'wiki-edit',
6 :rows => (@journal.notes.blank? ? 10 : [[10, @journal.notes.length / 50].max, 100].min) %>
6 :rows => (@journal.notes.blank? ? 10 : [[10, @journal.notes.length / 50].max, 100].min) %>
7 <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %>
7 <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %>
8 <p><%= submit_tag l(:button_save) %>
8 <p><%= submit_tag l(:button_save) %>
9 <%= link_to_remote l(:label_preview),
9 <%= link_to_remote l(:label_preview),
10 { :url => preview_issue_path(:project_id => @project, :id => @journal.issue),
10 { :url => preview_edit_issue_path(:project_id => @project, :id => @journal.issue),
11 :method => 'post',
11 :method => 'post',
12 :update => "journal_#{@journal.id}_preview",
12 :update => "journal_#{@journal.id}_preview",
13 :with => "Form.serialize('journal-#{@journal.id}-form')",
13 :with => "Form.serialize('journal-#{@journal.id}-form')",
14 :complete => "Element.scrollTo('journal_#{@journal.id}_preview')"
14 :complete => "Element.scrollTo('journal_#{@journal.id}_preview')"
15 }, :accesskey => accesskey(:preview) %>
15 }, :accesskey => accesskey(:preview) %>
16 |
16 |
17 <%= link_to l(:button_cancel), '#', :onclick => "Element.remove('journal-#{@journal.id}-form'); " +
17 <%= link_to l(:button_cancel), '#', :onclick => "Element.remove('journal-#{@journal.id}-form'); " +
18 "Element.show('journal-#{@journal.id}-notes'); return false;" %></p>
18 "Element.show('journal-#{@journal.id}-notes'); return false;" %></p>
19
19
20 <div id="journal_<%= @journal.id %>_preview" class="wiki"></div>
20 <div id="journal_<%= @journal.id %>_preview" class="wiki"></div>
21 <% end %>
21 <% end %>
22 <%= wikitoolbar_for "journal_#{@journal.id}_notes" %>
22 <%= wikitoolbar_for "journal_#{@journal.id}_notes" %>
@@ -1,415 +1,417
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', :conditions => {:method => :get}
9 map.home '', :controller => 'welcome', :conditions => {:method => :get}
10
10
11 map.signin 'login', :controller => 'account', :action => 'login',
11 map.signin 'login', :controller => 'account', :action => 'login',
12 :conditions => {:method => [:get, :post]}
12 :conditions => {:method => [:get, :post]}
13 map.signout 'logout', :controller => 'account', :action => 'logout',
13 map.signout 'logout', :controller => 'account', :action => 'logout',
14 :conditions => {:method => :get}
14 :conditions => {:method => :get}
15 map.connect 'account/register', :controller => 'account', :action => 'register',
15 map.connect 'account/register', :controller => 'account', :action => 'register',
16 :conditions => {:method => [:get, :post]}
16 :conditions => {:method => [:get, :post]}
17 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password',
17 map.connect 'account/lost_password', :controller => 'account', :action => 'lost_password',
18 :conditions => {:method => [:get, :post]}
18 :conditions => {:method => [:get, :post]}
19 map.connect 'account/activate', :controller => 'account', :action => 'activate',
19 map.connect 'account/activate', :controller => 'account', :action => 'activate',
20 :conditions => {:method => :get}
20 :conditions => {:method => :get}
21
21
22 map.connect 'projects/:id/wiki', :controller => 'wikis',
22 map.connect 'projects/:id/wiki', :controller => 'wikis',
23 :action => 'edit', :conditions => {:method => :post}
23 :action => 'edit', :conditions => {:method => :post}
24 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis',
24 map.connect 'projects/:id/wiki/destroy', :controller => 'wikis',
25 :action => 'destroy', :conditions => {:method => [:get, :post]}
25 :action => 'destroy', :conditions => {:method => [:get, :post]}
26
26
27 map.with_options :controller => 'messages' do |messages_routes|
27 map.with_options :controller => 'messages' do |messages_routes|
28 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
28 messages_routes.with_options :conditions => {:method => :get} do |messages_views|
29 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
29 messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
30 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
30 messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
31 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
31 messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
32 end
32 end
33 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
33 messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
34 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
34 messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
35 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
35 messages_actions.connect 'boards/:board_id/topics/preview', :action => 'preview'
36 messages_actions.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
36 messages_actions.connect 'boards/:board_id/topics/quote/:id', :action => 'quote'
37 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
37 messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
38 messages_actions.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
38 messages_actions.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
39 messages_actions.connect 'boards/:board_id/topics/:id/destroy', :action => 'destroy'
39 messages_actions.connect 'boards/:board_id/topics/:id/destroy', :action => 'destroy'
40 end
40 end
41 end
41 end
42
42
43 # Misc issue routes. TODO: move into resources
43 # Misc issue routes. TODO: move into resources
44 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes',
44 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes',
45 :action => 'issues', :conditions => { :method => :get }
45 :action => 'issues', :conditions => { :method => :get }
46 # TODO: would look nicer as /issues/:id/preview
46 # TODO: would look nicer as /issues/:id/preview
47 map.preview_issue '/issues/preview/:id', :controller => 'previews',
47 map.preview_new_issue '/issues/preview/new/:project_id', :controller => 'previews',
48 :action => 'issue'
48 :action => 'issue'
49 map.preview_edit_issue '/issues/preview/edit/:id', :controller => 'previews',
50 :action => 'issue'
49 map.issues_context_menu '/issues/context_menu',
51 map.issues_context_menu '/issues/context_menu',
50 :controller => 'context_menus', :action => 'issues'
52 :controller => 'context_menus', :action => 'issues'
51
53
52 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
54 map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
53 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new',
55 map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new',
54 :id => /\d+/, :conditions => { :method => :post }
56 :id => /\d+/, :conditions => { :method => :post }
55
57
56 map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff',
58 map.connect '/journals/diff/:id', :controller => 'journals', :action => 'diff',
57 :id => /\d+/, :conditions => { :method => :get }
59 :id => /\d+/, :conditions => { :method => :get }
58 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit',
60 map.connect '/journals/edit/:id', :controller => 'journals', :action => 'edit',
59 :id => /\d+/, :conditions => { :method => [:get, :post] }
61 :id => /\d+/, :conditions => { :method => [:get, :post] }
60
62
61 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
63 map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
62 gantts_routes.connect '/projects/:project_id/issues/gantt'
64 gantts_routes.connect '/projects/:project_id/issues/gantt'
63 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
65 gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
64 gantts_routes.connect '/issues/gantt.:format'
66 gantts_routes.connect '/issues/gantt.:format'
65 end
67 end
66
68
67 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
69 map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
68 calendars_routes.connect '/projects/:project_id/issues/calendar'
70 calendars_routes.connect '/projects/:project_id/issues/calendar'
69 calendars_routes.connect '/issues/calendar'
71 calendars_routes.connect '/issues/calendar'
70 end
72 end
71
73
72 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
74 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
73 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
75 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
74 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
76 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
75 end
77 end
76
78
77 map.connect 'my/account', :controller => 'my', :action => 'account',
79 map.connect 'my/account', :controller => 'my', :action => 'account',
78 :conditions => {:method => [:get, :post]}
80 :conditions => {:method => [:get, :post]}
79 map.connect 'my/page', :controller => 'my', :action => 'page',
81 map.connect 'my/page', :controller => 'my', :action => 'page',
80 :conditions => {:method => :get}
82 :conditions => {:method => :get}
81 # Redirects to my/page
83 # Redirects to my/page
82 map.connect 'my', :controller => 'my', :action => 'index',
84 map.connect 'my', :controller => 'my', :action => 'index',
83 :conditions => {:method => :get}
85 :conditions => {:method => :get}
84 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key',
86 map.connect 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key',
85 :conditions => {:method => :post}
87 :conditions => {:method => :post}
86 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key',
88 map.connect 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key',
87 :conditions => {:method => :post}
89 :conditions => {:method => :post}
88 map.connect 'my/password', :controller => 'my', :action => 'password',
90 map.connect 'my/password', :controller => 'my', :action => 'password',
89 :conditions => {:method => [:get, :post]}
91 :conditions => {:method => [:get, :post]}
90 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout',
92 map.connect 'my/page_layout', :controller => 'my', :action => 'page_layout',
91 :conditions => {:method => :get}
93 :conditions => {:method => :get}
92 map.connect 'my/add_block', :controller => 'my', :action => 'add_block',
94 map.connect 'my/add_block', :controller => 'my', :action => 'add_block',
93 :conditions => {:method => :post}
95 :conditions => {:method => :post}
94 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block',
96 map.connect 'my/remove_block', :controller => 'my', :action => 'remove_block',
95 :conditions => {:method => :post}
97 :conditions => {:method => :post}
96 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks',
98 map.connect 'my/order_blocks', :controller => 'my', :action => 'order_blocks',
97 :conditions => {:method => :post}
99 :conditions => {:method => :post}
98
100
99 map.with_options :controller => 'users' do |users|
101 map.with_options :controller => 'users' do |users|
100 users.user_membership 'users/:id/memberships/:membership_id',
102 users.user_membership 'users/:id/memberships/:membership_id',
101 :action => 'edit_membership',
103 :action => 'edit_membership',
102 :conditions => {:method => :put}
104 :conditions => {:method => :put}
103 users.connect 'users/:id/memberships/:membership_id',
105 users.connect 'users/:id/memberships/:membership_id',
104 :action => 'destroy_membership',
106 :action => 'destroy_membership',
105 :conditions => {:method => :delete}
107 :conditions => {:method => :delete}
106 users.user_memberships 'users/:id/memberships',
108 users.user_memberships 'users/:id/memberships',
107 :action => 'edit_membership',
109 :action => 'edit_membership',
108 :conditions => {:method => :post}
110 :conditions => {:method => :post}
109 end
111 end
110 map.resources :users
112 map.resources :users
111
113
112 # For nice "roadmap" in the url for the index action
114 # For nice "roadmap" in the url for the index action
113 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
115 map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
114
116
115 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
117 map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
116 map.connect 'news/:id/comments', :controller => 'comments',
118 map.connect 'news/:id/comments', :controller => 'comments',
117 :action => 'create', :conditions => {:method => :post}
119 :action => 'create', :conditions => {:method => :post}
118 map.connect 'news/:id/comments/:comment_id', :controller => 'comments',
120 map.connect 'news/:id/comments/:comment_id', :controller => 'comments',
119 :action => 'destroy', :conditions => {:method => :delete}
121 :action => 'destroy', :conditions => {:method => :delete}
120
122
121 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new',
123 map.connect 'watchers/new', :controller=> 'watchers', :action => 'new',
122 :conditions => {:method => :get}
124 :conditions => {:method => :get}
123 map.connect 'watchers', :controller=> 'watchers', :action => 'create',
125 map.connect 'watchers', :controller=> 'watchers', :action => 'create',
124 :conditions => {:method => :post}
126 :conditions => {:method => :post}
125 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy',
127 map.connect 'watchers/destroy', :controller=> 'watchers', :action => 'destroy',
126 :conditions => {:method => :post}
128 :conditions => {:method => :post}
127 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch',
129 map.connect 'watchers/watch', :controller=> 'watchers', :action => 'watch',
128 :conditions => {:method => :post}
130 :conditions => {:method => :post}
129 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch',
131 map.connect 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch',
130 :conditions => {:method => :post}
132 :conditions => {:method => :post}
131 map.connect 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user',
133 map.connect 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user',
132 :conditions => {:method => :get}
134 :conditions => {:method => :get}
133
135
134 # TODO: port to be part of the resources route(s)
136 # TODO: port to be part of the resources route(s)
135 map.with_options :conditions => {:method => :get} do |project_views|
137 map.with_options :conditions => {:method => :get} do |project_views|
136 project_views.connect 'projects/:id/settings/:tab',
138 project_views.connect 'projects/:id/settings/:tab',
137 :controller => 'projects', :action => 'settings'
139 :controller => 'projects', :action => 'settings'
138 project_views.connect 'projects/:project_id/issues/:copy_from/copy',
140 project_views.connect 'projects/:project_id/issues/:copy_from/copy',
139 :controller => 'issues', :action => 'new'
141 :controller => 'issues', :action => 'new'
140 end
142 end
141
143
142 map.resources :projects, :member => {
144 map.resources :projects, :member => {
143 :copy => [:get, :post],
145 :copy => [:get, :post],
144 :settings => :get,
146 :settings => :get,
145 :modules => :post,
147 :modules => :post,
146 :archive => :post,
148 :archive => :post,
147 :unarchive => :post
149 :unarchive => :post
148 } do |project|
150 } do |project|
149 project.resource :enumerations, :controller => 'project_enumerations',
151 project.resource :enumerations, :controller => 'project_enumerations',
150 :only => [:update, :destroy]
152 :only => [:update, :destroy]
151 # issue form update
153 # issue form update
152 project.issue_form 'issues/new', :controller => 'issues',
154 project.issue_form 'issues/new', :controller => 'issues',
153 :action => 'new', :conditions => {:method => [:post, :put]}
155 :action => 'new', :conditions => {:method => [:post, :put]}
154 project.resources :issues, :only => [:index, :new, :create] do |issues|
156 project.resources :issues, :only => [:index, :new, :create] do |issues|
155 issues.resources :time_entries, :controller => 'timelog',
157 issues.resources :time_entries, :controller => 'timelog',
156 :collection => {:report => :get}
158 :collection => {:report => :get}
157 end
159 end
158
160
159 project.resources :files, :only => [:index, :new, :create]
161 project.resources :files, :only => [:index, :new, :create]
160 project.resources :versions, :shallow => true,
162 project.resources :versions, :shallow => true,
161 :collection => {:close_completed => :put},
163 :collection => {:close_completed => :put},
162 :member => {:status_by => :post}
164 :member => {:status_by => :post}
163 project.resources :news, :shallow => true
165 project.resources :news, :shallow => true
164 project.resources :time_entries, :controller => 'timelog',
166 project.resources :time_entries, :controller => 'timelog',
165 :collection => {:report => :get}
167 :collection => {:report => :get}
166 project.resources :queries, :only => [:new, :create]
168 project.resources :queries, :only => [:new, :create]
167 project.resources :issue_categories, :shallow => true
169 project.resources :issue_categories, :shallow => true
168 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
170 project.resources :documents, :shallow => true, :member => {:add_attachment => :post}
169 project.resources :boards
171 project.resources :boards
170 project.resources :repositories, :shallow => true, :except => [:index, :show],
172 project.resources :repositories, :shallow => true, :except => [:index, :show],
171 :member => {:committers => [:get, :post]}
173 :member => {:committers => [:get, :post]}
172 project.resources :memberships, :shallow => true, :controller => 'members',
174 project.resources :memberships, :shallow => true, :controller => 'members',
173 :only => [:index, :show, :create, :update, :destroy],
175 :only => [:index, :show, :create, :update, :destroy],
174 :collection => {:autocomplete => :get}
176 :collection => {:autocomplete => :get}
175
177
176 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
178 project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
177 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
179 project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
178 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
180 project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
179 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
181 project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
180 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
182 project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
181 project.resources :wiki, :except => [:new, :create], :member => {
183 project.resources :wiki, :except => [:new, :create], :member => {
182 :rename => [:get, :post],
184 :rename => [:get, :post],
183 :history => :get,
185 :history => :get,
184 :preview => :any,
186 :preview => :any,
185 :protect => :post,
187 :protect => :post,
186 :add_attachment => :post
188 :add_attachment => :post
187 }, :collection => {
189 }, :collection => {
188 :export => :get,
190 :export => :get,
189 :date_index => :get
191 :date_index => :get
190 }
192 }
191 end
193 end
192
194
193 map.connect 'news', :controller => 'news', :action => 'index'
195 map.connect 'news', :controller => 'news', :action => 'index'
194 map.connect 'news.:format', :controller => 'news', :action => 'index'
196 map.connect 'news.:format', :controller => 'news', :action => 'index'
195
197
196 map.resources :queries, :except => [:show]
198 map.resources :queries, :except => [:show]
197 map.resources :issues,
199 map.resources :issues,
198 :collection => {:bulk_edit => [:get, :post], :bulk_update => :post} do |issues|
200 :collection => {:bulk_edit => [:get, :post], :bulk_update => :post} do |issues|
199 issues.resources :time_entries, :controller => 'timelog',
201 issues.resources :time_entries, :controller => 'timelog',
200 :collection => {:report => :get}
202 :collection => {:report => :get}
201 issues.resources :relations, :shallow => true,
203 issues.resources :relations, :shallow => true,
202 :controller => 'issue_relations',
204 :controller => 'issue_relations',
203 :only => [:index, :show, :create, :destroy]
205 :only => [:index, :show, :create, :destroy]
204 end
206 end
205 # Bulk deletion
207 # Bulk deletion
206 map.connect '/issues', :controller => 'issues', :action => 'destroy',
208 map.connect '/issues', :controller => 'issues', :action => 'destroy',
207 :conditions => {:method => :delete}
209 :conditions => {:method => :delete}
208
210
209 map.connect '/time_entries/destroy',
211 map.connect '/time_entries/destroy',
210 :controller => 'timelog', :action => 'destroy',
212 :controller => 'timelog', :action => 'destroy',
211 :conditions => { :method => :delete }
213 :conditions => { :method => :delete }
212 map.time_entries_context_menu '/time_entries/context_menu',
214 map.time_entries_context_menu '/time_entries/context_menu',
213 :controller => 'context_menus', :action => 'time_entries'
215 :controller => 'context_menus', :action => 'time_entries'
214
216
215 map.resources :time_entries, :controller => 'timelog',
217 map.resources :time_entries, :controller => 'timelog',
216 :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
218 :collection => {:report => :get, :bulk_edit => :get, :bulk_update => :post}
217
219
218 map.with_options :controller => 'activities', :action => 'index',
220 map.with_options :controller => 'activities', :action => 'index',
219 :conditions => {:method => :get} do |activity|
221 :conditions => {:method => :get} do |activity|
220 activity.connect 'projects/:id/activity'
222 activity.connect 'projects/:id/activity'
221 activity.connect 'projects/:id/activity.:format'
223 activity.connect 'projects/:id/activity.:format'
222 activity.connect 'activity', :id => nil
224 activity.connect 'activity', :id => nil
223 activity.connect 'activity.:format', :id => nil
225 activity.connect 'activity.:format', :id => nil
224 end
226 end
225
227
226 map.with_options :controller => 'repositories' do |repositories|
228 map.with_options :controller => 'repositories' do |repositories|
227 repositories.with_options :conditions => {:method => :get} do |repository_views|
229 repositories.with_options :conditions => {:method => :get} do |repository_views|
228 repository_views.connect 'projects/:id/repository',
230 repository_views.connect 'projects/:id/repository',
229 :action => 'show'
231 :action => 'show'
230
232
231 repository_views.connect 'projects/:id/repository/:repository_id/statistics',
233 repository_views.connect 'projects/:id/repository/:repository_id/statistics',
232 :action => 'stats'
234 :action => 'stats'
233 repository_views.connect 'projects/:id/repository/:repository_id/graph',
235 repository_views.connect 'projects/:id/repository/:repository_id/graph',
234 :action => 'graph'
236 :action => 'graph'
235
237
236 repository_views.connect 'projects/:id/repository/statistics',
238 repository_views.connect 'projects/:id/repository/statistics',
237 :action => 'stats'
239 :action => 'stats'
238 repository_views.connect 'projects/:id/repository/graph',
240 repository_views.connect 'projects/:id/repository/graph',
239 :action => 'graph'
241 :action => 'graph'
240
242
241 repository_views.connect 'projects/:id/repository/:repository_id/revisions',
243 repository_views.connect 'projects/:id/repository/:repository_id/revisions',
242 :action => 'revisions'
244 :action => 'revisions'
243 repository_views.connect 'projects/:id/repository/:repository_id/revisions.:format',
245 repository_views.connect 'projects/:id/repository/:repository_id/revisions.:format',
244 :action => 'revisions'
246 :action => 'revisions'
245 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev',
247 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev',
246 :action => 'revision'
248 :action => 'revision'
247 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues',
249 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues',
248 :action => 'add_related_issue', :conditions => {:method => :post}
250 :action => 'add_related_issue', :conditions => {:method => :post}
249 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id',
251 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id',
250 :action => 'remove_related_issue', :conditions => {:method => :delete}
252 :action => 'remove_related_issue', :conditions => {:method => :delete}
251 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff',
253 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff',
252 :action => 'diff'
254 :action => 'diff'
253 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff.:format',
255 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/diff.:format',
254 :action => 'diff'
256 :action => 'diff'
255 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/raw/*path',
257 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/raw/*path',
256 :action => 'entry', :format => 'raw'
258 :action => 'entry', :format => 'raw'
257 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/:action/*path',
259 repository_views.connect 'projects/:id/repository/:repository_id/revisions/:rev/:action/*path',
258 :requirements => {
260 :requirements => {
259 :action => /(browse|show|entry|changes|annotate|diff)/,
261 :action => /(browse|show|entry|changes|annotate|diff)/,
260 :rev => /[a-z0-9\.\-_]+/
262 :rev => /[a-z0-9\.\-_]+/
261 }
263 }
262 repository_views.connect 'projects/:id/repository/:repository_id/raw/*path',
264 repository_views.connect 'projects/:id/repository/:repository_id/raw/*path',
263 :action => 'entry', :format => 'raw'
265 :action => 'entry', :format => 'raw'
264 repository_views.connect 'projects/:id/repository/:repository_id/:action/*path',
266 repository_views.connect 'projects/:id/repository/:repository_id/:action/*path',
265 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
267 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
266
268
267 repository_views.connect 'projects/:id/repository/revisions',
269 repository_views.connect 'projects/:id/repository/revisions',
268 :action => 'revisions'
270 :action => 'revisions'
269 repository_views.connect 'projects/:id/repository/revisions.:format',
271 repository_views.connect 'projects/:id/repository/revisions.:format',
270 :action => 'revisions'
272 :action => 'revisions'
271 repository_views.connect 'projects/:id/repository/revisions/:rev',
273 repository_views.connect 'projects/:id/repository/revisions/:rev',
272 :action => 'revision'
274 :action => 'revision'
273 repository_views.connect 'projects/:id/repository/revisions/:rev/issues',
275 repository_views.connect 'projects/:id/repository/revisions/:rev/issues',
274 :action => 'add_related_issue', :conditions => {:method => :post}
276 :action => 'add_related_issue', :conditions => {:method => :post}
275 repository_views.connect 'projects/:id/repository/revisions/:rev/issues/:issue_id',
277 repository_views.connect 'projects/:id/repository/revisions/:rev/issues/:issue_id',
276 :action => 'remove_related_issue', :conditions => {:method => :delete}
278 :action => 'remove_related_issue', :conditions => {:method => :delete}
277 repository_views.connect 'projects/:id/repository/revisions/:rev/diff',
279 repository_views.connect 'projects/:id/repository/revisions/:rev/diff',
278 :action => 'diff'
280 :action => 'diff'
279 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format',
281 repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format',
280 :action => 'diff'
282 :action => 'diff'
281 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path',
283 repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path',
282 :action => 'entry', :format => 'raw'
284 :action => 'entry', :format => 'raw'
283 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path',
285 repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path',
284 :requirements => {
286 :requirements => {
285 :action => /(browse|show|entry|changes|annotate|diff)/,
287 :action => /(browse|show|entry|changes|annotate|diff)/,
286 :rev => /[a-z0-9\.\-_]+/
288 :rev => /[a-z0-9\.\-_]+/
287 }
289 }
288 repository_views.connect 'projects/:id/repository/raw/*path',
290 repository_views.connect 'projects/:id/repository/raw/*path',
289 :action => 'entry', :format => 'raw'
291 :action => 'entry', :format => 'raw'
290 repository_views.connect 'projects/:id/repository/:action/*path',
292 repository_views.connect 'projects/:id/repository/:action/*path',
291 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
293 :requirements => { :action => /(browse|show|entry|changes|annotate|diff)/ }
292
294
293 repository_views.connect 'projects/:id/repository/:repository_id',
295 repository_views.connect 'projects/:id/repository/:repository_id',
294 :action => 'show'
296 :action => 'show'
295 end
297 end
296
298
297 repositories.connect 'projects/:id/repository/revision',
299 repositories.connect 'projects/:id/repository/revision',
298 :action => 'revision',
300 :action => 'revision',
299 :conditions => {:method => [:get, :post]}
301 :conditions => {:method => [:get, :post]}
300 end
302 end
301
303
302 # additional routes for having the file name at the end of url
304 # additional routes for having the file name at the end of url
303 map.connect 'attachments/:id/:filename', :controller => 'attachments',
305 map.connect 'attachments/:id/:filename', :controller => 'attachments',
304 :action => 'show', :id => /\d+/, :filename => /.*/,
306 :action => 'show', :id => /\d+/, :filename => /.*/,
305 :conditions => {:method => :get}
307 :conditions => {:method => :get}
306 map.connect 'attachments/download/:id/:filename', :controller => 'attachments',
308 map.connect 'attachments/download/:id/:filename', :controller => 'attachments',
307 :action => 'download', :id => /\d+/, :filename => /.*/,
309 :action => 'download', :id => /\d+/, :filename => /.*/,
308 :conditions => {:method => :get}
310 :conditions => {:method => :get}
309 map.connect 'attachments/download/:id', :controller => 'attachments',
311 map.connect 'attachments/download/:id', :controller => 'attachments',
310 :action => 'download', :id => /\d+/,
312 :action => 'download', :id => /\d+/,
311 :conditions => {:method => :get}
313 :conditions => {:method => :get}
312 map.resources :attachments, :only => [:show, :destroy]
314 map.resources :attachments, :only => [:show, :destroy]
313
315
314 map.resources :groups, :member => {:autocomplete_for_user => :get}
316 map.resources :groups, :member => {:autocomplete_for_user => :get}
315 map.group_users 'groups/:id/users', :controller => 'groups',
317 map.group_users 'groups/:id/users', :controller => 'groups',
316 :action => 'add_users', :id => /\d+/,
318 :action => 'add_users', :id => /\d+/,
317 :conditions => {:method => :post}
319 :conditions => {:method => :post}
318 map.group_user 'groups/:id/users/:user_id', :controller => 'groups',
320 map.group_user 'groups/:id/users/:user_id', :controller => 'groups',
319 :action => 'remove_user', :id => /\d+/,
321 :action => 'remove_user', :id => /\d+/,
320 :conditions => {:method => :delete}
322 :conditions => {:method => :delete}
321 map.connect 'groups/destroy_membership/:id', :controller => 'groups',
323 map.connect 'groups/destroy_membership/:id', :controller => 'groups',
322 :action => 'destroy_membership', :id => /\d+/,
324 :action => 'destroy_membership', :id => /\d+/,
323 :conditions => {:method => :post}
325 :conditions => {:method => :post}
324 map.connect 'groups/edit_membership/:id', :controller => 'groups',
326 map.connect 'groups/edit_membership/:id', :controller => 'groups',
325 :action => 'edit_membership', :id => /\d+/,
327 :action => 'edit_membership', :id => /\d+/,
326 :conditions => {:method => :post}
328 :conditions => {:method => :post}
327
329
328 map.resources :trackers, :except => :show
330 map.resources :trackers, :except => :show
329 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
331 map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
330 map.resources :custom_fields, :except => :show
332 map.resources :custom_fields, :except => :show
331 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
333 map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]}
332 map.resources :enumerations, :except => :show
334 map.resources :enumerations, :except => :show
333
335
334 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
336 map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get}
335
337
336 map.connect 'mail_handler', :controller => 'mail_handler',
338 map.connect 'mail_handler', :controller => 'mail_handler',
337 :action => 'index', :conditions => {:method => :post}
339 :action => 'index', :conditions => {:method => :post}
338
340
339 map.connect 'admin', :controller => 'admin', :action => 'index',
341 map.connect 'admin', :controller => 'admin', :action => 'index',
340 :conditions => {:method => :get}
342 :conditions => {:method => :get}
341 map.connect 'admin/projects', :controller => 'admin', :action => 'projects',
343 map.connect 'admin/projects', :controller => 'admin', :action => 'projects',
342 :conditions => {:method => :get}
344 :conditions => {:method => :get}
343 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins',
345 map.connect 'admin/plugins', :controller => 'admin', :action => 'plugins',
344 :conditions => {:method => :get}
346 :conditions => {:method => :get}
345 map.connect 'admin/info', :controller => 'admin', :action => 'info',
347 map.connect 'admin/info', :controller => 'admin', :action => 'info',
346 :conditions => {:method => :get}
348 :conditions => {:method => :get}
347 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email',
349 map.connect 'admin/test_email', :controller => 'admin', :action => 'test_email',
348 :conditions => {:method => :get}
350 :conditions => {:method => :get}
349 map.connect 'admin/default_configuration', :controller => 'admin',
351 map.connect 'admin/default_configuration', :controller => 'admin',
350 :action => 'default_configuration', :conditions => {:method => :post}
352 :action => 'default_configuration', :conditions => {:method => :post}
351
353
352 # Used by AuthSourcesControllerTest
354 # Used by AuthSourcesControllerTest
353 # TODO : refactor *AuthSourcesController to remove these routes
355 # TODO : refactor *AuthSourcesController to remove these routes
354 map.connect 'auth_sources', :controller => 'auth_sources',
356 map.connect 'auth_sources', :controller => 'auth_sources',
355 :action => 'index', :conditions => {:method => :get}
357 :action => 'index', :conditions => {:method => :get}
356 map.connect 'auth_sources/new', :controller => 'auth_sources',
358 map.connect 'auth_sources/new', :controller => 'auth_sources',
357 :action => 'new', :conditions => {:method => :get}
359 :action => 'new', :conditions => {:method => :get}
358 map.connect 'auth_sources/create', :controller => 'auth_sources',
360 map.connect 'auth_sources/create', :controller => 'auth_sources',
359 :action => 'create', :conditions => {:method => :post}
361 :action => 'create', :conditions => {:method => :post}
360 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources',
362 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources',
361 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
363 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
362 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources',
364 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources',
363 :action => 'test_connection', :conditions => {:method => :get}
365 :action => 'test_connection', :conditions => {:method => :get}
364 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources',
366 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources',
365 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
367 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
366 map.connect 'auth_sources/update/:id', :controller => 'auth_sources',
368 map.connect 'auth_sources/update/:id', :controller => 'auth_sources',
367 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
369 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
368
370
369 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources',
371 map.connect 'ldap_auth_sources', :controller => 'ldap_auth_sources',
370 :action => 'index', :conditions => {:method => :get}
372 :action => 'index', :conditions => {:method => :get}
371 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources',
373 map.connect 'ldap_auth_sources/new', :controller => 'ldap_auth_sources',
372 :action => 'new', :conditions => {:method => :get}
374 :action => 'new', :conditions => {:method => :get}
373 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources',
375 map.connect 'ldap_auth_sources/create', :controller => 'ldap_auth_sources',
374 :action => 'create', :conditions => {:method => :post}
376 :action => 'create', :conditions => {:method => :post}
375 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources',
377 map.connect 'ldap_auth_sources/destroy/:id', :controller => 'ldap_auth_sources',
376 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
378 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
377 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources',
379 map.connect 'ldap_auth_sources/test_connection/:id', :controller => 'ldap_auth_sources',
378 :action => 'test_connection', :conditions => {:method => :get}
380 :action => 'test_connection', :conditions => {:method => :get}
379 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources',
381 map.connect 'ldap_auth_sources/edit/:id', :controller => 'ldap_auth_sources',
380 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
382 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
381 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources',
383 map.connect 'ldap_auth_sources/update/:id', :controller => 'ldap_auth_sources',
382 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
384 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
383
385
384 map.connect 'workflows', :controller => 'workflows',
386 map.connect 'workflows', :controller => 'workflows',
385 :action => 'index', :conditions => {:method => :get}
387 :action => 'index', :conditions => {:method => :get}
386 map.connect 'workflows/edit', :controller => 'workflows',
388 map.connect 'workflows/edit', :controller => 'workflows',
387 :action => 'edit', :conditions => {:method => [:get, :post]}
389 :action => 'edit', :conditions => {:method => [:get, :post]}
388 map.connect 'workflows/copy', :controller => 'workflows',
390 map.connect 'workflows/copy', :controller => 'workflows',
389 :action => 'copy', :conditions => {:method => [:get, :post]}
391 :action => 'copy', :conditions => {:method => [:get, :post]}
390
392
391 map.connect 'settings', :controller => 'settings',
393 map.connect 'settings', :controller => 'settings',
392 :action => 'index', :conditions => {:method => :get}
394 :action => 'index', :conditions => {:method => :get}
393 map.connect 'settings/edit', :controller => 'settings',
395 map.connect 'settings/edit', :controller => 'settings',
394 :action => 'edit', :conditions => {:method => [:get, :post]}
396 :action => 'edit', :conditions => {:method => [:get, :post]}
395 map.connect 'settings/plugin/:id', :controller => 'settings',
397 map.connect 'settings/plugin/:id', :controller => 'settings',
396 :action => 'plugin', :conditions => {:method => [:get, :post]}
398 :action => 'plugin', :conditions => {:method => [:get, :post]}
397
399
398 map.with_options :controller => 'sys' do |sys|
400 map.with_options :controller => 'sys' do |sys|
399 sys.connect 'sys/projects.:format',
401 sys.connect 'sys/projects.:format',
400 :action => 'projects',
402 :action => 'projects',
401 :conditions => {:method => :get}
403 :conditions => {:method => :get}
402 sys.connect 'sys/projects/:id/repository.:format',
404 sys.connect 'sys/projects/:id/repository.:format',
403 :action => 'create_project_repository',
405 :action => 'create_project_repository',
404 :conditions => {:method => :post}
406 :conditions => {:method => :post}
405 sys.connect 'sys/fetch_changesets',
407 sys.connect 'sys/fetch_changesets',
406 :action => 'fetch_changesets',
408 :action => 'fetch_changesets',
407 :conditions => {:method => :get}
409 :conditions => {:method => :get}
408 end
410 end
409
411
410 map.connect 'robots.txt', :controller => 'welcome',
412 map.connect 'robots.txt', :controller => 'welcome',
411 :action => 'robots', :conditions => {:method => :get}
413 :action => 'robots', :conditions => {:method => :get}
412
414
413 # Used for OpenID
415 # Used for OpenID
414 map.root :controller => 'account', :action => 'login'
416 map.root :controller => 'account', :action => 'login'
415 end
417 end
@@ -1,33 +1,37
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingPreviewsTest < ActionController::IntegrationTest
20 class RoutingPreviewsTest < ActionController::IntegrationTest
21 def test_previews
21 def test_previews
22 ["get", "post"].each do |method|
22 ["get", "post"].each do |method|
23 assert_routing(
23 assert_routing(
24 { :method => method, :path => "/issues/preview/123" },
24 { :method => method, :path => "/issues/preview/new/123" },
25 { :controller => 'previews', :action => 'issue', :id => '123' }
25 { :controller => 'previews', :action => 'issue', :project_id => '123' }
26 )
27 assert_routing(
28 { :method => method, :path => "/issues/preview/edit/321" },
29 { :controller => 'previews', :action => 'issue', :id => '321' }
26 )
30 )
27 end
31 end
28 assert_routing(
32 assert_routing(
29 { :method => 'get', :path => "/news/preview" },
33 { :method => 'get', :path => "/news/preview" },
30 { :controller => 'previews', :action => 'news' }
34 { :controller => 'previews', :action => 'news' }
31 )
35 )
32 end
36 end
33 end
37 end
General Comments 0
You need to be logged in to leave comments. Login now