view vendor/plugins/redmine_bibliography/init.rb @ 614:712324fee0c0 feature_36

Started working on Feature #241.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 23 Aug 2011 15:47:15 +0100
parents 2df99e8d191e
children e2663e0bd5a6
line wrap: on
line source
require 'redmine'
require 'dispatcher'

RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine'

# Patches to the Redmine core.
Dispatcher.to_prepare :redmine_model_dependencies do
  require_dependency 'project'
  require_dependency 'user'

  unless Project.included_modules.include? Bibliography::ProjectPublicationsPatch
    Project.send(:include, Bibliography::ProjectPublicationsPatch)
  end

  unless User.included_modules.include? Bibliography::UserAuthorPatch
    User.send(:include, Bibliography::UserAuthorPatch)
  end

end


# Plugin Info
Redmine::Plugin.register :redmine_bibliography do
  name 'Redmine Bibliography plugin'
  author 'Chris Cannam, Luis Figueira'
  description 'This is a bibliography management plugin for Redmine'
  version '0.0.1'
  url 'http://example.com/path/to/plugin'
  author_url 'http://example.com/about'

  settings :default => { 'menu' => 'Bibliography' }, :partial => 'settings/bibliography'

  project_module :redmine_bibliography do
    permission :publications, { :publications => :index }
    permission :edit_publication, {:redmine_bibliography => [:edit, :update]}
    permission :add_publication, {:redmine_bibliography => [:new, :create]}
  end

  # extending the Project Menu
  menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :param => :project_id, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] },
   :if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? }
    
end