comparison app/models/.svn/text-base/news.rb.svn-base @ 117:af80e5618e9b redmine-1.1

* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author Chris Cannam
date Thu, 13 Jan 2011 12:53:21 +0000
parents 513646585e45
children cbce1fd3b1b7
comparison
equal deleted inserted replaced
39:150ceac17a8d 117:af80e5618e9b
27 acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project 27 acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project
28 acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id}} 28 acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id}}
29 acts_as_activity_provider :find_options => {:include => [:project, :author]}, 29 acts_as_activity_provider :find_options => {:include => [:project, :author]},
30 :author_key => :author_id 30 :author_key => :author_id
31 31
32 named_scope :visible, lambda {|*args| {
33 :include => :project,
34 :conditions => Project.allowed_to_condition(args.first || User.current, :view_news)
35 }}
36
32 def visible?(user=User.current) 37 def visible?(user=User.current)
33 !user.nil? && user.allowed_to?(:view_news, project) 38 !user.nil? && user.allowed_to?(:view_news, project)
34 end 39 end
35 40
36 # returns latest news for projects visible by user 41 # returns latest news for projects visible by user