##// END OF EJS Templates
Prepend page title to anchor in single page wiki HTML export to make links more unique....
Prepend page title to anchor in single page wiki HTML export to make links more unique. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7562 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r6726:7be77e1d160e
r7442:8bb90f87fb73
Show More
board.rb
50 lines | 2.1 KiB | text/x-ruby | RubyLexer
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726 # Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
Jean-Philippe Lang
Per project forums added....
r526 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726 #
Jean-Philippe Lang
Per project forums added....
r526 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726 #
Jean-Philippe Lang
Per project forums added....
r526 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Board < ActiveRecord::Base
belongs_to :project
has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC"
Jean-Philippe Lang
Fixed: messages attachments/watchers are not deleted when deleting a project or forum (#6966)....
r4317 has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC"
Jean-Philippe Lang
Per project forums added....
r526 belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id
acts_as_list :scope => :project_id
Jean-Philippe Lang
Added watchers for message boards (watchers controller modified to support any watchable model)....
r527 acts_as_watchable
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726
Jean-Philippe Lang
Per project forums added....
r526 validates_presence_of :name, :description
validates_length_of :name, :maximum => 30
validates_length_of :description, :maximum => 255
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726
Jean-Philippe Lang
Makes user unwatch what he can no longer view after its permissions have changed (#3589)....
r3053 def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_messages, project)
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726
Jean-Philippe Lang
Adds single forum atom feed (#3181)....
r2590 def to_s
name
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726
Jean-Philippe Lang
Adds the ability to move threads between project forums (#2452). 'Edit message' permission is required....
r2560 def reset_counters!
self.class.reset_counters!(id)
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/board.rb....
r6726
Jean-Philippe Lang
Adds the ability to move threads between project forums (#2452). 'Edit message' permission is required....
r2560 # Updates topics_count, messages_count and last_message_id attributes for +board_id+
def self.reset_counters!(board_id)
board_id = board_id.to_i
update_all("topics_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=#{board_id} AND parent_id IS NULL)," +
" messages_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=#{board_id})," +
" last_message_id = (SELECT MAX(id) FROM #{Message.table_name} WHERE board_id=#{board_id})",
["id = ?", board_id])
end
Jean-Philippe Lang
Per project forums added....
r526 end