際際滷

際際滷Share a Scribd company logo
Redmine




2010   4   29             1
Hatena id:suer
           Twitter @suer

           Redmine Plugin: MSP Importer (   ...)
                   :
                                                     24

                                            ocaml-nagoya




   -[ ]-
2010   4    29                                             2
Redmine
                                Rails


                                Web

                  feed   wiki



       SCM

   -[ ]-
2010   4   29                           3
-[ ]-
2010   4   29   4
-[ ]-
2010   4   29   5
TiDD   !
                           !

   -[ ]-
2010   4   29                  6
-[ ]-
2010   4   29   7
Coder
   -[ ]-
2010   4   29           8
Rails



   -[ ]-
2010   4   29           9
Redmine0.9




   -[ ]-
2010   4   29                10
Redmine1.0(7                                     )




                http://www.redmine.org/news/36

   -[ ]-
2010   4   29                                    11
...




   -[ ]-
2010   4   29         12
conflict   (^o^)


   -[ ]-
2010   4   29                      13
-[ ]-
2010   4   29   14
Redmine




                  rhtml
       ViewHook

   -[ ]-
2010   4   29             15
ViewHook

                           ◎
http://d.hatena.ne.jp/suer/20100119/redmine_view_ext




   -[ ]-
2010   4   29                                          16
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
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
-[ ]-
2010   4   29   19
$ 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
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.?nd(:all,
                            :conditions => {:assigned_to_id => User.current.id})
               reported_issues = Issue.visible.?nd(: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
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
-[ ]-
2010   4   29   23
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
inherited
                     ^o^

   -[ ]-
2010   4   29               25
-[ ]-
2010   4   29   26

More Related Content

Redmine云悶に返を秘れないビュ`カスタマイズ隈あれこれ (Mitaka.rb #8)

  • 1. Redmine 2010 4 29 1
  • 2. Hatena id:suer Twitter @suer Redmine Plugin: MSP Importer ( ...) : 24 ocaml-nagoya -[ ]- 2010 4 29 2
  • 3. Redmine Rails Web feed wiki SCM -[ ]- 2010 4 29 3
  • 4. -[ ]- 2010 4 29 4
  • 5. -[ ]- 2010 4 29 5
  • 6. TiDD ! ! -[ ]- 2010 4 29 6
  • 7. -[ ]- 2010 4 29 7
  • 8. Coder -[ ]- 2010 4 29 8
  • 9. Rails -[ ]- 2010 4 29 9
  • 10. Redmine0.9 -[ ]- 2010 4 29 10
  • 11. Redmine1.0(7 ) http://www.redmine.org/news/36 -[ ]- 2010 4 29 11
  • 12. ... -[ ]- 2010 4 29 12
  • 13. conflict (^o^) -[ ]- 2010 4 29 13
  • 14. -[ ]- 2010 4 29 14
  • 15. Redmine rhtml ViewHook -[ ]- 2010 4 29 15
  • 16. ViewHook ◎ http://d.hatena.ne.jp/suer/20100119/redmine_view_ext -[ ]- 2010 4 29 16
  • 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. 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. -[ ]- 2010 4 29 19
  • 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. 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.?nd(:all, :conditions => {:assigned_to_id => User.current.id}) reported_issues = Issue.visible.?nd(: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. 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. -[ ]- 2010 4 29 23
  • 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. inherited ^o^ -[ ]- 2010 4 29 25
  • 26. -[ ]- 2010 4 29 26