@@ -1,82 +1,92 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class BoardsController < ApplicationController |
|
18 | class BoardsController < ApplicationController | |
19 | before_filter :find_project, :authorize |
|
19 | before_filter :find_project, :authorize | |
20 |
|
20 | |||
21 | helper :messages |
|
21 | helper :messages | |
22 | include MessagesHelper |
|
22 | include MessagesHelper | |
23 | helper :sort |
|
23 | helper :sort | |
24 | include SortHelper |
|
24 | include SortHelper | |
25 | helper :watchers |
|
25 | helper :watchers | |
26 | include WatchersHelper |
|
26 | include WatchersHelper | |
27 |
|
27 | |||
28 | def index |
|
28 | def index | |
29 | @boards = @project.boards |
|
29 | @boards = @project.boards | |
30 | # show the board if there is only one |
|
30 | # show the board if there is only one | |
31 | if @boards.size == 1 |
|
31 | if @boards.size == 1 | |
32 | @board = @boards.first |
|
32 | @board = @boards.first | |
33 | show |
|
33 | show | |
34 | end |
|
34 | end | |
35 | end |
|
35 | end | |
36 |
|
36 | |||
37 | def show |
|
37 | def show | |
38 | sort_init 'updated_on', 'desc' |
|
38 | respond_to do |format| | |
39 | sort_update 'created_on' => "#{Message.table_name}.created_on", |
|
39 | format.html { | |
40 | 'replies' => "#{Message.table_name}.replies_count", |
|
40 | sort_init 'updated_on', 'desc' | |
41 |
|
|
41 | sort_update 'created_on' => "#{Message.table_name}.created_on", | |
42 |
|
42 | 'replies' => "#{Message.table_name}.replies_count", | ||
43 | @topic_count = @board.topics.count |
|
43 | 'updated_on' => "#{Message.table_name}.updated_on" | |
44 | @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page'] |
|
44 | ||
45 | @topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '), |
|
45 | @topic_count = @board.topics.count | |
46 | :include => [:author, {:last_reply => :author}], |
|
46 | @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page'] | |
47 | :limit => @topic_pages.items_per_page, |
|
47 | @topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '), | |
48 | :offset => @topic_pages.current.offset |
|
48 | :include => [:author, {:last_reply => :author}], | |
49 | @message = Message.new |
|
49 | :limit => @topic_pages.items_per_page, | |
50 | render :action => 'show', :layout => !request.xhr? |
|
50 | :offset => @topic_pages.current.offset | |
|
51 | @message = Message.new | |||
|
52 | render :action => 'show', :layout => !request.xhr? | |||
|
53 | } | |||
|
54 | format.atom { | |||
|
55 | @messages = @board.messages.find :all, :order => 'created_on DESC', | |||
|
56 | :include => [:author, :board], | |||
|
57 | :limit => Setting.feeds_limit.to_i | |||
|
58 | render_feed(@messages, :title => "#{@project}: #{@board}") | |||
|
59 | } | |||
|
60 | end | |||
51 | end |
|
61 | end | |
52 |
|
62 | |||
53 | verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index } |
|
63 | verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index } | |
54 |
|
64 | |||
55 | def new |
|
65 | def new | |
56 | @board = Board.new(params[:board]) |
|
66 | @board = Board.new(params[:board]) | |
57 | @board.project = @project |
|
67 | @board.project = @project | |
58 | if request.post? && @board.save |
|
68 | if request.post? && @board.save | |
59 | flash[:notice] = l(:notice_successful_create) |
|
69 | flash[:notice] = l(:notice_successful_create) | |
60 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' |
|
70 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' | |
61 | end |
|
71 | end | |
62 | end |
|
72 | end | |
63 |
|
73 | |||
64 | def edit |
|
74 | def edit | |
65 | if request.post? && @board.update_attributes(params[:board]) |
|
75 | if request.post? && @board.update_attributes(params[:board]) | |
66 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' |
|
76 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' | |
67 | end |
|
77 | end | |
68 | end |
|
78 | end | |
69 |
|
79 | |||
70 | def destroy |
|
80 | def destroy | |
71 | @board.destroy |
|
81 | @board.destroy | |
72 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' |
|
82 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' | |
73 | end |
|
83 | end | |
74 |
|
84 | |||
75 | private |
|
85 | private | |
76 | def find_project |
|
86 | def find_project | |
77 | @project = Project.find(params[:project_id]) |
|
87 | @project = Project.find(params[:project_id]) | |
78 | @board = @project.boards.find(params[:id]) if params[:id] |
|
88 | @board = @project.boards.find(params[:id]) if params[:id] | |
79 | rescue ActiveRecord::RecordNotFound |
|
89 | rescue ActiveRecord::RecordNotFound | |
80 | render_404 |
|
90 | render_404 | |
81 | end |
|
91 | end | |
82 | end |
|
92 | end |
@@ -1,42 +1,46 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class Board < ActiveRecord::Base |
|
18 | class Board < ActiveRecord::Base | |
19 | belongs_to :project |
|
19 | belongs_to :project | |
20 | has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC" |
|
20 | has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC" | |
21 | has_many :messages, :dependent => :delete_all, :order => "#{Message.table_name}.created_on DESC" |
|
21 | has_many :messages, :dependent => :delete_all, :order => "#{Message.table_name}.created_on DESC" | |
22 | belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id |
|
22 | belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id | |
23 | acts_as_list :scope => :project_id |
|
23 | acts_as_list :scope => :project_id | |
24 | acts_as_watchable |
|
24 | acts_as_watchable | |
25 |
|
25 | |||
26 | validates_presence_of :name, :description |
|
26 | validates_presence_of :name, :description | |
27 | validates_length_of :name, :maximum => 30 |
|
27 | validates_length_of :name, :maximum => 30 | |
28 | validates_length_of :description, :maximum => 255 |
|
28 | validates_length_of :description, :maximum => 255 | |
29 |
|
29 | |||
|
30 | def to_s | |||
|
31 | name | |||
|
32 | end | |||
|
33 | ||||
30 | def reset_counters! |
|
34 | def reset_counters! | |
31 | self.class.reset_counters!(id) |
|
35 | self.class.reset_counters!(id) | |
32 | end |
|
36 | end | |
33 |
|
37 | |||
34 | # Updates topics_count, messages_count and last_message_id attributes for +board_id+ |
|
38 | # Updates topics_count, messages_count and last_message_id attributes for +board_id+ | |
35 | def self.reset_counters!(board_id) |
|
39 | def self.reset_counters!(board_id) | |
36 | board_id = board_id.to_i |
|
40 | board_id = board_id.to_i | |
37 | update_all("topics_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=#{board_id} AND parent_id IS NULL)," + |
|
41 | update_all("topics_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=#{board_id} AND parent_id IS NULL)," + | |
38 | " messages_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=#{board_id})," + |
|
42 | " messages_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=#{board_id})," + | |
39 | " last_message_id = (SELECT MAX(id) FROM #{Message.table_name} WHERE board_id=#{board_id})", |
|
43 | " last_message_id = (SELECT MAX(id) FROM #{Message.table_name} WHERE board_id=#{board_id})", | |
40 | ["id = ?", board_id]) |
|
44 | ["id = ?", board_id]) | |
41 | end |
|
45 | end | |
42 | end |
|
46 | end |
@@ -1,62 +1,70 | |||||
1 | <%= breadcrumb link_to(l(:label_board_plural), {:controller => 'boards', :action => 'index', :project_id => @project}) %> |
|
1 | <%= breadcrumb link_to(l(:label_board_plural), {:controller => 'boards', :action => 'index', :project_id => @project}) %> | |
2 |
|
2 | |||
3 | <div class="contextual"> |
|
3 | <div class="contextual"> | |
4 | <%= link_to_if_authorized l(:label_message_new), |
|
4 | <%= link_to_if_authorized l(:label_message_new), | |
5 | {:controller => 'messages', :action => 'new', :board_id => @board}, |
|
5 | {:controller => 'messages', :action => 'new', :board_id => @board}, | |
6 | :class => 'icon icon-add', |
|
6 | :class => 'icon icon-add', | |
7 | :onclick => 'Element.show("add-message"); Form.Element.focus("message_subject"); return false;' %> |
|
7 | :onclick => 'Element.show("add-message"); Form.Element.focus("message_subject"); return false;' %> | |
8 | <%= watcher_tag(@board, User.current) %> |
|
8 | <%= watcher_tag(@board, User.current) %> | |
9 | </div> |
|
9 | </div> | |
10 |
|
10 | |||
11 | <div id="add-message" style="display:none;"> |
|
11 | <div id="add-message" style="display:none;"> | |
12 | <h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%= l(:label_message_new) %></h2> |
|
12 | <h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%= l(:label_message_new) %></h2> | |
13 | <% form_for :message, @message, :url => {:controller => 'messages', :action => 'new', :board_id => @board}, :html => {:multipart => true, :id => 'message-form'} do |f| %> |
|
13 | <% form_for :message, @message, :url => {:controller => 'messages', :action => 'new', :board_id => @board}, :html => {:multipart => true, :id => 'message-form'} do |f| %> | |
14 | <%= render :partial => 'messages/form', :locals => {:f => f} %> |
|
14 | <%= render :partial => 'messages/form', :locals => {:f => f} %> | |
15 | <p><%= submit_tag l(:button_create) %> |
|
15 | <p><%= submit_tag l(:button_create) %> | |
16 | <%= link_to_remote l(:label_preview), |
|
16 | <%= link_to_remote l(:label_preview), | |
17 | { :url => { :controller => 'messages', :action => 'preview', :board_id => @board }, |
|
17 | { :url => { :controller => 'messages', :action => 'preview', :board_id => @board }, | |
18 | :method => 'post', |
|
18 | :method => 'post', | |
19 | :update => 'preview', |
|
19 | :update => 'preview', | |
20 | :with => "Form.serialize('message-form')", |
|
20 | :with => "Form.serialize('message-form')", | |
21 | :complete => "Element.scrollTo('preview')" |
|
21 | :complete => "Element.scrollTo('preview')" | |
22 | }, :accesskey => accesskey(:preview) %> | |
|
22 | }, :accesskey => accesskey(:preview) %> | | |
23 | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-message")' %></p> |
|
23 | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-message")' %></p> | |
24 | <% end %> |
|
24 | <% end %> | |
25 | <div id="preview" class="wiki"></div> |
|
25 | <div id="preview" class="wiki"></div> | |
26 | </div> |
|
26 | </div> | |
27 |
|
27 | |||
28 | <h2><%=h @board.name %></h2> |
|
28 | <h2><%=h @board.name %></h2> | |
29 | <p class="subtitle"><%=h @board.description %></p> |
|
29 | <p class="subtitle"><%=h @board.description %></p> | |
30 |
|
30 | |||
31 | <% if @topics.any? %> |
|
31 | <% if @topics.any? %> | |
32 | <table class="list messages"> |
|
32 | <table class="list messages"> | |
33 | <thead><tr> |
|
33 | <thead><tr> | |
34 | <th><%= l(:field_subject) %></th> |
|
34 | <th><%= l(:field_subject) %></th> | |
35 | <th><%= l(:field_author) %></th> |
|
35 | <th><%= l(:field_author) %></th> | |
36 | <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %> |
|
36 | <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %> | |
37 | <%= sort_header_tag('replies', :caption => l(:label_reply_plural)) %> |
|
37 | <%= sort_header_tag('replies', :caption => l(:label_reply_plural)) %> | |
38 | <%= sort_header_tag('updated_on', :caption => l(:label_message_last)) %> |
|
38 | <%= sort_header_tag('updated_on', :caption => l(:label_message_last)) %> | |
39 | </tr></thead> |
|
39 | </tr></thead> | |
40 | <tbody> |
|
40 | <tbody> | |
41 | <% @topics.each do |topic| %> |
|
41 | <% @topics.each do |topic| %> | |
42 | <tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"> |
|
42 | <tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"> | |
43 | <td class="subject"><%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic }, :class => 'icon' %></td> |
|
43 | <td class="subject"><%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic }, :class => 'icon' %></td> | |
44 | <td class="author" align="center"><%= topic.author %></td> |
|
44 | <td class="author" align="center"><%= topic.author %></td> | |
45 | <td class="created_on" align="center"><%= format_time(topic.created_on) %></td> |
|
45 | <td class="created_on" align="center"><%= format_time(topic.created_on) %></td> | |
46 | <td class="replies" align="center"><%= topic.replies_count %></td> |
|
46 | <td class="replies" align="center"><%= topic.replies_count %></td> | |
47 | <td class="last_message"> |
|
47 | <td class="last_message"> | |
48 | <% if topic.last_reply %> |
|
48 | <% if topic.last_reply %> | |
49 | <%= authoring topic.last_reply.created_on, topic.last_reply.author %><br /> |
|
49 | <%= authoring topic.last_reply.created_on, topic.last_reply.author %><br /> | |
50 | <%= link_to_message topic.last_reply %> |
|
50 | <%= link_to_message topic.last_reply %> | |
51 | <% end %> |
|
51 | <% end %> | |
52 | </td> |
|
52 | </td> | |
53 | </tr> |
|
53 | </tr> | |
54 | <% end %> |
|
54 | <% end %> | |
55 | </tbody> |
|
55 | </tbody> | |
56 | </table> |
|
56 | </table> | |
57 | <p class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></p> |
|
57 | <p class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></p> | |
58 | <% else %> |
|
58 | <% else %> | |
59 | <p class="nodata"><%= l(:label_no_data) %></p> |
|
59 | <p class="nodata"><%= l(:label_no_data) %></p> | |
60 | <% end %> |
|
60 | <% end %> | |
61 |
|
61 | |||
|
62 | <% other_formats_links do |f| %> | |||
|
63 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> | |||
|
64 | <% end %> | |||
|
65 | ||||
62 | <% html_title h(@board.name) %> |
|
66 | <% html_title h(@board.name) %> | |
|
67 | ||||
|
68 | <% content_for :header_tags do %> | |||
|
69 | <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> | |||
|
70 | <% end %> |
@@ -1,260 +1,261 | |||||
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 | # Allow Redmine plugins to map routes and potentially override them |
|
9 | # Allow Redmine plugins to map routes and potentially override them | |
10 | Rails.plugins.each do |plugin| |
|
10 | Rails.plugins.each do |plugin| | |
11 | map.from_plugin plugin.name.to_sym |
|
11 | map.from_plugin plugin.name.to_sym | |
12 | end |
|
12 | end | |
13 |
|
13 | |||
14 | map.home '', :controller => 'welcome' |
|
14 | map.home '', :controller => 'welcome' | |
15 |
|
15 | |||
16 | map.signin 'login', :controller => 'account', :action => 'login' |
|
16 | map.signin 'login', :controller => 'account', :action => 'login' | |
17 | map.signout 'logout', :controller => 'account', :action => 'logout' |
|
17 | map.signout 'logout', :controller => 'account', :action => 'logout' | |
18 |
|
18 | |||
19 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
19 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' | |
20 | map.connect 'help/:ctrl/:page', :controller => 'help' |
|
20 | map.connect 'help/:ctrl/:page', :controller => 'help' | |
21 |
|
21 | |||
22 | map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog' |
|
22 | map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog' | |
23 | map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
23 | map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog' | |
24 | map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog' |
|
24 | map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog' | |
25 |
|
25 | |||
26 | map.with_options :controller => 'timelog' do |timelog| |
|
26 | map.with_options :controller => 'timelog' do |timelog| | |
27 | timelog.connect 'projects/:project_id/time_entries', :action => 'details' |
|
27 | timelog.connect 'projects/:project_id/time_entries', :action => 'details' | |
28 |
|
28 | |||
29 | timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details| |
|
29 | timelog.with_options :action => 'details', :conditions => {:method => :get} do |time_details| | |
30 | time_details.connect 'time_entries' |
|
30 | time_details.connect 'time_entries' | |
31 | time_details.connect 'time_entries.:format' |
|
31 | time_details.connect 'time_entries.:format' | |
32 | time_details.connect 'issues/:issue_id/time_entries' |
|
32 | time_details.connect 'issues/:issue_id/time_entries' | |
33 | time_details.connect 'issues/:issue_id/time_entries.:format' |
|
33 | time_details.connect 'issues/:issue_id/time_entries.:format' | |
34 | time_details.connect 'projects/:project_id/time_entries.:format' |
|
34 | time_details.connect 'projects/:project_id/time_entries.:format' | |
35 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries' |
|
35 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries' | |
36 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format' |
|
36 | time_details.connect 'projects/:project_id/issues/:issue_id/time_entries.:format' | |
37 | end |
|
37 | end | |
38 | timelog.connect 'projects/:project_id/time_entries/report', :action => 'report' |
|
38 | timelog.connect 'projects/:project_id/time_entries/report', :action => 'report' | |
39 | timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report| |
|
39 | timelog.with_options :action => 'report',:conditions => {:method => :get} do |time_report| | |
40 | time_report.connect 'time_entries/report' |
|
40 | time_report.connect 'time_entries/report' | |
41 | time_report.connect 'time_entries/report.:format' |
|
41 | time_report.connect 'time_entries/report.:format' | |
42 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
42 | time_report.connect 'projects/:project_id/time_entries/report.:format' | |
43 | end |
|
43 | end | |
44 |
|
44 | |||
45 | timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit| |
|
45 | timelog.with_options :action => 'edit', :conditions => {:method => :get} do |time_edit| | |
46 | time_edit.connect 'issues/:issue_id/time_entries/new' |
|
46 | time_edit.connect 'issues/:issue_id/time_entries/new' | |
47 | end |
|
47 | end | |
48 |
|
48 | |||
49 | timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post} |
|
49 | timelog.connect 'time_entries/:id/destroy', :action => 'destroy', :conditions => {:method => :post} | |
50 | end |
|
50 | end | |
51 |
|
51 | |||
52 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
52 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} | |
53 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
53 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} | |
54 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} |
|
54 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} | |
55 | map.with_options :controller => 'wiki' do |wiki_routes| |
|
55 | map.with_options :controller => 'wiki' do |wiki_routes| | |
56 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| |
|
56 | wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| | |
57 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i |
|
57 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i | |
58 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil |
|
58 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil | |
59 | wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' |
|
59 | wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' | |
60 | wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' |
|
60 | wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' | |
61 | wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' |
|
61 | wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' | |
62 | wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' |
|
62 | wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' | |
63 | wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' |
|
63 | wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | wiki_routes.connect 'projects/:id/wiki/:page/:action', |
|
66 | wiki_routes.connect 'projects/:id/wiki/:page/:action', | |
67 | :action => /edit|rename|destroy|preview|protect/, |
|
67 | :action => /edit|rename|destroy|preview|protect/, | |
68 | :conditions => {:method => :post} |
|
68 | :conditions => {:method => :post} | |
69 | end |
|
69 | end | |
70 |
|
70 | |||
71 | map.with_options :controller => 'messages' do |messages_routes| |
|
71 | map.with_options :controller => 'messages' do |messages_routes| | |
72 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| |
|
72 | messages_routes.with_options :conditions => {:method => :get} do |messages_views| | |
73 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' |
|
73 | messages_views.connect 'boards/:board_id/topics/new', :action => 'new' | |
74 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' |
|
74 | messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' | |
75 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' |
|
75 | messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | |
76 | end |
|
76 | end | |
77 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| |
|
77 | messages_routes.with_options :conditions => {:method => :post} do |messages_actions| | |
78 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' |
|
78 | messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' | |
79 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' |
|
79 | messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' | |
80 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ |
|
80 | messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ | |
81 | end |
|
81 | end | |
82 | end |
|
82 | end | |
83 |
|
83 | |||
84 | map.with_options :controller => 'boards' do |board_routes| |
|
84 | map.with_options :controller => 'boards' do |board_routes| | |
85 | board_routes.with_options :conditions => {:method => :get} do |board_views| |
|
85 | board_routes.with_options :conditions => {:method => :get} do |board_views| | |
86 | board_views.connect 'projects/:project_id/boards', :action => 'index' |
|
86 | board_views.connect 'projects/:project_id/boards', :action => 'index' | |
87 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' |
|
87 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' | |
88 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' |
|
88 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' | |
|
89 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' | |||
89 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' |
|
90 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' | |
90 | end |
|
91 | end | |
91 | board_routes.with_options :conditions => {:method => :post} do |board_actions| |
|
92 | board_routes.with_options :conditions => {:method => :post} do |board_actions| | |
92 | board_actions.connect 'projects/:project_id/boards', :action => 'new' |
|
93 | board_actions.connect 'projects/:project_id/boards', :action => 'new' | |
93 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ |
|
94 | board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ | |
94 | end |
|
95 | end | |
95 | end |
|
96 | end | |
96 |
|
97 | |||
97 | map.with_options :controller => 'documents' do |document_routes| |
|
98 | map.with_options :controller => 'documents' do |document_routes| | |
98 | document_routes.with_options :conditions => {:method => :get} do |document_views| |
|
99 | document_routes.with_options :conditions => {:method => :get} do |document_views| | |
99 | document_views.connect 'projects/:project_id/documents', :action => 'index' |
|
100 | document_views.connect 'projects/:project_id/documents', :action => 'index' | |
100 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' |
|
101 | document_views.connect 'projects/:project_id/documents/new', :action => 'new' | |
101 | document_views.connect 'documents/:id', :action => 'show' |
|
102 | document_views.connect 'documents/:id', :action => 'show' | |
102 | document_views.connect 'documents/:id/edit', :action => 'edit' |
|
103 | document_views.connect 'documents/:id/edit', :action => 'edit' | |
103 | end |
|
104 | end | |
104 | document_routes.with_options :conditions => {:method => :post} do |document_actions| |
|
105 | document_routes.with_options :conditions => {:method => :post} do |document_actions| | |
105 | document_actions.connect 'projects/:project_id/documents', :action => 'new' |
|
106 | document_actions.connect 'projects/:project_id/documents', :action => 'new' | |
106 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ |
|
107 | document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ | |
107 | end |
|
108 | end | |
108 | end |
|
109 | end | |
109 |
|
110 | |||
110 | map.with_options :controller => 'issues' do |issues_routes| |
|
111 | map.with_options :controller => 'issues' do |issues_routes| | |
111 | issues_routes.with_options :conditions => {:method => :get} do |issues_views| |
|
112 | issues_routes.with_options :conditions => {:method => :get} do |issues_views| | |
112 | issues_views.connect 'issues', :action => 'index' |
|
113 | issues_views.connect 'issues', :action => 'index' | |
113 | issues_views.connect 'issues.:format', :action => 'index' |
|
114 | issues_views.connect 'issues.:format', :action => 'index' | |
114 | issues_views.connect 'projects/:project_id/issues', :action => 'index' |
|
115 | issues_views.connect 'projects/:project_id/issues', :action => 'index' | |
115 | issues_views.connect 'projects/:project_id/issues.:format', :action => 'index' |
|
116 | issues_views.connect 'projects/:project_id/issues.:format', :action => 'index' | |
116 | issues_views.connect 'projects/:project_id/issues/new', :action => 'new' |
|
117 | issues_views.connect 'projects/:project_id/issues/new', :action => 'new' | |
117 | issues_views.connect 'projects/:project_id/issues/gantt', :action => 'gantt' |
|
118 | issues_views.connect 'projects/:project_id/issues/gantt', :action => 'gantt' | |
118 | issues_views.connect 'projects/:project_id/issues/calendar', :action => 'calendar' |
|
119 | issues_views.connect 'projects/:project_id/issues/calendar', :action => 'calendar' | |
119 | issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new' |
|
120 | issues_views.connect 'projects/:project_id/issues/:copy_from/copy', :action => 'new' | |
120 | issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/ |
|
121 | issues_views.connect 'issues/:id', :action => 'show', :id => /\d+/ | |
121 | issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/ |
|
122 | issues_views.connect 'issues/:id.:format', :action => 'show', :id => /\d+/ | |
122 | issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/ |
|
123 | issues_views.connect 'issues/:id/edit', :action => 'edit', :id => /\d+/ | |
123 | issues_views.connect 'issues/:id/move', :action => 'move', :id => /\d+/ |
|
124 | issues_views.connect 'issues/:id/move', :action => 'move', :id => /\d+/ | |
124 | end |
|
125 | end | |
125 | issues_routes.with_options :conditions => {:method => :post} do |issues_actions| |
|
126 | issues_routes.with_options :conditions => {:method => :post} do |issues_actions| | |
126 | issues_actions.connect 'projects/:project_id/issues', :action => 'new' |
|
127 | issues_actions.connect 'projects/:project_id/issues', :action => 'new' | |
127 | issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/ |
|
128 | issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/ | |
128 | issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/ |
|
129 | issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/ | |
129 | end |
|
130 | end | |
130 | issues_routes.connect 'issues/:action' |
|
131 | issues_routes.connect 'issues/:action' | |
131 | end |
|
132 | end | |
132 |
|
133 | |||
133 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| |
|
134 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| | |
134 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' |
|
135 | relations.connect 'issues/:issue_id/relations/:id', :action => 'new' | |
135 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' |
|
136 | relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' | |
136 | end |
|
137 | end | |
137 |
|
138 | |||
138 | map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports| |
|
139 | map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports| | |
139 | reports.connect 'projects/:id/issues/report' |
|
140 | reports.connect 'projects/:id/issues/report' | |
140 | reports.connect 'projects/:id/issues/report/:detail' |
|
141 | reports.connect 'projects/:id/issues/report/:detail' | |
141 | end |
|
142 | end | |
142 |
|
143 | |||
143 | map.with_options :controller => 'news' do |news_routes| |
|
144 | map.with_options :controller => 'news' do |news_routes| | |
144 | news_routes.with_options :conditions => {:method => :get} do |news_views| |
|
145 | news_routes.with_options :conditions => {:method => :get} do |news_views| | |
145 | news_views.connect 'news', :action => 'index' |
|
146 | news_views.connect 'news', :action => 'index' | |
146 | news_views.connect 'projects/:project_id/news', :action => 'index' |
|
147 | news_views.connect 'projects/:project_id/news', :action => 'index' | |
147 | news_views.connect 'projects/:project_id/news.:format', :action => 'index' |
|
148 | news_views.connect 'projects/:project_id/news.:format', :action => 'index' | |
148 | news_views.connect 'news.:format', :action => 'index' |
|
149 | news_views.connect 'news.:format', :action => 'index' | |
149 | news_views.connect 'projects/:project_id/news/new', :action => 'new' |
|
150 | news_views.connect 'projects/:project_id/news/new', :action => 'new' | |
150 | news_views.connect 'news/:id', :action => 'show' |
|
151 | news_views.connect 'news/:id', :action => 'show' | |
151 | news_views.connect 'news/:id/edit', :action => 'edit' |
|
152 | news_views.connect 'news/:id/edit', :action => 'edit' | |
152 | end |
|
153 | end | |
153 | news_routes.with_options do |news_actions| |
|
154 | news_routes.with_options do |news_actions| | |
154 | news_actions.connect 'projects/:project_id/news', :action => 'new' |
|
155 | news_actions.connect 'projects/:project_id/news', :action => 'new' | |
155 | news_actions.connect 'news/:id/edit', :action => 'edit' |
|
156 | news_actions.connect 'news/:id/edit', :action => 'edit' | |
156 | news_actions.connect 'news/:id/destroy', :action => 'destroy' |
|
157 | news_actions.connect 'news/:id/destroy', :action => 'destroy' | |
157 | end |
|
158 | end | |
158 | end |
|
159 | end | |
159 |
|
160 | |||
160 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' |
|
161 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' | |
161 |
|
162 | |||
162 | map.with_options :controller => 'users' do |users| |
|
163 | map.with_options :controller => 'users' do |users| | |
163 | users.with_options :conditions => {:method => :get} do |user_views| |
|
164 | users.with_options :conditions => {:method => :get} do |user_views| | |
164 | user_views.connect 'users', :action => 'list' |
|
165 | user_views.connect 'users', :action => 'list' | |
165 | user_views.connect 'users', :action => 'index' |
|
166 | user_views.connect 'users', :action => 'index' | |
166 | user_views.connect 'users/new', :action => 'add' |
|
167 | user_views.connect 'users/new', :action => 'add' | |
167 | user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil |
|
168 | user_views.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil | |
168 | end |
|
169 | end | |
169 | users.with_options :conditions => {:method => :post} do |user_actions| |
|
170 | users.with_options :conditions => {:method => :post} do |user_actions| | |
170 | user_actions.connect 'users', :action => 'add' |
|
171 | user_actions.connect 'users', :action => 'add' | |
171 | user_actions.connect 'users/new', :action => 'add' |
|
172 | user_actions.connect 'users/new', :action => 'add' | |
172 | user_actions.connect 'users/:id/edit', :action => 'edit' |
|
173 | user_actions.connect 'users/:id/edit', :action => 'edit' | |
173 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' |
|
174 | user_actions.connect 'users/:id/memberships', :action => 'edit_membership' | |
174 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' |
|
175 | user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' | |
175 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' |
|
176 | user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' | |
176 | end |
|
177 | end | |
177 | end |
|
178 | end | |
178 |
|
179 | |||
179 | map.with_options :controller => 'projects' do |projects| |
|
180 | map.with_options :controller => 'projects' do |projects| | |
180 | projects.with_options :conditions => {:method => :get} do |project_views| |
|
181 | projects.with_options :conditions => {:method => :get} do |project_views| | |
181 | project_views.connect 'projects', :action => 'index' |
|
182 | project_views.connect 'projects', :action => 'index' | |
182 | project_views.connect 'projects.:format', :action => 'index' |
|
183 | project_views.connect 'projects.:format', :action => 'index' | |
183 | project_views.connect 'projects/new', :action => 'add' |
|
184 | project_views.connect 'projects/new', :action => 'add' | |
184 | project_views.connect 'projects/:id', :action => 'show' |
|
185 | project_views.connect 'projects/:id', :action => 'show' | |
185 | project_views.connect 'projects/:id/:action', :action => /roadmap|changelog|destroy|settings/ |
|
186 | project_views.connect 'projects/:id/:action', :action => /roadmap|changelog|destroy|settings/ | |
186 | project_views.connect 'projects/:id/files', :action => 'list_files' |
|
187 | project_views.connect 'projects/:id/files', :action => 'list_files' | |
187 | project_views.connect 'projects/:id/files/new', :action => 'add_file' |
|
188 | project_views.connect 'projects/:id/files/new', :action => 'add_file' | |
188 | project_views.connect 'projects/:id/versions/new', :action => 'add_version' |
|
189 | project_views.connect 'projects/:id/versions/new', :action => 'add_version' | |
189 | project_views.connect 'projects/:id/categories/new', :action => 'add_issue_category' |
|
190 | project_views.connect 'projects/:id/categories/new', :action => 'add_issue_category' | |
190 | project_views.connect 'projects/:id/settings/:tab', :action => 'settings' |
|
191 | project_views.connect 'projects/:id/settings/:tab', :action => 'settings' | |
191 | end |
|
192 | end | |
192 |
|
193 | |||
193 | projects.with_options :action => 'activity', :conditions => {:method => :get} do |activity| |
|
194 | projects.with_options :action => 'activity', :conditions => {:method => :get} do |activity| | |
194 | activity.connect 'projects/:id/activity' |
|
195 | activity.connect 'projects/:id/activity' | |
195 | activity.connect 'projects/:id/activity.:format' |
|
196 | activity.connect 'projects/:id/activity.:format' | |
196 | activity.connect 'activity', :id => nil |
|
197 | activity.connect 'activity', :id => nil | |
197 | activity.connect 'activity.:format', :id => nil |
|
198 | activity.connect 'activity.:format', :id => nil | |
198 | end |
|
199 | end | |
199 |
|
200 | |||
200 | projects.with_options :conditions => {:method => :post} do |project_actions| |
|
201 | projects.with_options :conditions => {:method => :post} do |project_actions| | |
201 | project_actions.connect 'projects/new', :action => 'add' |
|
202 | project_actions.connect 'projects/new', :action => 'add' | |
202 | project_actions.connect 'projects', :action => 'add' |
|
203 | project_actions.connect 'projects', :action => 'add' | |
203 | project_actions.connect 'projects/:id/:action', :action => /destroy|archive|unarchive/ |
|
204 | project_actions.connect 'projects/:id/:action', :action => /destroy|archive|unarchive/ | |
204 | project_actions.connect 'projects/:id/files/new', :action => 'add_file' |
|
205 | project_actions.connect 'projects/:id/files/new', :action => 'add_file' | |
205 | project_actions.connect 'projects/:id/versions/new', :action => 'add_version' |
|
206 | project_actions.connect 'projects/:id/versions/new', :action => 'add_version' | |
206 | project_actions.connect 'projects/:id/categories/new', :action => 'add_issue_category' |
|
207 | project_actions.connect 'projects/:id/categories/new', :action => 'add_issue_category' | |
207 | end |
|
208 | end | |
208 | end |
|
209 | end | |
209 |
|
210 | |||
210 | map.with_options :controller => 'repositories' do |repositories| |
|
211 | map.with_options :controller => 'repositories' do |repositories| | |
211 | repositories.with_options :conditions => {:method => :get} do |repository_views| |
|
212 | repositories.with_options :conditions => {:method => :get} do |repository_views| | |
212 | repository_views.connect 'projects/:id/repository', :action => 'show' |
|
213 | repository_views.connect 'projects/:id/repository', :action => 'show' | |
213 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' |
|
214 | repository_views.connect 'projects/:id/repository/edit', :action => 'edit' | |
214 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' |
|
215 | repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' | |
215 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' |
|
216 | repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' | |
216 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' |
|
217 | repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' | |
217 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' |
|
218 | repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' | |
218 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' |
|
219 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' | |
219 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' |
|
220 | repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' | |
220 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path' |
|
221 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path' | |
221 | repository_views.connect 'projects/:id/repository/:action/*path' |
|
222 | repository_views.connect 'projects/:id/repository/:action/*path' | |
222 | end |
|
223 | end | |
223 |
|
224 | |||
224 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} |
|
225 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} | |
225 | end |
|
226 | end | |
226 |
|
227 | |||
227 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ |
|
228 | map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ | |
228 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ |
|
229 | map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ | |
229 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ |
|
230 | map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ | |
230 |
|
231 | |||
231 |
|
232 | |||
232 | #left old routes at the bottom for backwards compat |
|
233 | #left old routes at the bottom for backwards compat | |
233 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' |
|
234 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' | |
234 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' |
|
235 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' | |
235 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' |
|
236 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' | |
236 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' |
|
237 | map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' | |
237 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' |
|
238 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' | |
238 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' |
|
239 | map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' | |
239 | map.connect 'projects/:project_id/news/:action', :controller => 'news' |
|
240 | map.connect 'projects/:project_id/news/:action', :controller => 'news' | |
240 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ |
|
241 | map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ | |
241 | map.with_options :controller => 'repositories' do |omap| |
|
242 | map.with_options :controller => 'repositories' do |omap| | |
242 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' |
|
243 | omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' | |
243 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' |
|
244 | omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' | |
244 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' |
|
245 | omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' | |
245 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' |
|
246 | omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' | |
246 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' |
|
247 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' | |
247 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' |
|
248 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' | |
248 | end |
|
249 | end | |
249 |
|
250 | |||
250 | map.with_options :controller => 'sys' do |sys| |
|
251 | map.with_options :controller => 'sys' do |sys| | |
251 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} |
|
252 | sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} | |
252 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} |
|
253 | sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} | |
253 | end |
|
254 | end | |
254 |
|
255 | |||
255 | # Install the default route as the lowest priority. |
|
256 | # Install the default route as the lowest priority. | |
256 | map.connect ':controller/:action/:id' |
|
257 | map.connect ':controller/:action/:id' | |
257 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' |
|
258 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' | |
258 | # Used for OpenID |
|
259 | # Used for OpenID | |
259 | map.root :controller => 'account', :action => 'login' |
|
260 | map.root :controller => 'account', :action => 'login' | |
260 | end |
|
261 | end |
@@ -1,133 +1,146 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2009 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2009 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'boards_controller' |
|
19 | require 'boards_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class BoardsController; def rescue_action(e) raise e end; end |
|
22 | class BoardsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class BoardsControllerTest < Test::Unit::TestCase |
|
24 | class BoardsControllerTest < Test::Unit::TestCase | |
25 | fixtures :projects, :users, :members, :roles, :boards, :messages, :enabled_modules |
|
25 | fixtures :projects, :users, :members, :roles, :boards, :messages, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = BoardsController.new |
|
28 | @controller = BoardsController.new | |
29 | @request = ActionController::TestRequest.new |
|
29 | @request = ActionController::TestRequest.new | |
30 | @response = ActionController::TestResponse.new |
|
30 | @response = ActionController::TestResponse.new | |
31 | User.current = nil |
|
31 | User.current = nil | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def test_index_routing |
|
34 | def test_index_routing | |
35 | assert_routing( |
|
35 | assert_routing( | |
36 | {:method => :get, :path => '/projects/world_domination/boards'}, |
|
36 | {:method => :get, :path => '/projects/world_domination/boards'}, | |
37 | :controller => 'boards', :action => 'index', :project_id => 'world_domination' |
|
37 | :controller => 'boards', :action => 'index', :project_id => 'world_domination' | |
38 | ) |
|
38 | ) | |
39 | end |
|
39 | end | |
40 |
|
40 | |||
41 | def test_index |
|
41 | def test_index | |
42 | get :index, :project_id => 1 |
|
42 | get :index, :project_id => 1 | |
43 | assert_response :success |
|
43 | assert_response :success | |
44 | assert_template 'index' |
|
44 | assert_template 'index' | |
45 | assert_not_nil assigns(:boards) |
|
45 | assert_not_nil assigns(:boards) | |
46 | assert_not_nil assigns(:project) |
|
46 | assert_not_nil assigns(:project) | |
47 | end |
|
47 | end | |
48 |
|
48 | |||
49 | def test_index_not_found |
|
49 | def test_index_not_found | |
50 | get :index, :project_id => 97 |
|
50 | get :index, :project_id => 97 | |
51 | assert_response 404 |
|
51 | assert_response 404 | |
52 | end |
|
52 | end | |
53 |
|
53 | |||
54 | def test_index_should_show_messages_if_only_one_board |
|
54 | def test_index_should_show_messages_if_only_one_board | |
55 | Project.find(1).boards.slice(1..-1).each(&:destroy) |
|
55 | Project.find(1).boards.slice(1..-1).each(&:destroy) | |
56 |
|
56 | |||
57 | get :index, :project_id => 1 |
|
57 | get :index, :project_id => 1 | |
58 | assert_response :success |
|
58 | assert_response :success | |
59 | assert_template 'show' |
|
59 | assert_template 'show' | |
60 | assert_not_nil assigns(:topics) |
|
60 | assert_not_nil assigns(:topics) | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | def test_new_routing |
|
63 | def test_new_routing | |
64 | assert_routing( |
|
64 | assert_routing( | |
65 | {:method => :get, :path => '/projects/world_domination/boards/new'}, |
|
65 | {:method => :get, :path => '/projects/world_domination/boards/new'}, | |
66 | :controller => 'boards', :action => 'new', :project_id => 'world_domination' |
|
66 | :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |
67 | ) |
|
67 | ) | |
68 | assert_recognizes( |
|
68 | assert_recognizes( | |
69 | {:controller => 'boards', :action => 'new', :project_id => 'world_domination'}, |
|
69 | {:controller => 'boards', :action => 'new', :project_id => 'world_domination'}, | |
70 | {:method => :post, :path => '/projects/world_domination/boards'} |
|
70 | {:method => :post, :path => '/projects/world_domination/boards'} | |
71 | ) |
|
71 | ) | |
72 | end |
|
72 | end | |
73 |
|
73 | |||
74 | def test_post_new |
|
74 | def test_post_new | |
75 | @request.session[:user_id] = 2 |
|
75 | @request.session[:user_id] = 2 | |
76 | assert_difference 'Board.count' do |
|
76 | assert_difference 'Board.count' do | |
77 | post :new, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing board creation'} |
|
77 | post :new, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing board creation'} | |
78 | end |
|
78 | end | |
79 | assert_redirected_to '/projects/ecookbook/settings/boards' |
|
79 | assert_redirected_to '/projects/ecookbook/settings/boards' | |
80 | end |
|
80 | end | |
81 |
|
81 | |||
82 | def test_show_routing |
|
82 | def test_show_routing | |
83 | assert_routing( |
|
83 | assert_routing( | |
84 | {:method => :get, :path => '/projects/world_domination/boards/44'}, |
|
84 | {:method => :get, :path => '/projects/world_domination/boards/44'}, | |
85 | :controller => 'boards', :action => 'show', :id => '44', :project_id => 'world_domination' |
|
85 | :controller => 'boards', :action => 'show', :id => '44', :project_id => 'world_domination' | |
86 | ) |
|
86 | ) | |
|
87 | assert_routing( | |||
|
88 | {:method => :get, :path => '/projects/world_domination/boards/44.atom'}, | |||
|
89 | :controller => 'boards', :action => 'show', :id => '44', :project_id => 'world_domination', :format => 'atom' | |||
|
90 | ) | |||
87 | end |
|
91 | end | |
88 |
|
92 | |||
89 | def test_show |
|
93 | def test_show | |
90 | get :show, :project_id => 1, :id => 1 |
|
94 | get :show, :project_id => 1, :id => 1 | |
91 | assert_response :success |
|
95 | assert_response :success | |
92 | assert_template 'show' |
|
96 | assert_template 'show' | |
93 | assert_not_nil assigns(:board) |
|
97 | assert_not_nil assigns(:board) | |
94 | assert_not_nil assigns(:project) |
|
98 | assert_not_nil assigns(:project) | |
95 | assert_not_nil assigns(:topics) |
|
99 | assert_not_nil assigns(:topics) | |
96 | end |
|
100 | end | |
97 |
|
101 | |||
|
102 | def test_show_atom | |||
|
103 | get :show, :project_id => 1, :id => 1, :format => 'atom' | |||
|
104 | assert_response :success | |||
|
105 | assert_template 'common/feed.atom' | |||
|
106 | assert_not_nil assigns(:board) | |||
|
107 | assert_not_nil assigns(:project) | |||
|
108 | assert_not_nil assigns(:messages) | |||
|
109 | end | |||
|
110 | ||||
98 | def test_edit_routing |
|
111 | def test_edit_routing | |
99 | assert_routing( |
|
112 | assert_routing( | |
100 | {:method => :get, :path => '/projects/world_domination/boards/44/edit'}, |
|
113 | {:method => :get, :path => '/projects/world_domination/boards/44/edit'}, | |
101 | :controller => 'boards', :action => 'edit', :id => '44', :project_id => 'world_domination' |
|
114 | :controller => 'boards', :action => 'edit', :id => '44', :project_id => 'world_domination' | |
102 | ) |
|
115 | ) | |
103 | assert_recognizes(#TODO: use PUT method to board_path, modify form accordingly |
|
116 | assert_recognizes(#TODO: use PUT method to board_path, modify form accordingly | |
104 | {:controller => 'boards', :action => 'edit', :id => '44', :project_id => 'world_domination'}, |
|
117 | {:controller => 'boards', :action => 'edit', :id => '44', :project_id => 'world_domination'}, | |
105 | {:method => :post, :path => '/projects/world_domination/boards/44/edit'} |
|
118 | {:method => :post, :path => '/projects/world_domination/boards/44/edit'} | |
106 | ) |
|
119 | ) | |
107 | end |
|
120 | end | |
108 |
|
121 | |||
109 | def test_post_edit |
|
122 | def test_post_edit | |
110 | @request.session[:user_id] = 2 |
|
123 | @request.session[:user_id] = 2 | |
111 | assert_no_difference 'Board.count' do |
|
124 | assert_no_difference 'Board.count' do | |
112 | post :edit, :project_id => 1, :id => 2, :board => { :name => 'Testing', :description => 'Testing board update'} |
|
125 | post :edit, :project_id => 1, :id => 2, :board => { :name => 'Testing', :description => 'Testing board update'} | |
113 | end |
|
126 | end | |
114 | assert_redirected_to '/projects/ecookbook/settings/boards' |
|
127 | assert_redirected_to '/projects/ecookbook/settings/boards' | |
115 | assert_equal 'Testing', Board.find(2).name |
|
128 | assert_equal 'Testing', Board.find(2).name | |
116 | end |
|
129 | end | |
117 |
|
130 | |||
118 | def test_destroy_routing |
|
131 | def test_destroy_routing | |
119 | assert_routing(#TODO: use DELETE method to board_path, modify form accoringly |
|
132 | assert_routing(#TODO: use DELETE method to board_path, modify form accoringly | |
120 | {:method => :post, :path => '/projects/world_domination/boards/44/destroy'}, |
|
133 | {:method => :post, :path => '/projects/world_domination/boards/44/destroy'}, | |
121 | :controller => 'boards', :action => 'destroy', :id => '44', :project_id => 'world_domination' |
|
134 | :controller => 'boards', :action => 'destroy', :id => '44', :project_id => 'world_domination' | |
122 | ) |
|
135 | ) | |
123 | end |
|
136 | end | |
124 |
|
137 | |||
125 | def test_post_destroy |
|
138 | def test_post_destroy | |
126 | @request.session[:user_id] = 2 |
|
139 | @request.session[:user_id] = 2 | |
127 | assert_difference 'Board.count', -1 do |
|
140 | assert_difference 'Board.count', -1 do | |
128 | post :destroy, :project_id => 1, :id => 2 |
|
141 | post :destroy, :project_id => 1, :id => 2 | |
129 | end |
|
142 | end | |
130 | assert_redirected_to '/projects/ecookbook/settings/boards' |
|
143 | assert_redirected_to '/projects/ecookbook/settings/boards' | |
131 | assert_nil Board.find_by_id(2) |
|
144 | assert_nil Board.find_by_id(2) | |
132 | end |
|
145 | end | |
133 | end |
|
146 | end |
General Comments 0
You need to be logged in to leave comments.
Login now