##// END OF EJS Templates
Removed unnecessary calculations in time entries index....
Removed unnecessary calculations in time entries index. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8085 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r5699:32cb715db913
r7965:10509933486a
Show More
news.rb
54 lines | 2.2 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
Adds email notifications support for news comments (#2074)....
r4883 # Copyright (C) 2006-2011 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
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
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
named_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
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
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)
find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
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