##// END OF EJS Templates
Activity provider example in sample plugin....
Jean-Philippe Lang -
r1694:3a4855d070c6
parent child
Show More
@@ -0,0 +1,6
1 class Meeting < ActiveRecord::Base
2 belongs_to :project
3
4 acts_as_activity_provider :timestamp => 'scheduled_on',
5 :find_options => { :include => :project }
6 end
@@ -1,13 +1,15
1 1 # Sample plugin migration
2 2 # Use rake db:migrate_plugins to migrate installed plugins
3 class CreateSomeModels < ActiveRecord::Migration
3 class CreateMeetings < ActiveRecord::Migration
4 4 def self.up
5 create_table :example_plugin_model, :force => true do |t|
6 t.column "example_attribute", :integer
5 create_table :meetings do |t|
6 t.column :project_id, :integer, :null => false
7 t.column :description, :string
8 t.column :scheduled_on, :datetime
7 9 end
8 10 end
9 11
10 12 def self.down
11 drop_table :example_plugin_model
13 drop_table :meetings
12 14 end
13 15 end
@@ -1,25 +1,30
1 1 # Redmine sample plugin
2 2 require 'redmine'
3 3
4 4 RAILS_DEFAULT_LOGGER.info 'Starting Example plugin for RedMine'
5 5
6 6 Redmine::Plugin.register :sample_plugin do
7 7 name 'Example plugin'
8 8 author 'Author name'
9 9 description 'This is a sample plugin for Redmine'
10 10 version '0.0.1'
11 11 settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'settings/settings'
12 12
13 13 # This plugin adds a project module
14 14 # It can be enabled/disabled at project level (Project settings -> Modules)
15 15 project_module :example_module do
16 16 # A public action
17 17 permission :example_say_hello, {:example => [:say_hello]}, :public => true
18 18 # This permission has to be explicitly given
19 19 # It will be listed on the permissions screen
20 20 permission :example_say_goodbye, {:example => [:say_goodbye]}
21 # This permission can be given to project members only
22 permission :view_meetings, {:meetings => [:index, :show]}, :require => :member
21 23 end
22 24
23 25 # A new item is added to the project menu
24 26 menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample'
27
28 # Meetings are added to the activity view
29 activity_provider :meetings
25 30 end
@@ -1,4 +1,5
1 1 # Sample plugin
2 2 label_plugin_example: Sample Plugin
3 label_meeting_plural: Meetings
3 4 text_say_hello: Plugin say 'Hello'
4 5 text_say_goodbye: Plugin say 'Good bye'
@@ -1,4 +1,5
1 1 # Sample plugin
2 2 label_plugin_example: Plugin exemple
3 label_meeting_plural: Meetings
3 4 text_say_hello: Plugin dit 'Bonjour'
4 5 text_say_goodbye: Plugin dit 'Au revoir'
General Comments 0
You need to be logged in to leave comments. Login now