##// END OF EJS Templates
Added a sample plugin....
Jean-Philippe Lang -
r742:dbcf2065b86d
parent child
Show More
@@ -0,0 +1,24
1 == Sample plugin
2
3 This is a sample plugin for Redmine
4
5 == Installation
6
7 === Adding plugin support to Redmine
8
9 1. Install engines plugin
10 See: http://rails-engines.org/
11
12 2. Uncomment this line in config/environment.rb:
13 config.plugins = ["engines", "*"]
14
15 === Plugin installation
16
17 1. Copy the plugin directory into the vendor/plugins directory
18
19 2. Migrate plugin:
20 rake db:migrate_plugins
21
22 3. Start Redmine
23
24 Installed plugins are listed on 'Admin -> Information' screen.
@@ -0,0 +1,17
1 # Sample plugin controller
2 class ExampleController < ApplicationController
3 layout 'base'
4 before_filter :find_project, :authorize
5
6 def say_hello
7 @value = Setting.plugin_sample_plugin['sample_setting']
8 end
9
10 def say_goodbye
11 end
12
13 private
14 def find_project
15 @project=Project.find(params[:id])
16 end
17 end
@@ -0,0 +1,5
1 <p class="icon icon-example-works"><%= l(:text_say_goodbye) %></p>
2
3 <% content_for :header_tags do %>
4 <%= stylesheet_link_tag "example.css", :plugin => "sample_plugin", :media => "screen" %>
5 <% end %>
@@ -0,0 +1,9
1 <p class="icon icon-example-works"><%= l(:text_say_hello) %></p>
2
3 <p><label>Example setting</label>: <%= @value %></p>
4
5 <%= link_to_if_authorized 'Good bye', :action => 'say_goodbye', :id => @project %>
6
7 <% content_for :header_tags do %>
8 <%= stylesheet_link_tag "example.css", :plugin => "sample_plugin", :media => "screen" %>
9 <% end %>
@@ -0,0 +1,3
1 <p><label>Example setting</label><%= text_field_tag 'settings[sample_setting]', @settings['sample_setting'] %></p>
2
3 <p><label>Foo</label><%= text_field_tag 'settings[foo]', @settings['foo'] %></p>
1 NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,1
1 .icon-example-works { background-image: url(../images/it_works.png); }
@@ -0,0 +1,13
1 # Sample plugin migration
2 # Use rake db:migrate_plugins to migrate installed plugins
3 class CreateSomeModels < ActiveRecord::Migration
4 def self.up
5 create_table :example_plugin_model, :force => true do |t|
6 t.column "example_attribute", :integer
7 end
8 end
9
10 def self.down
11 drop_table :example_plugin_model
12 end
13 end
@@ -0,0 +1,25
1 # Redmine sample plugin
2 require 'redmine'
3
4 RAILS_DEFAULT_LOGGER.info 'Starting Example plugin for RedMine'
5
6 Redmine::Plugin.register :sample_plugin do
7 name 'Example plugin'
8 author 'Author name'
9 description 'This is a sample plugin for Redmine'
10 version '0.0.1'
11 settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'settings/settings'
12
13 # This plugin adds a project module
14 # It can be enabled/disabled at project level (Project settings -> Modules)
15 project_module :example_module do
16 # A public action
17 permission :example_say_hello, {:example => [:say_hello]}, :public => true
18 # This permission has to be explicitly given
19 # It will be listed on the permissions screen
20 permission :example_say_goodbye, {:example => [:say_goodbye]}
21 end
22
23 # A new item is added to the project menu
24 menu :project_menu, :label_plugin_example, :controller => 'example', :action => 'say_hello'
25 end
@@ -0,0 +1,4
1 # Sample plugin
2 label_plugin_example: Sample Plugin
3 text_say_hello: Plugin say 'Hello'
4 text_say_goodbye: Plugin say 'Good bye'
@@ -0,0 +1,4
1 # Sample plugin
2 label_plugin_example: Plugin exemple
3 text_say_hello: Plugin dit 'Bonjour'
4 text_say_goodbye: Plugin dit 'Au revoir'
General Comments 0
You need to be logged in to leave comments. Login now