##// 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 # Sample plugin migration
1 # Sample plugin migration
2 # Use rake db:migrate_plugins to migrate installed plugins
2 # Use rake db:migrate_plugins to migrate installed plugins
3 class CreateSomeModels < ActiveRecord::Migration
3 class CreateMeetings < ActiveRecord::Migration
4 def self.up
4 def self.up
5 create_table :example_plugin_model, :force => true do |t|
5 create_table :meetings do |t|
6 t.column "example_attribute", :integer
6 t.column :project_id, :integer, :null => false
7 t.column :description, :string
8 t.column :scheduled_on, :datetime
7 end
9 end
8 end
10 end
9
11
10 def self.down
12 def self.down
11 drop_table :example_plugin_model
13 drop_table :meetings
12 end
14 end
13 end
15 end
@@ -18,8 +18,13 Redmine::Plugin.register :sample_plugin do
18 # This permission has to be explicitly given
18 # This permission has to be explicitly given
19 # It will be listed on the permissions screen
19 # It will be listed on the permissions screen
20 permission :example_say_goodbye, {:example => [:say_goodbye]}
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 end
23 end
22
24
23 # A new item is added to the project menu
25 # A new item is added to the project menu
24 menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample'
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 end
30 end
@@ -1,4 +1,5
1 # Sample plugin
1 # Sample plugin
2 label_plugin_example: Sample Plugin
2 label_plugin_example: Sample Plugin
3 label_meeting_plural: Meetings
3 text_say_hello: Plugin say 'Hello'
4 text_say_hello: Plugin say 'Hello'
4 text_say_goodbye: Plugin say 'Good bye'
5 text_say_goodbye: Plugin say 'Good bye'
@@ -1,4 +1,5
1 # Sample plugin
1 # Sample plugin
2 label_plugin_example: Plugin exemple
2 label_plugin_example: Plugin exemple
3 label_meeting_plural: Meetings
3 text_say_hello: Plugin dit 'Bonjour'
4 text_say_hello: Plugin dit 'Bonjour'
4 text_say_goodbye: Plugin dit 'Au revoir'
5 text_say_goodbye: Plugin dit 'Au revoir'
General Comments 0
You need to be logged in to leave comments. Login now