Redmine本体に手を入れないビューカスタマイズ法あれこれ (Mitaka.rb #8)

9,143 views
9,017 views

Published on

0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,143
On SlideShare
0
From Embeds
0
Number of Embeds
1,006
Actions
Shares
0
Downloads
0
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Redmine本体に手を入れないビューカスタマイズ法あれこれ (Mitaka.rb #8)

  1. 1. Redmine 2010 4 29 1
  2. 2. Hatena id:suer Twitter @suer Redmine Plugin: MSP Importer ( ...) : 24 ocaml-nagoya -[ ]- 2010 4 29 2
  3. 3. Redmine Rails Web feed wiki SCM -[ ]- 2010 4 29 3
  4. 4. -[ ]- 2010 4 29 4
  5. 5. -[ ]- 2010 4 29 5
  6. 6. TiDD ! ! -[ ]- 2010 4 29 6
  7. 7. -[ ]- 2010 4 29 7
  8. 8. Coder -[ ]- 2010 4 29 8
  9. 9. Rails -[ ]- 2010 4 29 9
  10. 10. Redmine0.9 -[ ]- 2010 4 29 10
  11. 11. Redmine1.0(7 ) http://www.redmine.org/news/36 -[ ]- 2010 4 29 11
  12. 12. ... -[ ]- 2010 4 29 12
  13. 13. conflict (^o^) -[ ]- 2010 4 29 13
  14. 14. -[ ]- 2010 4 29 14
  15. 15. Redmine rhtml ViewHook -[ ]- 2010 4 29 15
  16. 16. ViewHook ↓ http://d.hatena.ne.jp/suer/20100119/redmine_view_ext -[ ]- 2010 4 29 16
  17. 17. ViewHook View call_hook HTML Lisnter ( ) app/views/users/show.rhtml <%= call_hook :view_account_left_bottom, :user => @user %> <%= call_hook :view_account_right_bottom, :user => @user %> -[ ]- 2010 4 29 17
  18. 18. Hook :view ViewHook $ rake redmine:plugins:hook_list ( ) app/views/users/show.rhtml: * [ 32] :view_account_left_bottom, :user => @user * [ 67] :view_account_right_bottom, :user => @user ( ) -[ ]- 2010 4 29 18
  19. 19. -[ ]- 2010 4 29 19
  20. 20. $ ruby script/generate redmine_plugin AccountTichets create vendor/plugins/redmine_account_tichets/app/controllers create vendor/plugins/redmine_account_tichets/app/helpers create vendor/plugins/redmine_account_tichets/app/models create vendor/plugins/redmine_account_tichets/app/views create vendor/plugins/redmine_account_tichets/db/migrate create vendor/plugins/redmine_account_tichets/lib/tasks create vendor/plugins/redmine_account_tichets/assets/images create vendor/plugins/redmine_account_tichets/assets/javascripts create vendor/plugins/redmine_account_tichets/assets/stylesheets create vendor/plugins/redmine_account_tichets/lang create vendor/plugins/redmine_account_tichets/config/locales create vendor/plugins/redmine_account_tichets/test create vendor/plugins/redmine_account_tichets/README.rdoc create vendor/plugins/redmine_account_tichets/init.rb create vendor/plugins/redmine_account_tichets/lang/en.yml create vendor/plugins/redmine_account_tichets/config/locales/en.yml create vendor/plugins/redmine_account_tichets/test/test_helper.rb -[ ]- 2010 4 29 20
  21. 21. ViewListener vender/plugins/redmine_account_tichets/lib/account_listener.rb class AccountListener < Redmine::Hook::ViewListener def view_account_left_bottom(context) :view_account_left_bottom user = context[:user] assigned_issues = Issue.visible.open.find(:all, :conditions => {:assigned_to_id => User.current.id}) reported_issues = Issue.visible.find(:all, :conditions => {:author_id => User.current.id }) html = '' html << '<h3>Tickets</h3><ul>' html << '<li>assigned: ' + assigned_issues.size.to_s + ' Tickets</li>' html << '<li>reported: ' + reported_issues.size.to_s + ' Tickets</li>' html << '</ul>' html end end -[ ]- 2010 4 29 21
  22. 22. ViewListener vender/plugins/redmine_account_tichets/init.rb require 'redmine' require 'account_listener' # Redmine::Plugin.register :redmine_account_tichets do name 'Redmine Account Tichets plugin' author 'Author name' description 'This is a plugin for Redmine' version '0.0.1' end -[ ]- 2010 4 29 22
  23. 23. -[ ]- 2010 4 29 23
  24. 24. Redmine::Hook::Listener class Listener include Singleton include Redmine::I18n # Registers the listener def self.inherited(child) Redmine::Hook.add_listener(child) super end end -[ ]- 2010 4 29 24
  25. 25. inherited ^o^ -[ ]- 2010 4 29 25
  26. 26. -[ ]- 2010 4 29 26

×