To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / extra / sample_plugin / init.rb @ 1561:6074fffd8a1d
History | View | Annotate | Download (1.11 KB)
| 1 |
Rails.logger.info 'Starting Example plugin for RedMine' |
|---|---|
| 2 |
|
| 3 |
Redmine::Plugin.register :sample_plugin do |
| 4 |
name 'Example plugin'
|
| 5 |
author 'Author name'
|
| 6 |
description 'This is a sample plugin for Redmine'
|
| 7 |
version '0.0.1'
|
| 8 |
settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'settings/sample_plugin_settings' |
| 9 |
|
| 10 |
# This plugin adds a project module
|
| 11 |
# It can be enabled/disabled at project level (Project settings -> Modules)
|
| 12 |
project_module :example_module do |
| 13 |
# A public action
|
| 14 |
permission :example_say_hello, {:example => [:say_hello]}, :public => true |
| 15 |
# This permission has to be explicitly given
|
| 16 |
# It will be listed on the permissions screen
|
| 17 |
permission :example_say_goodbye, {:example => [:say_goodbye]} |
| 18 |
# This permission can be given to project members only
|
| 19 |
permission :view_meetings, {:meetings => [:index, :show]}, :require => :member |
| 20 |
end
|
| 21 |
|
| 22 |
# A new item is added to the project menu
|
| 23 |
menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample' |
| 24 |
|
| 25 |
# Meetings are added to the activity view
|
| 26 |
activity_provider :meetings
|
| 27 |
end
|