To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / vendor / plugins / redmine_bibliography / init.rb @ 715:3c1257f96b79
History | View | Annotate | Download (1.73 KB)
| 1 |
require 'redmine'
|
|---|---|
| 2 |
require 'dispatcher'
|
| 3 |
|
| 4 |
RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine' |
| 5 |
|
| 6 |
# Patches to the Redmine core.
|
| 7 |
Dispatcher.to_prepare :redmine_model_dependencies do |
| 8 |
require_dependency 'project'
|
| 9 |
require_dependency 'user'
|
| 10 |
require_dependency 'mailer'
|
| 11 |
|
| 12 |
unless Project.included_modules.include? Bibliography::ProjectPublicationsPatch |
| 13 |
Project.send(:include, Bibliography::ProjectPublicationsPatch) |
| 14 |
end
|
| 15 |
|
| 16 |
unless User.included_modules.include? Bibliography::UserAuthorPatch |
| 17 |
User.send(:include, Bibliography::UserAuthorPatch) |
| 18 |
end
|
| 19 |
|
| 20 |
unless Mailer.included_modules.include? Bibliography::MailerPatch |
| 21 |
Mailer.send(:include, Bibliography::MailerPatch) |
| 22 |
end
|
| 23 |
|
| 24 |
|
| 25 |
end
|
| 26 |
|
| 27 |
|
| 28 |
# Plugin Info
|
| 29 |
Redmine::Plugin.register :redmine_bibliography do |
| 30 |
name 'Redmine Bibliography plugin'
|
| 31 |
author 'Chris Cannam, Luis Figueira'
|
| 32 |
description 'This is a bibliography management plugin for Redmine'
|
| 33 |
version '0.0.1'
|
| 34 |
url 'http://example.com/path/to/plugin'
|
| 35 |
author_url 'http://example.com/about'
|
| 36 |
|
| 37 |
settings :default => { 'menu' => 'Bibliography' }, :partial => 'settings/bibliography' |
| 38 |
|
| 39 |
project_module :redmine_bibliography do |
| 40 |
permission :publications, { :publications => :index }, :public => true |
| 41 |
permission :edit_publication, {:publications => [:edit, :update]} |
| 42 |
permission :add_publication, {:publications => [:new, :create]} |
| 43 |
permission :delete_publication, {:publications => :destroy} |
| 44 |
|
| 45 |
end
|
| 46 |
|
| 47 |
# extending the Project Menu
|
| 48 |
menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :param => :project_id, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] }, |
| 49 |
:if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? } |
| 50 |
|
| 51 |
end
|