##// END OF EJS Templates
Per project forums added....
Jean-Philippe Lang -
r526:b90e84b9fe25
parent child
Show More
@@ -0,0 +1,87
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 class BoardsController < ApplicationController
19 layout 'base'
20 before_filter :find_project
21 before_filter :authorize, :except => [:index, :show]
22 before_filter :check_project_privacy, :only => [:index, :show]
23
24 helper :messages
25 include MessagesHelper
26 helper :sort
27 include SortHelper
28
29 def index
30 @boards = @project.boards
31 # show the board if there is only one
32 if @boards.size == 1
33 @board = @boards.first
34 show
35 render :action => 'show'
36 end
37 end
38
39 def show
40 sort_init "#{Message.table_name}.updated_on", "desc"
41 sort_update
42
43 @topic_count = @board.topics.count
44 @topic_pages = Paginator.new self, @topic_count, 25, params['page']
45 @topics = @board.topics.find :all, :order => sort_clause,
46 :include => [:author, {:last_reply => :author}],
47 :limit => @topic_pages.items_per_page,
48 :offset => @topic_pages.current.offset
49 render :action => 'show', :layout => false if request.xhr?
50 end
51
52 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index }
53
54 def new
55 @board = Board.new(params[:board])
56 @board.project = @project
57 if request.post? && @board.save
58 flash[:notice] = l(:notice_successful_create)
59 redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
60 end
61 end
62
63 def edit
64 if request.post? && @board.update_attributes(params[:board])
65 case params[:position]
66 when 'highest'; @board.move_to_top
67 when 'higher'; @board.move_higher
68 when 'lower'; @board.move_lower
69 when 'lowest'; @board.move_to_bottom
70 end if params[:position]
71 redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
72 end
73 end
74
75 def destroy
76 @board.destroy
77 redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
78 end
79
80 private
81 def find_project
82 @project = Project.find(params[:project_id])
83 @board = @project.boards.find(params[:id]) if params[:id]
84 rescue ActiveRecord::RecordNotFound
85 render_404
86 end
87 end
@@ -0,0 +1,66
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 class MessagesController < ApplicationController
19 layout 'base'
20 before_filter :find_project, :check_project_privacy
21 before_filter :require_login, :only => [:new, :reply]
22
23 verify :method => :post, :only => [ :reply, :destroy ], :redirect_to => { :action => :show }
24
25 def show
26 @reply = Message.new(:subject => "RE: #{@message.subject}")
27 render :action => "show", :layout => false if request.xhr?
28 end
29
30 def new
31 @message = Message.new(params[:message])
32 @message.author = logged_in_user
33 @message.board = @board
34 if request.post? && @message.save
35 params[:attachments].each { |file|
36 next unless file.size > 0
37 Attachment.create(:container => @message, :file => file, :author => logged_in_user)
38 } if params[:attachments] and params[:attachments].is_a? Array
39 redirect_to :action => 'show', :id => @message
40 end
41 end
42
43 def reply
44 @reply = Message.new(params[:reply])
45 @reply.author = logged_in_user
46 @reply.board = @board
47 @message.children << @reply
48 redirect_to :action => 'show', :id => @message
49 end
50
51 def download
52 @attachment = @message.attachments.find(params[:attachment_id])
53 send_file @attachment.diskfile, :filename => @attachment.filename
54 rescue
55 render_404
56 end
57
58 private
59 def find_project
60 @board = Board.find(params[:board_id], :include => :project)
61 @project = @board.project
62 @message = @board.topics.find(params[:id]) if params[:id]
63 rescue ActiveRecord::RecordNotFound
64 render_404
65 end
66 end
@@ -0,0 +1,19
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 module BoardsHelper
19 end
@@ -0,0 +1,28
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 module MessagesHelper
19
20 def link_to_message(message)
21 return '' unless message
22 link_to h(truncate(message.subject, 60)), :controller => 'messages',
23 :action => 'show',
24 :board_id => message.board_id,
25 :id => message.root,
26 :anchor => (message.parent_id ? "message-#{message.id}" : nil)
27 end
28 end
@@ -0,0 +1,28
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 class Board < ActiveRecord::Base
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"
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
23 acts_as_list :scope => :project_id
24
25 validates_presence_of :name, :description
26 validates_length_of :name, :maximum => 30
27 validates_length_of :description, :maximum => 255
28 end
@@ -0,0 +1,37
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 class Message < ActiveRecord::Base
19 belongs_to :board
20 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
21 acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
22 has_many :attachments, :as => :container, :dependent => :destroy
23 belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id'
24
25 validates_presence_of :subject, :content
26 validates_length_of :subject, :maximum => 255
27
28 def after_create
29 board.update_attribute(:last_message_id, self.id)
30 board.increment! :messages_count
31 if parent
32 parent.reload.update_attribute(:last_reply_id, self.id)
33 else
34 board.increment! :topics_count
35 end
36 end
37 end
@@ -0,0 +1,8
1 <%= error_messages_for 'board' %>
2
3 <!--[form:board]-->
4 <div class="box">
5 <p><%= f.text_field :name, :required => true %></p>
6 <p><%= f.text_field :description, :required => true, :size => 80 %></p>
7 </div>
8 <!--[eoform:board]-->
@@ -0,0 +1,6
1 <h2><%= l(:label_board) %></h2>
2
3 <% labelled_tabular_form_for :board, @board, :url => {:action => 'edit', :id => @board} do |f| %>
4 <%= render :partial => 'form', :locals => {:f => f} %>
5 <%= submit_tag l(:button_save) %>
6 <% end %>
@@ -0,0 +1,30
1 <h2><%= l(:label_board_plural) %></h2>
2
3 <table class="list">
4 <thead><tr>
5 <th><%= l(:label_board) %></th>
6 <th><%= l(:label_topic_plural) %></th>
7 <th><%= l(:label_message_plural) %></th>
8 <th><%= l(:label_message_last) %></th>
9 </tr></thead>
10 <tbody>
11 <% for board in @boards %>
12 <tr class="<%= cycle 'odd', 'even' %>">
13 <td>
14 <%= link_to h(board.name), {:action => 'show', :id => board}, :class => "icon22 icon22-comment" %><br />
15 <%=h board.description %>
16 </td>
17 <td align="center"><%= board.topics_count %></td>
18 <td align="center"><%= board.messages_count %></td>
19 <td>
20 <small>
21 <% if board.last_message %>
22 <%= board.last_message.author.name %>, <%= format_time(board.last_message.created_on) %><br />
23 <%= link_to_message board.last_message %>
24 <% end %>
25 </small>
26 </td>
27 </tr>
28 <% end %>
29 </tbody>
30 </table>
@@ -0,0 +1,6
1 <h2><%= l(:label_board_new) %></h2>
2
3 <% labelled_tabular_form_for :board, @board, :url => {:action => 'new'} do |f| %>
4 <%= render :partial => 'form', :locals => {:f => f} %>
5 <%= submit_tag l(:button_create) %>
6 <% end %>
@@ -0,0 +1,36
1 <div class="contextual">
2 <%= link_to l(:label_message_new), {:controller => 'messages', :action => 'new', :board_id => @board}, :class => "icon icon-add" %>
3 </div>
4
5 <h2><%=h @board.name %></h2>
6
7 <table class="list">
8 <thead><tr>
9 <th><%= l(:field_subject) %></th>
10 <th><%= l(:field_author) %></th>
11 <%= sort_header_tag("#{Message.table_name}.created_on", :caption => l(:field_created_on)) %>
12 <th><%= l(:label_reply_plural) %></th>
13 <%= sort_header_tag("#{Message.table_name}.updated_on", :caption => l(:label_message_last)) %>
14 </tr></thead>
15 <tbody>
16 <% @topics.each do |topic| %>
17 <tr class="<%= cycle 'odd', 'even' %>">
18 <td><%= link_to h(topic.subject), :controller => 'messages', :action => 'show', :board_id => @board, :id => topic %></td>
19 <td align="center"><%= link_to_user topic.author %></td>
20 <td align="center"><%= format_time(topic.created_on) %></td>
21 <td align="center"><%= topic.replies_count %></td>
22 <td>
23 <small>
24 <% if topic.last_reply %>
25 <%= topic.last_reply.author.name %>, <%= format_time(topic.last_reply.created_on) %><br />
26 <%= link_to_message topic.last_reply %>
27 <% end %>
28 </small>
29 </td>
30 </tr>
31 <% end %>
32 </tbody>
33 </table>
34
35 <p><%= pagination_links_full @topic_pages %>
36 [ <%= @topic_pages.current.first_item %> - <%= @topic_pages.current.last_item %> / <%= @topic_count %> ]</p>
@@ -0,0 +1,17
1 <%= error_messages_for 'message' %>
2
3 <div class="box">
4 <!--[form:message]-->
5 <p><label><%= l(:field_subject) %></label><br />
6 <%= f.text_field :subject, :required => true, :size => 80 %></p>
7
8 <p><%= f.text_area :content, :required => true, :cols => 80, :rows => 15 %></p>
9 <%= wikitoolbar_for 'message_content' %>
10 <!--[eoform:message]-->
11
12 <span class="tabular">
13 <p id="attachments_p"><label><%=l(:label_attachment)%>
14 <%= image_to_function "add.png", "addFileField();return false" %></label>
15 <%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</em></p>
16 </span>
17 </div>
@@ -0,0 +1,6
1 <h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%= l(:label_message_new) %></h2>
2
3 <% form_for :message, @message, :url => {:action => 'new'}, :html => {:multipart => true} do |f| %>
4 <%= render :partial => 'form', :locals => {:f => f} %>
5 <%= submit_tag l(:button_create) %>
6 <% end %>
@@ -0,0 +1,29
1 <h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%=h @message.subject %></h2>
2
3 <p><em><%= @message.author.name %>, <%= format_time(@message.created_on) %></em></p>
4 <div class="wiki">
5 <%= textilizable(@message.content) %>
6 </div>
7 <div class="attachments">
8 <% @message.attachments.each do |attachment| %>
9 <%= link_to attachment.filename, { :action => 'download', :id => @message, :attachment_id => attachment }, :class => 'icon icon-attachment' %>
10 (<%= number_to_human_size(attachment.filesize) %>)<br />
11 <% end %>
12 </div>
13 <br />
14 <h3 class="icon22 icon22-comment"><%= l(:label_reply_plural) %></h3>
15 <% @message.children.each do |message| %>
16 <a name="<%= "message-#{message.id}" %>"></a>
17 <h4><%=h message.subject %> - <%= message.author.name %>, <%= format_time(message.created_on) %></h4>
18 <div class="wiki"><p><%= textilizable message.content %></p></div>
19 <% end %>
20
21 <p><%= toggle_link l(:button_reply), "reply", :focus => "reply_content" %></p>
22 <div id="reply" style="display:none;">
23 <%= error_messages_for 'message' %>
24 <% form_for :reply, @reply, :url => {:action => 'reply', :id => @message} do |f| %>
25 <p><%= f.text_field :subject, :required => true, :size => 60 %></p>
26 <p><%= f.text_area :content, :required => true, :cols => 80, :rows => 10 %></p>
27 <p><%= submit_tag l(:button_submit) %></p>
28 <% end %>
29 </div>
@@ -0,0 +1,24
1 <table class="list">
2 <thead><th><%= l(:label_board) %></th><th><%= l(:field_description) %></th><th style="width:15%"></th><th style="width:15%"></th><th style="width:15%"></th></thead>
3 <tbody>
4 <% @project.boards.each do |board|
5 next if board.new_record? %>
6 <tr class="<%= cycle 'odd', 'even' %>">
7 <td><%=h board.name %></td>
8 <td><%=h board.description %></td>
9 <td align="center">
10 <% if authorize_for("boards", "edit") %>
11 <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %>
12 <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> -
13 <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %>
14 <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %>
15 <% end %>
16 </td>
17 <td align="center"><small><%= link_to_if_authorized l(:button_edit), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board}, :class => 'icon icon-edit' %></small></td>
18 <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'boards', :action => 'destroy', :project_id => @project, :id => board}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td>
19 </tr>
20 <% end %>
21 </tbody>
22 </table>
23 &nbsp;
24 <p><%= link_to_if_authorized l(:label_board_new), {:controller => 'boards', :action => 'new', :project_id => @project} %></p>
@@ -0,0 +1,18
1 class CreateBoards < ActiveRecord::Migration
2 def self.up
3 create_table :boards do |t|
4 t.column :project_id, :integer, :null => false
5 t.column :name, :string, :default => "", :null => false
6 t.column :description, :string
7 t.column :position, :integer, :default => 1, :null => false
8 t.column :topics_count, :integer, :default => 0, :null => false
9 t.column :messages_count, :integer, :default => 0, :null => false
10 t.column :last_message_id, :integer
11 end
12 add_index :boards, [:project_id], :name => :boards_project_id
13 end
14
15 def self.down
16 drop_table :boards
17 end
18 end
@@ -0,0 +1,21
1 class CreateMessages < ActiveRecord::Migration
2 def self.up
3 create_table :messages do |t|
4 t.column :board_id, :integer, :null => false
5 t.column :parent_id, :integer
6 t.column :subject, :string, :default => "", :null => false
7 t.column :content, :text
8 t.column :author_id, :integer
9 t.column :replies_count, :integer, :default => 0, :null => false
10 t.column :last_reply_id, :integer
11 t.column :created_on, :datetime, :null => false
12 t.column :updated_on, :datetime, :null => false
13 end
14 add_index :messages, [:board_id], :name => :messages_board_id
15 add_index :messages, [:parent_id], :name => :messages_parent_id
16 end
17
18 def self.down
19 drop_table :messages
20 end
21 end
@@ -0,0 +1,13
1 class AddBoardsPermissions < ActiveRecord::Migration
2 def self.up
3 Permission.create :controller => "boards", :action => "new", :description => "button_add", :sort => 2000, :is_public => false, :mail_option => 0, :mail_enabled => 0
4 Permission.create :controller => "boards", :action => "edit", :description => "button_edit", :sort => 2005, :is_public => false, :mail_option => 0, :mail_enabled => 0
5 Permission.create :controller => "boards", :action => "destroy", :description => "button_delete", :sort => 2010, :is_public => false, :mail_option => 0, :mail_enabled => 0
6 end
7
8 def self.down
9 Permission.find_by_controller_and_action("boards", "new").destroy
10 Permission.find_by_controller_and_action("boards", "edit").destroy
11 Permission.find_by_controller_and_action("boards", "destroy").destroy
12 end
13 end
@@ -0,0 +1,19
1 ---
2 boards_001:
3 name: Help
4 project_id: 1
5 topics_count: 1
6 id: 1
7 description: Help board
8 position: 1
9 last_message_id: 2
10 messages_count: 2
11 boards_002:
12 name: Discussion
13 project_id: 1
14 topics_count: 0
15 id: 2
16 description: Discussion board
17 position: 2
18 last_message_id:
19 messages_count: 0
@@ -0,0 +1,25
1 ---
2 messages_001:
3 created_on: 2007-05-12 17:15:32 +02:00
4 updated_on: 2007-05-12 17:15:32 +02:00
5 subject: First post
6 id: 1
7 replies_count: 1
8 last_reply_id: 2
9 content: "This is the very first post\n\
10 in the forum"
11 author_id: 1
12 parent_id:
13 board_id: 1
14 messages_002:
15 created_on: 2007-05-12 17:18:00 +02:00
16 updated_on: 2007-05-12 17:18:00 +02:00
17 subject: First reply
18 id: 2
19 replies_count: 0
20 last_reply_id:
21 content: "Reply to the first post"
22 author_id: 1
23 parent_id: 1
24 board_id: 1
25 No newline at end of file
@@ -0,0 +1,30
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class BoardTest < Test::Unit::TestCase
4 fixtures :projects, :boards, :messages
5
6 def setup
7 @project = Project.find(1)
8 end
9
10 def test_create
11 board = Board.new(:project => @project, :name => 'Test board', :description => 'Test board description')
12 assert board.save
13 board.reload
14 assert_equal 'Test board', board.name
15 assert_equal 'Test board description', board.description
16 assert_equal @project, board.project
17 assert_equal 0, board.topics_count
18 assert_equal 0, board.messages_count
19 assert_nil board.last_message
20 # last position
21 assert_equal @project.boards.size, board.position
22 end
23
24 def test_destroy
25 board = Board.find(1)
26 assert board.destroy
27 # make sure that the associated messages are removed
28 assert_equal 0, Message.count(:conditions => {:board_id => 1})
29 end
30 end
@@ -0,0 +1,44
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class MessageTest < Test::Unit::TestCase
4 fixtures :projects, :boards, :messages
5
6 def setup
7 @board = Board.find(1)
8 @user = User.find(1)
9 end
10
11 def test_create
12 topics_count = @board.topics_count
13 messages_count = @board.messages_count
14
15 message = Message.new(:board => @board, :subject => 'Test message', :content => 'Test message content', :author => @user)
16 assert message.save
17 @board.reload
18 # topics count incremented
19 assert_equal topics_count+1, @board[:topics_count]
20 # messages count incremented
21 assert_equal messages_count+1, @board[:messages_count]
22 assert_equal message, @board.last_message
23 end
24
25 def test_reply
26 topics_count = @board.topics_count
27 messages_count = @board.messages_count
28 @message = Message.find(1)
29 replies_count = @message.replies_count
30
31 reply = Message.new(:board => @board, :subject => 'Test reply', :content => 'Test reply content', :parent => @message, :author => @user)
32 assert reply.save
33 @board.reload
34 # same topics count
35 assert_equal topics_count, @board[:topics_count]
36 # messages count incremented
37 assert_equal messages_count+1, @board[:messages_count]
38 assert_equal reply, @board.last_message
39 @message.reload
40 # replies count incremented
41 assert_equal replies_count+1, @message[:replies_count]
42 assert_equal reply, @message.last_reply
43 end
44 end
@@ -215,6 +215,11 module ApplicationHelper
215 image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
215 image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
216 javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
216 javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
217 end
217 end
218
219 def wikitoolbar_for(field_id)
220 return '' unless Setting.text_formatting == 'textile'
221 javascript_include_tag('jstoolbar') + javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.draw();")
222 end
218 end
223 end
219
224
220 class TabularFormBuilder < ActionView::Helpers::FormBuilder
225 class TabularFormBuilder < ActionView::Helpers::FormBuilder
@@ -31,7 +31,8 class Permission < ActiveRecord::Base
31 1200 => :label_document_plural,
31 1200 => :label_document_plural,
32 1300 => :label_attachment_plural,
32 1300 => :label_attachment_plural,
33 1400 => :label_repository,
33 1400 => :label_repository,
34 1500 => :label_time_tracking
34 1500 => :label_time_tracking,
35 2000 => :label_board_plural
35 }.freeze
36 }.freeze
36
37
37 @@cached_perms_for_public = nil
38 @@cached_perms_for_public = nil
@@ -26,6 +26,7 class Project < ActiveRecord::Base
26 has_many :documents, :dependent => :destroy
26 has_many :documents, :dependent => :destroy
27 has_many :news, :dependent => :delete_all, :include => :author
27 has_many :news, :dependent => :delete_all, :include => :author
28 has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name"
28 has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name"
29 has_many :boards, :order => "position ASC"
29 has_one :repository, :dependent => :destroy
30 has_one :repository, :dependent => :destroy
30 has_one :wiki, :dependent => :destroy
31 has_one :wiki, :dependent => :destroy
31 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
32 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
@@ -79,6 +79,7
79 <%= link_to l(:label_roadmap), {:controller => 'projects', :action => 'roadmap', :id => @project }, :class => "menuItem" %>
79 <%= link_to l(:label_roadmap), {:controller => 'projects', :action => 'roadmap', :id => @project }, :class => "menuItem" %>
80 <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %>
80 <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %>
81 <%= link_to l(:label_wiki), {:controller => 'wiki', :id => @project, :page => nil }, :class => "menuItem" if @project.wiki and !@project.wiki.new_record? %>
81 <%= link_to l(:label_wiki), {:controller => 'wiki', :id => @project, :page => nil }, :class => "menuItem" if @project.wiki and !@project.wiki.new_record? %>
82 <%= link_to l(:label_board_plural), {:controller => 'boards', :project_id => @project }, :class => "menuItem" unless @project.boards.empty? %>
82 <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %>
83 <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %>
83 <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project }, :class => "menuItem" %>
84 <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project }, :class => "menuItem" %>
84 <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %>
85 <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %>
@@ -103,6 +104,7
103 <li><%= link_to l(:label_roadmap), :controller => 'projects', :action => 'roadmap', :id => @project %></li>
104 <li><%= link_to l(:label_roadmap), :controller => 'projects', :action => 'roadmap', :id => @project %></li>
104 <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>
105 <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>
105 <%= content_tag("li", link_to(l(:label_wiki), :controller => 'wiki', :id => @project, :page => nil)) if @project.wiki and !@project.wiki.new_record? %>
106 <%= content_tag("li", link_to(l(:label_wiki), :controller => 'wiki', :id => @project, :page => nil)) if @project.wiki and !@project.wiki.new_record? %>
107 <%= content_tag("li", link_to(l(:label_board_plural), :controller => 'boards', :project_id => @project)) unless @project.boards.empty? %>
106 <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>
108 <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>
107 <li><%= link_to l(:label_search), :controller => 'search', :action => 'index', :id => @project %></li>
109 <li><%= link_to l(:label_search), :controller => 'search', :action => 'index', :id => @project %></li>
108 <%= content_tag("li", link_to(l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project)) if @project.repository and !@project.repository.new_record? %>
110 <%= content_tag("li", link_to(l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project)) if @project.repository and !@project.repository.new_record? %>
@@ -6,6 +6,7
6 <li><%= link_to l(:label_member_plural), {}, :id=> "tab-members", :onclick => "showTab('members'); this.blur(); return false;" %></li>
6 <li><%= link_to l(:label_member_plural), {}, :id=> "tab-members", :onclick => "showTab('members'); this.blur(); return false;" %></li>
7 <li><%= link_to l(:label_version_plural), {}, :id=> "tab-versions", :onclick => "showTab('versions'); this.blur(); return false;" %></li>
7 <li><%= link_to l(:label_version_plural), {}, :id=> "tab-versions", :onclick => "showTab('versions'); this.blur(); return false;" %></li>
8 <li><%= link_to l(:label_issue_category_plural), {}, :id=> "tab-categories", :onclick => "showTab('categories'); this.blur(); return false;" %></li>
8 <li><%= link_to l(:label_issue_category_plural), {}, :id=> "tab-categories", :onclick => "showTab('categories'); this.blur(); return false;" %></li>
9 <li><%= link_to l(:label_board_plural), {}, :id=> "tab-boards", :onclick => "showTab('boards'); this.blur(); return false;" %></li>
9 </ul>
10 </ul>
10 </div>
11 </div>
11
12
@@ -76,5 +77,9
76 <% end %>
77 <% end %>
77 </div>
78 </div>
78
79
80 <div id="tab-content-boards" class="tab-content" style="display:none;">
81 <%= render :partial => 'boards' %>
82 </div>
83
79 <%= tab = params[:tab] ? h(params[:tab]) : 'info'
84 <%= tab = params[:tab] ? h(params[:tab]) : 'info'
80 javascript_tag "showTab('#{tab}');" %> No newline at end of file
85 javascript_tag "showTab('#{tab}');" %>
@@ -16,6 +16,8 ActionController::Routing::Routes.draw do |map|
16 #map.connect ':controller/:action/:id/:sort_key/:sort_order'
16 #map.connect ':controller/:action/:id/:sort_key/:sort_order'
17
17
18 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
18 map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
19 map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
20 map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
19
21
20 # Allow downloading Web Service WSDL as a file with an extension
22 # Allow downloading Web Service WSDL as a file with an extension
21 # instead of a file named 'wsdl'
23 # instead of a file named 'wsdl'
@@ -385,6 +385,14 label_stay_logged_in: Stay logged in
385 label_disabled: disabled
385 label_disabled: disabled
386 label_show_completed_versions: Show completed versions
386 label_show_completed_versions: Show completed versions
387 label_me: me
387 label_me: me
388 label_board: Forum
389 label_board_new: New forum
390 label_board_plural: Forums
391 label_topic_plural: Topics
392 label_message_plural: Messages
393 label_message_last: Last message
394 label_message_new: New message
395 label_reply_plural: Replies
388
396
389 button_login: Вход
397 button_login: Вход
390 button_submit: Изпращане
398 button_submit: Изпращане
@@ -413,6 +421,7 button_log_time: Отделяне на време
413 button_rollback: Върни се към тази ревизия
421 button_rollback: Върни се към тази ревизия
414 button_watch: Наблюдавай
422 button_watch: Наблюдавай
415 button_unwatch: Спри наблюдението
423 button_unwatch: Спри наблюдението
424 button_reply: Reply
416
425
417 status_active: активен
426 status_active: активен
418 status_registered: регистриран
427 status_registered: регистриран
@@ -385,6 +385,14 label_stay_logged_in: Stay logged in
385 label_disabled: disabled
385 label_disabled: disabled
386 label_show_completed_versions: Show completed versions
386 label_show_completed_versions: Show completed versions
387 label_me: me
387 label_me: me
388 label_board: Forum
389 label_board_new: New forum
390 label_board_plural: Forums
391 label_topic_plural: Topics
392 label_message_plural: Messages
393 label_message_last: Last message
394 label_message_new: New message
395 label_reply_plural: Replies
388
396
389 button_login: Einloggen
397 button_login: Einloggen
390 button_submit: OK
398 button_submit: OK
@@ -413,6 +421,7 button_log_time: Log time
413 button_rollback: Rollback to this version
421 button_rollback: Rollback to this version
414 button_watch: Watch
422 button_watch: Watch
415 button_unwatch: Unwatch
423 button_unwatch: Unwatch
424 button_reply: Reply
416
425
417 status_active: aktiv
426 status_active: aktiv
418 status_registered: angemeldet
427 status_registered: angemeldet
@@ -385,6 +385,14 label_stay_logged_in: Stay logged in
385 label_disabled: disabled
385 label_disabled: disabled
386 label_show_completed_versions: Show completed versions
386 label_show_completed_versions: Show completed versions
387 label_me: me
387 label_me: me
388 label_board: Forum
389 label_board_new: New forum
390 label_board_plural: Forums
391 label_topic_plural: Topics
392 label_message_plural: Messages
393 label_message_last: Last message
394 label_message_new: New message
395 label_reply_plural: Replies
388
396
389 button_login: Login
397 button_login: Login
390 button_submit: Submit
398 button_submit: Submit
@@ -413,6 +421,7 button_log_time: Log time
413 button_rollback: Rollback to this version
421 button_rollback: Rollback to this version
414 button_watch: Watch
422 button_watch: Watch
415 button_unwatch: Unwatch
423 button_unwatch: Unwatch
424 button_reply: Reply
416
425
417 status_active: active
426 status_active: active
418 status_registered: registered
427 status_registered: registered
@@ -385,6 +385,14 label_stay_logged_in: Stay logged in
385 label_disabled: disabled
385 label_disabled: disabled
386 label_show_completed_versions: Show completed versions
386 label_show_completed_versions: Show completed versions
387 label_me: me
387 label_me: me
388 label_board: Forum
389 label_board_new: New forum
390 label_board_plural: Forums
391 label_topic_plural: Topics
392 label_message_plural: Messages
393 label_message_last: Last message
394 label_message_new: New message
395 label_reply_plural: Replies
388
396
389 button_login: Conexión
397 button_login: Conexión
390 button_submit: Someter
398 button_submit: Someter
@@ -413,6 +421,7 button_log_time: Log time
413 button_rollback: Rollback to this version
421 button_rollback: Rollback to this version
414 button_watch: Watch
422 button_watch: Watch
415 button_unwatch: Unwatch
423 button_unwatch: Unwatch
424 button_reply: Reply
416
425
417 status_active: active
426 status_active: active
418 status_registered: registered
427 status_registered: registered
@@ -385,6 +385,14 label_stay_logged_in: Rester connecté
385 label_disabled: désactivé
385 label_disabled: désactivé
386 label_show_completed_versions: Voire les versions passées
386 label_show_completed_versions: Voire les versions passées
387 label_me: moi
387 label_me: moi
388 label_board: Forum
389 label_board_new: Nouveau forum
390 label_board_plural: Forums
391 label_topic_plural: Discussions
392 label_message_plural: Messages
393 label_message_last: Dernier message
394 label_message_new: Nouveau message
395 label_reply_plural: Réponses
388
396
389 button_login: Connexion
397 button_login: Connexion
390 button_submit: Soumettre
398 button_submit: Soumettre
@@ -413,6 +421,7 button_log_time: Saisir temps
413 button_rollback: Revenir à cette version
421 button_rollback: Revenir à cette version
414 button_watch: Surveiller
422 button_watch: Surveiller
415 button_unwatch: Ne plus surveiller
423 button_unwatch: Ne plus surveiller
424 button_reply: Répondre
416
425
417 status_active: actif
426 status_active: actif
418 status_registered: enregistré
427 status_registered: enregistré
@@ -385,6 +385,14 label_stay_logged_in: Stay logged in
385 label_disabled: disabled
385 label_disabled: disabled
386 label_show_completed_versions: Show completed versions
386 label_show_completed_versions: Show completed versions
387 label_me: me
387 label_me: me
388 label_board: Forum
389 label_board_new: New forum
390 label_board_plural: Forums
391 label_topic_plural: Topics
392 label_message_plural: Messages
393 label_message_last: Last message
394 label_message_new: New message
395 label_reply_plural: Replies
388
396
389 button_login: Login
397 button_login: Login
390 button_submit: Invia
398 button_submit: Invia
@@ -413,6 +421,7 button_log_time: Registra tempo
413 button_rollback: Ripristina questa versione
421 button_rollback: Ripristina questa versione
414 button_watch: Watch
422 button_watch: Watch
415 button_unwatch: Unwatch
423 button_unwatch: Unwatch
424 button_reply: Reply
416
425
417 status_active: attivo
426 status_active: attivo
418 status_registered: registrato
427 status_registered: registrato
@@ -386,6 +386,14 label_stay_logged_in: Stay logged in
386 label_disabled: disabled
386 label_disabled: disabled
387 label_show_completed_versions: Show completed versions
387 label_show_completed_versions: Show completed versions
388 label_me: me
388 label_me: me
389 label_board: Forum
390 label_board_new: New forum
391 label_board_plural: Forums
392 label_topic_plural: Topics
393 label_message_plural: Messages
394 label_message_last: Last message
395 label_message_new: New message
396 label_reply_plural: Replies
389
397
390 button_login: ログイン
398 button_login: ログイン
391 button_submit: 変更
399 button_submit: 変更
@@ -414,6 +422,7 button_log_time: 時間を記録
414 button_rollback: このバージョンにロールバック
422 button_rollback: このバージョンにロールバック
415 button_watch: Watch
423 button_watch: Watch
416 button_unwatch: Unwatch
424 button_unwatch: Unwatch
425 button_reply: Reply
417
426
418 status_active: 有効
427 status_active: 有効
419 status_registered: 登録
428 status_registered: 登録
@@ -385,6 +385,14 label_stay_logged_in: Stay logged in
385 label_disabled: disabled
385 label_disabled: disabled
386 label_show_completed_versions: Show completed versions
386 label_show_completed_versions: Show completed versions
387 label_me: me
387 label_me: me
388 label_board: Forum
389 label_board_new: New forum
390 label_board_plural: Forums
391 label_topic_plural: Topics
392 label_message_plural: Messages
393 label_message_last: Last message
394 label_message_new: New message
395 label_reply_plural: Replies
388
396
389 button_login: Login
397 button_login: Login
390 button_submit: Enviar
398 button_submit: Enviar
@@ -413,6 +421,7 button_log_time: Tempo de trabalho
413 button_rollback: Voltar para esta versao
421 button_rollback: Voltar para esta versao
414 button_watch: Watch
422 button_watch: Watch
415 button_unwatch: Unwatch
423 button_unwatch: Unwatch
424 button_reply: Reply
416
425
417 status_active: ativo
426 status_active: ativo
418 status_registered: registrado
427 status_registered: registrado
@@ -385,6 +385,14 label_stay_logged_in: Rester connecté
385 label_disabled: désactivé
385 label_disabled: désactivé
386 label_show_completed_versions: Voire les versions passées
386 label_show_completed_versions: Voire les versions passées
387 label_me: me
387 label_me: me
388 label_board: Forum
389 label_board_new: New forum
390 label_board_plural: Forums
391 label_topic_plural: Topics
392 label_message_plural: Messages
393 label_message_last: Last message
394 label_message_new: New message
395 label_reply_plural: Replies
388
396
389 button_login: Login
397 button_login: Login
390 button_submit: Enviar
398 button_submit: Enviar
@@ -413,6 +421,7 button_log_time: Tempo de trabalho
413 button_rollback: Voltar para esta versão
421 button_rollback: Voltar para esta versão
414 button_watch: Observar
422 button_watch: Observar
415 button_unwatch: Não observar
423 button_unwatch: Não observar
424 button_reply: Reply
416
425
417 status_active: ativo
426 status_active: ativo
418 status_registered: registrado
427 status_registered: registrado
@@ -388,6 +388,14 label_stay_logged_in: Stay logged in
388 label_disabled: disabled
388 label_disabled: disabled
389 label_show_completed_versions: Show completed versions
389 label_show_completed_versions: Show completed versions
390 label_me: me
390 label_me: me
391 label_board: Forum
392 label_board_new: New forum
393 label_board_plural: Forums
394 label_topic_plural: Topics
395 label_message_plural: Messages
396 label_message_last: Last message
397 label_message_new: New message
398 label_reply_plural: Replies
391
399
392 button_login: 登录
400 button_login: 登录
393 button_submit: 提交
401 button_submit: 提交
@@ -416,6 +424,7 button_log_time: 登记工时
416 button_rollback: Rollback to this version
424 button_rollback: Rollback to this version
417 button_watch: Watch
425 button_watch: Watch
418 button_unwatch: Unwatch
426 button_unwatch: Unwatch
427 button_reply: Reply
419
428
420 status_active: 激活
429 status_active: 激活
421 status_registered: 已注册
430 status_registered: 已注册
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -475,6 +475,8 position: relative;
475 margin: 0 5px 5px;
475 margin: 0 5px 5px;
476 }
476 }
477
477
478 div.attachments {padding-left: 6px; border-left: 2px solid #ccc;}
479
478 .overlay{
480 .overlay{
479 position: absolute;
481 position: absolute;
480 margin-left:0;
482 margin-left:0;
General Comments 0
You need to be logged in to leave comments. Login now