To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / plugins / redmine_bibliography / init.rb @ 1420:b688fe79f593
History | View | Annotate | Download (2.11 KB)
| 1 |
require 'redmine'
|
|---|---|
| 2 |
|
| 3 |
require 'bibtex'
|
| 4 |
require 'citeproc'
|
| 5 |
|
| 6 |
# Patches to the Redmine core.
|
| 7 |
ActionDispatch::Callbacks.to_prepare 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 |
unless ProjectsHelper.included_modules.include?(Bibliography::ProjectsHelperPatch) |
| 25 |
ProjectsHelper.send(:include, Bibliography::ProjectsHelperPatch) |
| 26 |
end
|
| 27 |
|
| 28 |
unless MyHelper.included_modules.include?(Bibliography::MyHelperPatch) |
| 29 |
MyHelper.send(:include, Bibliography::MyHelperPatch) |
| 30 |
end
|
| 31 |
end
|
| 32 |
|
| 33 |
|
| 34 |
# Plugin Info
|
| 35 |
Redmine::Plugin.register :redmine_bibliography do |
| 36 |
name 'Redmine Bibliography plugin'
|
| 37 |
author 'Chris Cannam, Luis Figueira'
|
| 38 |
description 'This is a bibliography management plugin for Redmine'
|
| 39 |
version '0.0.1'
|
| 40 |
url 'http://example.com/path/to/plugin'
|
| 41 |
author_url 'http://example.com/about'
|
| 42 |
|
| 43 |
settings :default => { 'menu' => 'Publications' }, :partial => 'settings/bibliography' |
| 44 |
|
| 45 |
project_module :redmine_bibliography do |
| 46 |
permission :view_publication, {:publications => :show}, :public => :true |
| 47 |
permission :publications, { :publications => :index }, :public => true |
| 48 |
permission :edit_publication, {:publications => [:edit, :update]} |
| 49 |
permission :add_publication, {:publications => [:new, :create]} |
| 50 |
permission :delete_publication, {:publications => :destroy} |
| 51 |
|
| 52 |
|
| 53 |
end
|
| 54 |
|
| 55 |
# extending the Project Menu
|
| 56 |
menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :param => :project_id, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] }, |
| 57 |
:if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? } |
| 58 |
|
| 59 |
activity_provider :publication, :class_name => 'Publication', :default => true |
| 60 |
|
| 61 |
end
|
| 62 |
|
| 63 |
|
| 64 |
|