0

I have created plugin for redmine that displays issues with some additional info. Plugin works ok. Now i want this information to be shown on project page under issues summary. ive read this article http://www.redmine.org/boards/3/topics/33949

and rednder_on approach looks very promising. ive added new plugin with hook for view_projects_show_right code looks like this

# lib/release_history_hook.rb

class ReleaseHistoryHook < Redmine::Hook::ViewListener
render_on :view_projects_show_right, :partial => 'bottlenecks/view_issues'
end

bottlenecks plugin tree structure is like this

/opt/redmine/plugins/bottlenecks/
├── app
│   ├── controllers
│   │   ├── bottlenecks_controller.rb
│   │   └── bottlenecks_controller.rb~
│   ├── helpers
│   │   ├── bottlenecks_helper.rb
│   │   └── bottlenecks_helper.rb~
│   ├── models
│   └── views
│   └── bottlenecks
│   ├── view_issues.html.erb
│   ├── view_issues.html.erb~
│   ├── view_issues.html_original.erb
│   ├── view_issues.html_original.erb~
│   └── view_users.html.erb
├── assets
│   ├── images
│   ├── javascripts
│   └── stylesheets
├── config
│   ├── locales
│   │   └── en.yml
│   └── routes.rb
├── db
│   └── migrate
├── init.rb
├── init.rb~
├── lib
│   └── tasks
├── README.rdoc
└── test
├── fixtures
├── functional
│   └── bottlenecks_controller_test.rb
├── integration
├── test_helper.rb
└── unit

21 directories, 16 files

Ive tried to specify full path,path with extensions ...all the combinations. When i run redmine and access project page its always gives me 404 error. I clearly misunderstand something very basic. I just cant find more information on that subject. What am i doing wrong? Also render_on seems to be deprecated. What can i use instead?

1 Answer 1

1

it seems to me that you named your partial incorectly without prefix "_". You should place file _view_issues.html.erb to YOUR_PLUGIN/app/views/bottlenecks/

Source to read more http://www.redmine.org/projects/redmine/wiki/Hooks

Examples:

how to call hook https://github.com/edavis10/redmine_contracts/blob/master/lib/redmine_contracts/hooks/view_issues_show_details_bottom_hook.rb

code of the hook https://github.com/edavis10/redmine_contracts/blob/master/app/views/issues/_show_deliverable.html.erb

Sign up to request clarification or add additional context in comments.

7 Comments

Underscore? there is nothing about naming notation in the wiki page you provided.Besides it didn't worked.
you render partial - it means (by convention) that the name should start from "_". Try to check path to the partial (according to your printed file tree it is incorrect). Another reason can be missed your hook's 'registration'. See init file from example (last lines).
My bad. I misspelled name of the plugin.Now i can see that it tries to render my view. But controller is not called. So all the variables are uninitialized. I have ActionView::Template::Error (undefined method `map' for nil:NilClass):error.
Describe it with details. What controller, what views, in what moment you get exception.
init.rb for my plugin has a line menu :application_menu, :bottlenecks, { :controller => 'bottlenecks', :action => 'view_issues' }, :caption => 'Bottlenecks'. bottlenecks_controller.rb prepares data for the view to render. It works when i call it from application menu, but in this case of render_on it does not happen, so all variables that i use in view are not initialized. Should i rename controller files? Should i configure it somehow in routes.rb ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.