Mercurial > hg > soundsoftware-site
changeset 1087:74407a04925c issue_540
* (publication.rb) - fixed the acts_as_activity query (see diff to previous commit) - not returning duplicate results any longer; added the visible scope to the publication model;
* (init.rb) - created a new public permission - view_publication.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 23 Nov 2012 17:25:27 +0000 |
parents | 5bd8c86cfa6a |
children | a9311b2d850f |
files | vendor/plugins/redmine_bibliography/app/models/publication.rb vendor/plugins/redmine_bibliography/init.rb |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Thu Nov 22 16:51:23 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Nov 23 17:25:27 2012 +0000 @@ -19,19 +19,23 @@ before_save :set_initial_author_order + named_scope :visible, lambda {|*args| { :include => :projects, + :conditions => Project.allowed_to_condition(args.shift || User.current, :view_publication, *args) } } + acts_as_activity_provider :type => 'publication', :timestamp => "#{Publication.table_name}.created_at", - :author_key => "#{Publication.table_name}.builder_id", - :find_options => {:joins => "INNER JOIN projects_publications ON #{Publication.table_name}.id = projects_publications.publication_id JOIN #{Project.table_name} ON #{Project.table_name}.id = projects_publications.project_id"} + :find_options => { + :include => :projects, + :conditions => "#{Project.table_name}.id = projects_publications.project_id" + } acts_as_event :title => Proc.new {|o| o.title }, :datetime => :created_at, - :author => nil, :type => 'publications', + :author => nil, #todo - need too move the cache from the helper to the model :description => Proc.new {|o| o.print_entry(:ieee)}, - :project => Project.first - # :url => Proc.new {|o| {:controller => 'publications', :action => 'show', :id => o.id }} + :url => Proc.new {|o| {:controller => 'publications', :action => 'show', :id => o.id }} # Ensure error message uses proper text instead of
--- a/vendor/plugins/redmine_bibliography/init.rb Thu Nov 22 16:51:23 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/init.rb Fri Nov 23 17:25:27 2012 +0000 @@ -40,11 +40,13 @@ settings :default => { 'menu' => 'Publications' }, :partial => 'settings/bibliography' project_module :redmine_bibliography do + permission :view_publication, {:publications => :show}, :public => :true permission :publications, { :publications => :index }, :public => true permission :edit_publication, {:publications => [:edit, :update]} permission :add_publication, {:publications => [:new, :create]} permission :delete_publication, {:publications => :destroy} + end # extending the Project Menu