diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-27 19:10:56 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-27 19:10:56 +0000 |
commit | 3a4855d070c6305a587afd31c9814cfdf479c66b (patch) | |
tree | d821fb3ae1d1d2fb5ed4aead6c98d2581943d2c3 /extra | |
parent | d05bcda2bad6bc54b1aaaf91c93ca9c6976c4b66 (diff) | |
download | redmine-3a4855d070c6305a587afd31c9814cfdf479c66b.tar.gz redmine-3a4855d070c6305a587afd31c9814cfdf479c66b.zip |
Activity provider example in sample plugin.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1703 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra')
-rw-r--r-- | extra/sample_plugin/app/models/meeting.rb | 6 | ||||
-rw-r--r-- | extra/sample_plugin/db/migrate/001_create_meetings.rb | 15 | ||||
-rw-r--r-- | extra/sample_plugin/db/migrate/001_create_some_models.rb | 13 | ||||
-rw-r--r-- | extra/sample_plugin/init.rb | 5 | ||||
-rw-r--r-- | extra/sample_plugin/lang/en.yml | 1 | ||||
-rw-r--r-- | extra/sample_plugin/lang/fr.yml | 1 |
6 files changed, 28 insertions, 13 deletions
diff --git a/extra/sample_plugin/app/models/meeting.rb b/extra/sample_plugin/app/models/meeting.rb new file mode 100644 index 000000000..89ecd5253 --- /dev/null +++ b/extra/sample_plugin/app/models/meeting.rb @@ -0,0 +1,6 @@ +class Meeting < ActiveRecord::Base + belongs_to :project + + acts_as_activity_provider :timestamp => 'scheduled_on', + :find_options => { :include => :project } +end diff --git a/extra/sample_plugin/db/migrate/001_create_meetings.rb b/extra/sample_plugin/db/migrate/001_create_meetings.rb new file mode 100644 index 000000000..fec9c8bd1 --- /dev/null +++ b/extra/sample_plugin/db/migrate/001_create_meetings.rb @@ -0,0 +1,15 @@ +# Sample plugin migration +# Use rake db:migrate_plugins to migrate installed plugins +class CreateMeetings < ActiveRecord::Migration + def self.up + create_table :meetings do |t| + t.column :project_id, :integer, :null => false + t.column :description, :string + t.column :scheduled_on, :datetime + end + end + + def self.down + drop_table :meetings + end +end diff --git a/extra/sample_plugin/db/migrate/001_create_some_models.rb b/extra/sample_plugin/db/migrate/001_create_some_models.rb deleted file mode 100644 index 39d58a649..000000000 --- a/extra/sample_plugin/db/migrate/001_create_some_models.rb +++ /dev/null @@ -1,13 +0,0 @@ -# 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 diff --git a/extra/sample_plugin/init.rb b/extra/sample_plugin/init.rb index 7389aaa6f..5c543338c 100644 --- a/extra/sample_plugin/init.rb +++ b/extra/sample_plugin/init.rb @@ -18,8 +18,13 @@ Redmine::Plugin.register :sample_plugin do # This permission has to be explicitly given # It will be listed on the permissions screen 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 # A new item is added to the project menu menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample' + + # Meetings are added to the activity view + activity_provider :meetings end diff --git a/extra/sample_plugin/lang/en.yml b/extra/sample_plugin/lang/en.yml index bf62bc344..c4005a764 100644 --- a/extra/sample_plugin/lang/en.yml +++ b/extra/sample_plugin/lang/en.yml @@ -1,4 +1,5 @@ # Sample plugin label_plugin_example: Sample Plugin +label_meeting_plural: Meetings text_say_hello: Plugin say 'Hello' text_say_goodbye: Plugin say 'Good bye' diff --git a/extra/sample_plugin/lang/fr.yml b/extra/sample_plugin/lang/fr.yml index 2c0829c32..135050a5a 100644 --- a/extra/sample_plugin/lang/fr.yml +++ b/extra/sample_plugin/lang/fr.yml @@ -1,4 +1,5 @@ # Sample plugin label_plugin_example: Plugin exemple +label_meeting_plural: Meetings text_say_hello: Plugin dit 'Bonjour' text_say_goodbye: Plugin dit 'Au revoir' |