##// END OF EJS Templates
Fixed: Issues associated with a locked version are not copied when copying a project (#11207)....
Fixed: Issues associated with a locked version are not copied when copying a project (#11207). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10334 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9453:ba5a052c8ca8
r10151:ff86c37ed330
Show More
news.rb
63 lines | 2.4 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Fixed: Latest news appear on the homepage for projects with the News module disabled (#1941)....
r1908 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r9453 # Copyright (C) 2006-2012 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# 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 news model source....
r5699 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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 news model source....
r5699 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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 News < ActiveRecord::Base
Jean-Philippe Lang
Prevent mass-assignment when adding/updating a news (#10390)....
r9014 include Redmine::SafeAttributes
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 belongs_to :project
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 validates_presence_of :title, :description
Jean-Philippe Lang
Added several validates_length_of...
r590 validates_length_of :title, :maximum => 60
validates_length_of :summary, :maximum => 255
Jean-Philippe Lang
Merged 0.6 branch into trunk....
r663
Jean-Philippe Lang
Allows attachments on news (#1972)....
r8608 acts_as_attachable :delete_permission => :manage_news
Jean-Philippe Lang
Fixed: News summary field is not searchable (#2998)....
r2552 acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project
Jean-Philippe Lang
Merged 0.6 branch into trunk....
r663 acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id}}
Jean-Philippe Lang
Display latest user's activity on account/show view....
r2064 acts_as_activity_provider :find_options => {:include => [:project, :author]},
:author_key => :author_id
Jean-Philippe Lang
Adds email notifications support for news comments (#2074)....
r4883 acts_as_watchable
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699
Jean-Philippe Lang
Adds email notifications support for news comments (#2074)....
r4883 after_create :add_author_as_watcher
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699
Toshi MARUYAMA
model: replace Rails2 "named_scope" to Rails3 "scope"...
r9355 scope :visible, lambda {|*args| {
Jean-Philippe Lang
Refactor and add tests for News #index API (#7072)....
r4391 :include => :project,
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699 :conditions => Project.allowed_to_condition(args.shift || User.current, :view_news, *args)
Jean-Philippe Lang
Refactor and add tests for News #index API (#7072)....
r4391 }}
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699
Jean-Philippe Lang
Prevent mass-assignment when adding/updating a news (#10390)....
r9014 safe_attributes 'title', 'summary', 'description'
Jean-Philippe Lang
Make sure users don't get notified for thing they can not view (#3589)....
r3055 def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_news, project)
end
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699
Jean-Philippe Lang
Adds a News#commentable? method to easily specific additional rules....
r8734 # Returns true if the news can be commented by user
def commentable?(user=User.current)
user.allowed_to?(:comment_news, project)
end
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # returns latest news for projects visible by user
Jean-Philippe Lang
Fixed: Latest news appear on the homepage for projects with the News module disabled (#1941)....
r1908 def self.latest(user = User.current, count = 5)
Jean-Philippe Lang
Code cleanup, reuse the visible scope....
r9450 visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all
Jean-Philippe Lang
Localization plugin removed (replaced with GLoc)...
r12 end
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699
Jean-Philippe Lang
Adds email notifications support for news comments (#2074)....
r4883 private
Toshi MARUYAMA
remove trailing white-spaces from news model source....
r5699
Jean-Philippe Lang
Adds email notifications support for news comments (#2074)....
r4883 def add_author_as_watcher
Watcher.create(:watchable => self, :user => author)
end
Jean-Philippe Lang
Initial commit...
r2 end