--- /dev/null
+== Sample plugin
+
+This is a sample plugin for Redmine
+
+== Installation
+
+=== Adding plugin support to Redmine
+
+1. Install engines plugin
+ See: http://rails-engines.org/
+
+2. Uncomment this line in config/environment.rb:
+ config.plugins = ["engines", "*"]
+
+=== Plugin installation
+
+1. Copy the plugin directory into the vendor/plugins directory
+
+2. Migrate plugin:
+ rake db:migrate_plugins
+
+3. Start Redmine
+
+Installed plugins are listed on 'Admin -> Information' screen.
--- /dev/null
+# Sample plugin controller
+class ExampleController < ApplicationController
+ layout 'base'
+ before_filter :find_project, :authorize
+
+ def say_hello
+ @value = Setting.plugin_sample_plugin['sample_setting']
+ end
+
+ def say_goodbye
+ end
+
+private
+ def find_project
+ @project=Project.find(params[:id])
+ end
+end
--- /dev/null
+<p class="icon icon-example-works"><%= l(:text_say_goodbye) %></p>
+
+<% content_for :header_tags do %>
+ <%= stylesheet_link_tag "example.css", :plugin => "sample_plugin", :media => "screen" %>
+<% end %>
--- /dev/null
+<p class="icon icon-example-works"><%= l(:text_say_hello) %></p>
+
+<p><label>Example setting</label>: <%= @value %></p>
+
+<%= link_to_if_authorized 'Good bye', :action => 'say_goodbye', :id => @project %>
+
+<% content_for :header_tags do %>
+ <%= stylesheet_link_tag "example.css", :plugin => "sample_plugin", :media => "screen" %>
+<% end %>
--- /dev/null
+<p><label>Example setting</label><%= text_field_tag 'settings[sample_setting]', @settings['sample_setting'] %></p>
+
+<p><label>Foo</label><%= text_field_tag 'settings[foo]', @settings['foo'] %></p>
--- /dev/null
+.icon-example-works { background-image: url(../images/it_works.png); }
--- /dev/null
+# Sample plugin migration
+# Use rake db:migrate_plugins to migrate installed plugins
+class CreateSomeModels < ActiveRecord::Migration
+ def self.up
+ create_table :example_plugin_model, :force => true do |t|
+ t.column "example_attribute", :integer
+ end
+ end
+
+ def self.down
+ drop_table :example_plugin_model
+ end
+end
--- /dev/null
+# Redmine sample plugin
+require 'redmine'
+
+RAILS_DEFAULT_LOGGER.info 'Starting Example plugin for RedMine'
+
+Redmine::Plugin.register :sample_plugin do
+ name 'Example plugin'
+ author 'Author name'
+ description 'This is a sample plugin for Redmine'
+ version '0.0.1'
+ settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'settings/settings'
+
+ # This plugin adds a project module
+ # It can be enabled/disabled at project level (Project settings -> Modules)
+ project_module :example_module do
+ # A public action
+ permission :example_say_hello, {:example => [:say_hello]}, :public => true
+ # This permission has to be explicitly given
+ # It will be listed on the permissions screen
+ permission :example_say_goodbye, {:example => [:say_goodbye]}
+ end
+
+ # A new item is added to the project menu
+ menu :project_menu, :label_plugin_example, :controller => 'example', :action => 'say_hello'
+end
--- /dev/null
+# Sample plugin
+label_plugin_example: Sample Plugin
+text_say_hello: Plugin say 'Hello'
+text_say_goodbye: Plugin say 'Good bye'
--- /dev/null
+# Sample plugin
+label_plugin_example: Plugin exemple
+text_say_hello: Plugin dit 'Bonjour'
+text_say_goodbye: Plugin dit 'Au revoir'