| 1 |
1 |
require 'redmine'
|
| 2 |
2 |
require 'dispatcher'
|
| 3 |
3 |
|
|
4 |
RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine'
|
| 4 |
5 |
|
| 5 |
6 |
# Patches to the Redmine core.
|
| 6 |
|
|
| 7 |
7 |
Dispatcher.to_prepare :redmine_model_dependencies do
|
| 8 |
8 |
require_dependency 'project'
|
| 9 |
9 |
|
| ... | ... | |
| 12 |
12 |
end
|
| 13 |
13 |
end
|
| 14 |
14 |
|
|
15 |
|
|
16 |
# Plugin Info
|
| 15 |
17 |
Redmine::Plugin.register :redmine_bibliography do
|
| 16 |
18 |
name 'Redmine Bibliography plugin'
|
| 17 |
19 |
author 'Chris Cannam, Luis Figueira'
|
| 18 |
|
description 'This is a plugin for Redmine'
|
|
20 |
description 'This is a bibliography management plugin for Redmine'
|
| 19 |
21 |
version '0.0.1'
|
| 20 |
22 |
url 'http://example.com/path/to/plugin'
|
| 21 |
23 |
author_url 'http://example.com/about'
|
| 22 |
|
|
| 23 |
|
permission :view_bibliography, :redmine_bibliography => :index
|
| 24 |
24 |
|
| 25 |
|
menu :project_menu, :redmine_bibliography, {:controller => 'publications', :action => 'index'}, :caption => 'Bibliography', :after => :activity, :param => :project_id
|
|
25 |
settings :default => { 'menu' => 'Bibliography' }, :partial => 'settings/bibliography'
|
| 26 |
26 |
|
|
27 |
project_module :redmine_bibliography do
|
|
28 |
permission :publications, { :publications => :index }, :public => true
|
|
29 |
permission :edit_redmine_bibliography, {:redmine_bibliography => [:index, :edit]}
|
|
30 |
end
|
| 27 |
31 |
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
end
|
| 33 |
|
|
| 34 |
|
|
|
32 |
# extending the Project Menu
|
|
33 |
menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] },
|
|
34 |
:if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? }
|
|
35 |
|
|
36 |
end
|