@@ -1,43 +1,43 | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | # |
|
3 | 3 | # Redmine - project management software |
|
4 | 4 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
5 | 5 | # |
|
6 | 6 | # This program is free software; you can redistribute it and/or |
|
7 | 7 | # modify it under the terms of the GNU General Public License |
|
8 | 8 | # as published by the Free Software Foundation; either version 2 |
|
9 | 9 | # of the License, or (at your option) any later version. |
|
10 | 10 | # |
|
11 | 11 | # This program is distributed in the hope that it will be useful, |
|
12 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | 14 | # GNU General Public License for more details. |
|
15 | 15 | # |
|
16 | 16 | # You should have received a copy of the GNU General Public License |
|
17 | 17 | # along with this program; if not, write to the Free Software |
|
18 | 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 | 19 | |
|
20 | 20 | module ContextMenusHelper |
|
21 | 21 | def context_menu_link(name, url, options={}) |
|
22 | 22 | options[:class] ||= '' |
|
23 | 23 | if options.delete(:selected) |
|
24 | 24 | options[:class] << ' icon-checked disabled' |
|
25 | 25 | options[:disabled] = true |
|
26 | 26 | end |
|
27 | 27 | if options.delete(:disabled) |
|
28 | 28 | options.delete(:method) |
|
29 | 29 | options.delete(:data) |
|
30 | 30 | options[:onclick] = 'return false;' |
|
31 | 31 | options[:class] << ' disabled' |
|
32 | 32 | url = '#' |
|
33 | 33 | end |
|
34 | 34 | link_to h(name), url, options |
|
35 | 35 | end |
|
36 | 36 | |
|
37 | 37 | def bulk_update_custom_field_context_menu_link(field, text, value) |
|
38 | 38 | context_menu_link h(text), |
|
39 |
|
|
|
39 | bulk_update_issues_path(:ids => @issue_ids, :issue => {'custom_field_values' => {field.id => value}}, :back_url => @back), | |
|
40 | 40 | :method => :post, |
|
41 | 41 | :selected => (@issue && @issue.custom_field_value(field) == value) |
|
42 | 42 | end |
|
43 | 43 | end |
@@ -1,141 +1,138 | |||
|
1 | 1 | <ul> |
|
2 | 2 | <%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %> |
|
3 | 3 | |
|
4 |
<% if |
|
|
5 |
<li><%= context_menu_link l(:button_edit), |
|
|
4 | <% if @issue -%> | |
|
5 | <li><%= context_menu_link l(:button_edit), edit_issue_path(@issue), | |
|
6 | 6 | :class => 'icon-edit', :disabled => !@can[:edit] %></li> |
|
7 | 7 | <% else %> |
|
8 |
<li><%= context_menu_link l(:button_edit), |
|
|
8 | <li><%= context_menu_link l(:button_edit), bulk_edit_issues_path(:ids => @issue_ids), | |
|
9 | 9 | :class => 'icon-edit', :disabled => !@can[:edit] %></li> |
|
10 | 10 | <% end %> |
|
11 | 11 | |
|
12 | 12 | <% if @allowed_statuses.present? %> |
|
13 | 13 | <li class="folder"> |
|
14 | 14 | <a href="#" class="submenu"><%= l(:field_status) %></a> |
|
15 | 15 | <ul> |
|
16 | 16 | <% @allowed_statuses.each do |s| -%> |
|
17 |
<li><%= context_menu_link h(s.name), |
|
|
17 | <li><%= context_menu_link h(s.name), bulk_update_issues_path(:ids => @issue_ids, :issue => {:status_id => s}, :back_url => @back), :method => :post, | |
|
18 | 18 | :selected => (@issue && s == @issue.status), :disabled => !@can[:update] %></li> |
|
19 | 19 | <% end -%> |
|
20 | 20 | </ul> |
|
21 | 21 | </li> |
|
22 | 22 | <% end %> |
|
23 | 23 | |
|
24 |
<% |
|
|
24 | <% if @trackers.present? %> | |
|
25 | 25 | <li class="folder"> |
|
26 | 26 | <a href="#" class="submenu"><%= l(:field_tracker) %></a> |
|
27 | 27 | <ul> |
|
28 | 28 | <% @trackers.each do |t| -%> |
|
29 |
<li><%= context_menu_link h(t.name), |
|
|
29 | <li><%= context_menu_link h(t.name), bulk_update_issues_path(:ids => @issue_ids, :issue => {'tracker_id' => t}, :back_url => @back), :method => :post, | |
|
30 | 30 | :selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li> |
|
31 | 31 | <% end -%> |
|
32 | 32 | </ul> |
|
33 | 33 | </li> |
|
34 | 34 | <% end %> |
|
35 | 35 | |
|
36 | <% if @safe_attributes.include?('priority_id') -%> | |
|
36 | <% if @safe_attributes.include?('priority_id') && @priorities.present? -%> | |
|
37 | 37 | <li class="folder"> |
|
38 | 38 | <a href="#" class="submenu"><%= l(:field_priority) %></a> |
|
39 | 39 | <ul> |
|
40 | 40 | <% @priorities.each do |p| -%> |
|
41 |
<li><%= context_menu_link h(p.name), |
|
|
41 | <li><%= context_menu_link h(p.name), bulk_update_issues_path(:ids => @issue_ids, :issue => {'priority_id' => p}, :back_url => @back), :method => :post, | |
|
42 | 42 | :selected => (@issue && p == @issue.priority), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li> |
|
43 | 43 | <% end -%> |
|
44 | 44 | </ul> |
|
45 | 45 | </li> |
|
46 | 46 | <% end %> |
|
47 | 47 | |
|
48 |
<% if @safe_attributes.include?('fixed_version_id') && @versions. |
|
|
48 | <% if @safe_attributes.include?('fixed_version_id') && @versions.present? -%> | |
|
49 | 49 | <li class="folder"> |
|
50 | 50 | <a href="#" class="submenu"><%= l(:field_fixed_version) %></a> |
|
51 | 51 | <ul> |
|
52 | 52 | <% @versions.sort.each do |v| -%> |
|
53 |
<li><%= context_menu_link format_version_name(v), |
|
|
53 | <li><%= context_menu_link format_version_name(v), bulk_update_issues_path(:ids => @issue_ids, :issue => {'fixed_version_id' => v}, :back_url => @back), :method => :post, | |
|
54 | 54 | :selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li> |
|
55 | 55 | <% end -%> |
|
56 |
<li><%= context_menu_link l(:label_none), |
|
|
56 | <li><%= context_menu_link l(:label_none), bulk_update_issues_path(:ids => @issue_ids, :issue => {'fixed_version_id' => 'none'}, :back_url => @back), :method => :post, | |
|
57 | 57 | :selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li> |
|
58 | 58 | </ul> |
|
59 | 59 | </li> |
|
60 | 60 | <% end %> |
|
61 | 61 | |
|
62 | 62 | <% if @safe_attributes.include?('assigned_to_id') && @assignables.present? -%> |
|
63 | 63 | <li class="folder"> |
|
64 | 64 | <a href="#" class="submenu"><%= l(:field_assigned_to) %></a> |
|
65 | 65 | <ul> |
|
66 | 66 | <% if @assignables.include?(User.current) %> |
|
67 |
<li><%= context_menu_link "<< #{l(:label_me)} >>", |
|
|
67 | <li><%= context_menu_link "<< #{l(:label_me)} >>", bulk_update_issues_path(:ids => @issue_ids, :issue => {'assigned_to_id' => User.current}, :back_url => @back), :method => :post, | |
|
68 | 68 | :disabled => !@can[:update] %></li> |
|
69 | 69 | <% end %> |
|
70 | 70 | <% @assignables.each do |u| -%> |
|
71 |
<li><%= context_menu_link h(u.name), |
|
|
71 | <li><%= context_menu_link h(u.name), bulk_update_issues_path(:ids => @issue_ids, :issue => {'assigned_to_id' => u}, :back_url => @back), :method => :post, | |
|
72 | 72 | :selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li> |
|
73 | 73 | <% end -%> |
|
74 |
<li><%= context_menu_link l(:label_nobody), |
|
|
74 | <li><%= context_menu_link l(:label_nobody), bulk_update_issues_path(:ids => @issue_ids, :issue => {'assigned_to_id' => 'none'}, :back_url => @back), :method => :post, | |
|
75 | 75 | :selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li> |
|
76 | 76 | </ul> |
|
77 | 77 | </li> |
|
78 | 78 | <% end %> |
|
79 | 79 | |
|
80 | 80 | <% if @safe_attributes.include?('category_id') && @project && @project.issue_categories.any? -%> |
|
81 | 81 | <li class="folder"> |
|
82 | 82 | <a href="#" class="submenu"><%= l(:field_category) %></a> |
|
83 | 83 | <ul> |
|
84 | 84 | <% @project.issue_categories.each do |u| -%> |
|
85 |
<li><%= context_menu_link h(u.name), |
|
|
85 | <li><%= context_menu_link h(u.name), bulk_update_issues_path(:ids => @issue_ids, :issue => {'category_id' => u}, :back_url => @back), :method => :post, | |
|
86 | 86 | :selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li> |
|
87 | 87 | <% end -%> |
|
88 |
<li><%= context_menu_link l(:label_none), |
|
|
88 | <li><%= context_menu_link l(:label_none), bulk_update_issues_path(:ids => @issue_ids, :issue => {'category_id' => 'none'}, :back_url => @back), :method => :post, | |
|
89 | 89 | :selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li> |
|
90 | 90 | </ul> |
|
91 | 91 | </li> |
|
92 | 92 | <% end -%> |
|
93 | 93 | |
|
94 | 94 | <% if @safe_attributes.include?('done_ratio') && Issue.use_field_for_done_ratio? %> |
|
95 | 95 | <li class="folder"> |
|
96 | 96 | <a href="#" class="submenu"><%= l(:field_done_ratio) %></a> |
|
97 | 97 | <ul> |
|
98 | 98 | <% (0..10).map{|x|x*10}.each do |p| -%> |
|
99 |
<li><%= context_menu_link "#{p}%", |
|
|
99 | <li><%= context_menu_link "#{p}%", bulk_update_issues_path(:ids => @issue_ids, :issue => {'done_ratio' => p}, :back_url => @back), :method => :post, | |
|
100 | 100 | :selected => (@issue && p == @issue.done_ratio), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li> |
|
101 | 101 | <% end -%> |
|
102 | 102 | </ul> |
|
103 | 103 | </li> |
|
104 | 104 | <% end %> |
|
105 | 105 | |
|
106 | 106 | <% @options_by_custom_field.each do |field, options| %> |
|
107 | 107 | <li class="folder cf_<%= field.id %>"> |
|
108 | 108 | <a href="#" class="submenu"><%= h(field.name) %></a> |
|
109 | 109 | <ul> |
|
110 | 110 | <% options.each do |text, value| %> |
|
111 | 111 | <li><%= bulk_update_custom_field_context_menu_link(field, text, value || text) %></li> |
|
112 | 112 | <% end %> |
|
113 | 113 | <% unless field.is_required? %> |
|
114 | 114 | <li><%= bulk_update_custom_field_context_menu_link(field, l(:label_none), '') %></li> |
|
115 | 115 | <% end %> |
|
116 | 116 | </ul> |
|
117 | 117 | </li> |
|
118 | 118 | <% end %> |
|
119 | 119 | |
|
120 |
<% if |
|
|
121 | <% if @can[:log_time] -%> | |
|
122 | <li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue}, | |
|
123 | :class => 'icon-time-add' %></li> | |
|
124 | <% end %> | |
|
120 | <% if @issue.present? %> | |
|
125 | 121 | <% if User.current.logged? %> |
|
126 | 122 | <li><%= watcher_link(@issue, User.current) %></li> |
|
127 | 123 | <% end %> |
|
124 | <% if @can[:log_time] -%> | |
|
125 | <li><%= context_menu_link l(:button_log_time), new_issue_time_entry_path(@issue), | |
|
126 | :class => 'icon-time-add' %></li> | |
|
128 | 127 | <% end %> |
|
129 | ||
|
130 | <% if @issue.present? %> | |
|
131 | <li><%= context_menu_link l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue}, | |
|
128 | <li><%= context_menu_link l(:button_copy), project_copy_issue_path(@project, @issue), | |
|
132 | 129 | :class => 'icon-copy', :disabled => !@can[:copy] %></li> |
|
133 | 130 | <% else %> |
|
134 |
<li><%= context_menu_link l(:button_copy), |
|
|
131 | <li><%= context_menu_link l(:button_copy), bulk_edit_issues_path(:ids => @issue_ids, :copy => '1'), | |
|
135 | 132 | :class => 'icon-copy', :disabled => !@can[:move] %></li> |
|
136 | 133 | <% end %> |
|
137 | 134 | <li><%= context_menu_link l(:button_delete), issues_path(:ids => @issue_ids, :back_url => @back), |
|
138 | 135 | :method => :delete, :data => {:confirm => issues_destroy_confirmation_message(@issues)}, :class => 'icon-del', :disabled => !@can[:delete] %></li> |
|
139 | 136 | |
|
140 | 137 | <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %> |
|
141 | 138 | </ul> |
@@ -1,341 +1,341 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2012 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 | RedmineApp::Application.routes.draw do |
|
19 | 19 | root :to => 'welcome#index', :as => 'home' |
|
20 | 20 | |
|
21 | 21 | match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] |
|
22 | 22 | match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post] |
|
23 | 23 | match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' |
|
24 | 24 | match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' |
|
25 | 25 | match 'account/activate', :to => 'account#activate', :via => :get |
|
26 | 26 | |
|
27 | 27 | match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post] |
|
28 | 28 | match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post] |
|
29 | 29 | match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post] |
|
30 | 30 | match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post] |
|
31 | 31 | |
|
32 | 32 | match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post |
|
33 | 33 | match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] |
|
34 | 34 | |
|
35 | 35 | match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post] |
|
36 | 36 | get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' |
|
37 | 37 | match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] |
|
38 | 38 | get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' |
|
39 | 39 | |
|
40 | 40 | post 'boards/:board_id/topics/preview', :to => 'messages#preview' |
|
41 | 41 | post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' |
|
42 | 42 | post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' |
|
43 | 43 | post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' |
|
44 | 44 | |
|
45 | 45 | # Misc issue routes. TODO: move into resources |
|
46 | 46 | match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' |
|
47 | 47 | match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post] |
|
48 | 48 | match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get |
|
49 | 49 | match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' |
|
50 | 50 | |
|
51 | 51 | match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get |
|
52 | 52 | match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] |
|
53 | 53 | |
|
54 | 54 | get '/projects/:project_id/issues/gantt', :to => 'gantts#show' |
|
55 | 55 | get '/issues/gantt', :to => 'gantts#show' |
|
56 | 56 | |
|
57 | 57 | get '/projects/:project_id/issues/calendar', :to => 'calendars#show' |
|
58 | 58 | get '/issues/calendar', :to => 'calendars#show' |
|
59 | 59 | |
|
60 | 60 | match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get |
|
61 | 61 | match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get |
|
62 | 62 | |
|
63 | 63 | match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] |
|
64 | 64 | match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] |
|
65 | 65 | match 'my/page', :controller => 'my', :action => 'page', :via => :get |
|
66 | 66 | match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page |
|
67 | 67 | match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post |
|
68 | 68 | match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post |
|
69 | 69 | match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] |
|
70 | 70 | match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get |
|
71 | 71 | match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post |
|
72 | 72 | match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post |
|
73 | 73 | match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post |
|
74 | 74 | |
|
75 | 75 | resources :users |
|
76 | 76 | match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' |
|
77 | 77 | match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete |
|
78 | 78 | match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' |
|
79 | 79 | |
|
80 | 80 | match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get |
|
81 | 81 | match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post |
|
82 | 82 | match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post |
|
83 | 83 | match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post |
|
84 | 84 | match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post |
|
85 | 85 | match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post |
|
86 | 86 | match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get |
|
87 | 87 | |
|
88 | 88 | resources :projects do |
|
89 | 89 | member do |
|
90 | 90 | get 'settings(/:tab)', :action => 'settings', :as => 'settings' |
|
91 | 91 | post 'modules' |
|
92 | 92 | post 'archive' |
|
93 | 93 | post 'unarchive' |
|
94 | 94 | post 'close' |
|
95 | 95 | post 'reopen' |
|
96 | 96 | match 'copy', :via => [:get, :post] |
|
97 | 97 | end |
|
98 | 98 | |
|
99 | 99 | resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do |
|
100 | 100 | collection do |
|
101 | 101 | get 'autocomplete' |
|
102 | 102 | end |
|
103 | 103 | end |
|
104 | 104 | |
|
105 | 105 | resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] |
|
106 | 106 | |
|
107 | get 'issues/:copy_from/copy', :to => 'issues#new' | |
|
107 | get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue' | |
|
108 | 108 | resources :issues, :only => [:index, :new, :create] do |
|
109 | 109 | resources :time_entries, :controller => 'timelog' do |
|
110 | 110 | collection do |
|
111 | 111 | get 'report' |
|
112 | 112 | end |
|
113 | 113 | end |
|
114 | 114 | end |
|
115 | 115 | # issue form update |
|
116 | 116 | match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' |
|
117 | 117 | |
|
118 | 118 | resources :files, :only => [:index, :new, :create] |
|
119 | 119 | |
|
120 | 120 | resources :versions, :except => [:index, :show, :edit, :update, :destroy] do |
|
121 | 121 | collection do |
|
122 | 122 | put 'close_completed' |
|
123 | 123 | end |
|
124 | 124 | end |
|
125 | 125 | get 'versions.:format', :to => 'versions#index' |
|
126 | 126 | get 'roadmap', :to => 'versions#index', :format => false |
|
127 | 127 | get 'versions', :to => 'versions#index' |
|
128 | 128 | |
|
129 | 129 | resources :news, :except => [:show, :edit, :update, :destroy] |
|
130 | 130 | resources :time_entries, :controller => 'timelog' do |
|
131 | 131 | get 'report', :on => :collection |
|
132 | 132 | end |
|
133 | 133 | resources :queries, :only => [:new, :create] |
|
134 | 134 | resources :issue_categories, :shallow => true |
|
135 | 135 | resources :documents, :except => [:show, :edit, :update, :destroy] |
|
136 | 136 | resources :boards |
|
137 | 137 | resources :repositories, :shallow => true, :except => [:index, :show] do |
|
138 | 138 | member do |
|
139 | 139 | match 'committers', :via => [:get, :post] |
|
140 | 140 | end |
|
141 | 141 | end |
|
142 | 142 | |
|
143 | 143 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get |
|
144 | 144 | resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do |
|
145 | 145 | member do |
|
146 | 146 | get 'rename' |
|
147 | 147 | post 'rename' |
|
148 | 148 | get 'history' |
|
149 | 149 | get 'diff' |
|
150 | 150 | match 'preview', :via => [:post, :put] |
|
151 | 151 | post 'protect' |
|
152 | 152 | post 'add_attachment' |
|
153 | 153 | end |
|
154 | 154 | collection do |
|
155 | 155 | get 'export' |
|
156 | 156 | get 'date_index' |
|
157 | 157 | end |
|
158 | 158 | end |
|
159 | 159 | match 'wiki', :controller => 'wiki', :action => 'show', :via => :get |
|
160 | 160 | get 'wiki/:id/:version', :to => 'wiki#show' |
|
161 | 161 | delete 'wiki/:id/:version', :to => 'wiki#destroy_version' |
|
162 | 162 | get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' |
|
163 | 163 | get 'wiki/:id/:version/diff', :to => 'wiki#diff' |
|
164 | 164 | end |
|
165 | 165 | |
|
166 | 166 | resources :issues do |
|
167 | 167 | collection do |
|
168 | 168 | match 'bulk_edit', :via => [:get, :post] |
|
169 | 169 | post 'bulk_update' |
|
170 | 170 | end |
|
171 | 171 | resources :time_entries, :controller => 'timelog' do |
|
172 | 172 | collection do |
|
173 | 173 | get 'report' |
|
174 | 174 | end |
|
175 | 175 | end |
|
176 | 176 | resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] |
|
177 | 177 | end |
|
178 | 178 | match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete |
|
179 | 179 | |
|
180 | 180 | resources :queries, :except => [:show] |
|
181 | 181 | |
|
182 | 182 | resources :news, :only => [:index, :show, :edit, :update, :destroy] |
|
183 | 183 | match '/news/:id/comments', :to => 'comments#create', :via => :post |
|
184 | 184 | match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete |
|
185 | 185 | |
|
186 | 186 | resources :versions, :only => [:show, :edit, :update, :destroy] do |
|
187 | 187 | post 'status_by', :on => :member |
|
188 | 188 | end |
|
189 | 189 | |
|
190 | 190 | resources :documents, :only => [:show, :edit, :update, :destroy] do |
|
191 | 191 | post 'add_attachment', :on => :member |
|
192 | 192 | end |
|
193 | 193 | |
|
194 | 194 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post] |
|
195 | 195 | |
|
196 | 196 | resources :time_entries, :controller => 'timelog', :except => :destroy do |
|
197 | 197 | collection do |
|
198 | 198 | get 'report' |
|
199 | 199 | get 'bulk_edit' |
|
200 | 200 | post 'bulk_update' |
|
201 | 201 | end |
|
202 | 202 | end |
|
203 | 203 | match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ |
|
204 | 204 | # TODO: delete /time_entries for bulk deletion |
|
205 | 205 | match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete |
|
206 | 206 | |
|
207 | 207 | get 'projects/:id/activity', :to => 'activities#index' |
|
208 | 208 | get 'projects/:id/activity.:format', :to => 'activities#index' |
|
209 | 209 | get 'activity', :to => 'activities#index' |
|
210 | 210 | |
|
211 | 211 | # repositories routes |
|
212 | 212 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' |
|
213 | 213 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' |
|
214 | 214 | |
|
215 | 215 | get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', |
|
216 | 216 | :to => 'repositories#changes' |
|
217 | 217 | |
|
218 | 218 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' |
|
219 | 219 | get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' |
|
220 | 220 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
221 | 221 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
222 | 222 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' |
|
223 | 223 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', |
|
224 | 224 | :controller => 'repositories', |
|
225 | 225 | :format => false, |
|
226 | 226 | :constraints => { |
|
227 | 227 | :action => /(browse|show|entry|raw|annotate|diff)/, |
|
228 | 228 | :rev => /[a-z0-9\.\-_]+/ |
|
229 | 229 | } |
|
230 | 230 | |
|
231 | 231 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' |
|
232 | 232 | get 'projects/:id/repository/graph', :to => 'repositories#graph' |
|
233 | 233 | |
|
234 | 234 | get 'projects/:id/repository/changes(/*path(.:ext))', |
|
235 | 235 | :to => 'repositories#changes' |
|
236 | 236 | |
|
237 | 237 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' |
|
238 | 238 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' |
|
239 | 239 | get 'projects/:id/repository/revision', :to => 'repositories#revision' |
|
240 | 240 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
241 | 241 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
242 | 242 | get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', |
|
243 | 243 | :controller => 'repositories', |
|
244 | 244 | :format => false, |
|
245 | 245 | :constraints => { |
|
246 | 246 | :action => /(browse|show|entry|raw|annotate|diff)/, |
|
247 | 247 | :rev => /[a-z0-9\.\-_]+/ |
|
248 | 248 | } |
|
249 | 249 | get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', |
|
250 | 250 | :controller => 'repositories', |
|
251 | 251 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ |
|
252 | 252 | get 'projects/:id/repository/:action(/*path(.:ext))', |
|
253 | 253 | :controller => 'repositories', |
|
254 | 254 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ |
|
255 | 255 | |
|
256 | 256 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil |
|
257 | 257 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil |
|
258 | 258 | |
|
259 | 259 | # additional routes for having the file name at the end of url |
|
260 | 260 | match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get |
|
261 | 261 | match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get |
|
262 | 262 | match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get |
|
263 | 263 | match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/ |
|
264 | 264 | resources :attachments, :only => [:show, :destroy] |
|
265 | 265 | |
|
266 | 266 | resources :groups do |
|
267 | 267 | member do |
|
268 | 268 | get 'autocomplete_for_user' |
|
269 | 269 | end |
|
270 | 270 | end |
|
271 | 271 | |
|
272 | 272 | match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' |
|
273 | 273 | match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' |
|
274 | 274 | match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post |
|
275 | 275 | match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post |
|
276 | 276 | |
|
277 | 277 | resources :trackers, :except => :show do |
|
278 | 278 | collection do |
|
279 | 279 | match 'fields', :via => [:get, :post] |
|
280 | 280 | end |
|
281 | 281 | end |
|
282 | 282 | resources :issue_statuses, :except => :show do |
|
283 | 283 | collection do |
|
284 | 284 | post 'update_issue_done_ratio' |
|
285 | 285 | end |
|
286 | 286 | end |
|
287 | 287 | resources :custom_fields, :except => :show |
|
288 | 288 | resources :roles do |
|
289 | 289 | collection do |
|
290 | 290 | match 'permissions', :via => [:get, :post] |
|
291 | 291 | end |
|
292 | 292 | end |
|
293 | 293 | resources :enumerations, :except => :show |
|
294 | 294 | match 'enumerations/:type', :to => 'enumerations#index', :via => :get |
|
295 | 295 | |
|
296 | 296 | get 'projects/:id/search', :controller => 'search', :action => 'index' |
|
297 | 297 | get 'search', :controller => 'search', :action => 'index' |
|
298 | 298 | |
|
299 | 299 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post |
|
300 | 300 | |
|
301 | 301 | match 'admin', :controller => 'admin', :action => 'index', :via => :get |
|
302 | 302 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get |
|
303 | 303 | match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get |
|
304 | 304 | match 'admin/info', :controller => 'admin', :action => 'info', :via => :get |
|
305 | 305 | match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get |
|
306 | 306 | match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post |
|
307 | 307 | |
|
308 | 308 | resources :auth_sources do |
|
309 | 309 | member do |
|
310 | 310 | get 'test_connection', :as => 'try_connection' |
|
311 | 311 | end |
|
312 | 312 | end |
|
313 | 313 | |
|
314 | 314 | match 'workflows', :controller => 'workflows', :action => 'index', :via => :get |
|
315 | 315 | match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] |
|
316 | 316 | match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post] |
|
317 | 317 | match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] |
|
318 | 318 | match 'settings', :controller => 'settings', :action => 'index', :via => :get |
|
319 | 319 | match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] |
|
320 | 320 | match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings' |
|
321 | 321 | |
|
322 | 322 | match 'sys/projects', :to => 'sys#projects', :via => :get |
|
323 | 323 | match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post |
|
324 | 324 | match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get |
|
325 | 325 | |
|
326 | 326 | match 'uploads', :to => 'attachments#upload', :via => :post |
|
327 | 327 | |
|
328 | 328 | get 'robots.txt', :to => 'welcome#robots' |
|
329 | 329 | |
|
330 | 330 | Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| |
|
331 | 331 | file = File.join(plugin_dir, "config/routes.rb") |
|
332 | 332 | if File.exists?(file) |
|
333 | 333 | begin |
|
334 | 334 | instance_eval File.read(file) |
|
335 | 335 | rescue Exception => e |
|
336 | 336 | puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." |
|
337 | 337 | exit 1 |
|
338 | 338 | end |
|
339 | 339 | end |
|
340 | 340 | end |
|
341 | 341 | end |
General Comments 0
You need to be logged in to leave comments.
Login now