# HG changeset patch # User luisf # Date 1307979977 -3600 # Node ID 2f1a308c4c119bd16f9b7560b72ebe7113730e83 # Parent 2daa350e1da267a4774a566f0bb792c0cf926f3a Created the Projects - Publications relationship. diff -r 2daa350e1da2 -r 2f1a308c4c11 vendor/plugins/redmine_bibliography/app/models/publication.rb --- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Jun 13 16:12:55 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Jun 13 16:46:17 2011 +0100 @@ -12,7 +12,9 @@ accepts_nested_attributes_for :authorships accepts_nested_attributes_for :authors, :allow_destroy => true - accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true + accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true + + has_and_belongs_to_many :projects attr_writer :current_step diff -r 2daa350e1da2 -r 2f1a308c4c11 vendor/plugins/redmine_bibliography/init.rb --- a/vendor/plugins/redmine_bibliography/init.rb Mon Jun 13 16:12:55 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/init.rb Mon Jun 13 16:46:17 2011 +0100 @@ -1,4 +1,16 @@ require 'redmine' +require 'dispatcher' + + +# Patches to the Redmine core. + +Dispatcher.to_prepare :redmine_model_dependencies do + require_dependency 'project' + + unless Project.included_modules.include? Bibliography::ProjectPublicationsPatch + Project.send(:include, Bibliography::ProjectPublicationsPatch) + end +end Redmine::Plugin.register :redmine_bibliography do name 'Redmine Bibliography plugin' @@ -11,6 +23,12 @@ permission :view_bibliography, :redmine_bibliography => :index menu :project_menu, :redmine_bibliography, {:controller => 'publications', :action => 'index'}, :caption => 'Bibliography', :after => :activity, :param => :project_id - + + + + + + end + diff -r 2daa350e1da2 -r 2f1a308c4c11 vendor/plugins/redmine_bibliography/lib/bibliography/project_publications_patch.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/project_publications_patch.rb Mon Jun 13 16:46:17 2011 +0100 @@ -0,0 +1,11 @@ +require_dependency 'project' + +module Bibliography + module ProjectPublicationsPatch + def self.included(base) + base.class_eval do + has_and_belongs_to_many :publications + end + end + end #ProjectPublicationsPatch +end #RedmineBibliography \ No newline at end of file