Commit 3a4855d0 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Activity provider example in sample plugin.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1703 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent d05bcda2
class Meeting < ActiveRecord::Base
belongs_to :project
acts_as_activity_provider :timestamp => 'scheduled_on',
:find_options => { :include => :project }
end
# Sample plugin migration # Sample plugin migration
# Use rake db:migrate_plugins to migrate installed plugins # Use rake db:migrate_plugins to migrate installed plugins
class CreateSomeModels < ActiveRecord::Migration class CreateMeetings < ActiveRecord::Migration
def self.up def self.up
create_table :example_plugin_model, :force => true do |t| create_table :meetings do |t|
t.column "example_attribute", :integer t.column :project_id, :integer, :null => false
t.column :description, :string
t.column :scheduled_on, :datetime
end end
end end
def self.down def self.down
drop_table :example_plugin_model drop_table :meetings
end end
end end
...@@ -18,8 +18,13 @@ Redmine::Plugin.register :sample_plugin do ...@@ -18,8 +18,13 @@ Redmine::Plugin.register :sample_plugin do
# This permission has to be explicitly given # This permission has to be explicitly given
# It will be listed on the permissions screen # It will be listed on the permissions screen
permission :example_say_goodbye, {:example => [:say_goodbye]} permission :example_say_goodbye, {:example => [:say_goodbye]}
# This permission can be given to project members only
permission :view_meetings, {:meetings => [:index, :show]}, :require => :member
end end
# A new item is added to the project menu # A new item is added to the project menu
menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample' menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample'
# Meetings are added to the activity view
activity_provider :meetings
end end
# Sample plugin # Sample plugin
label_plugin_example: Sample Plugin label_plugin_example: Sample Plugin
label_meeting_plural: Meetings
text_say_hello: Plugin say 'Hello' text_say_hello: Plugin say 'Hello'
text_say_goodbye: Plugin say 'Good bye' text_say_goodbye: Plugin say 'Good bye'
# Sample plugin # Sample plugin
label_plugin_example: Plugin exemple label_plugin_example: Plugin exemple
label_meeting_plural: Meetings
text_say_hello: Plugin dit 'Bonjour' text_say_hello: Plugin dit 'Bonjour'
text_say_goodbye: Plugin dit 'Au revoir' text_say_goodbye: Plugin dit 'Au revoir'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment