1

I'm creates a plugin for Redmine. I want add class into a tag on the issues list page (issues/_list.html.erb view). But I don't want change the core Redmine code. As I understand, hooks (for example :view_issues_index_bottom) allows to me to add data but don't replace them. How can I replace list part on the issues list page from my plugin?

jonua
  • 1,915
  • 3
  • 17
  • 27

3 Answers3

2

As a general rule, don't just override core views in your plugin as suggested in the accepted answer.

It makes Redmine upgrades harder or impossible for your users, can lead to wrong behavior or errors when used with another Redmine version than the one you took the view from and it most probably prevents your plugin from being included in the offerings of Redmine hosters like Planio.

Instead, either supply a proper Redmine patch as part of your plugin (and document how to apply it) or do any necessary DOM changes via Javascript through the regular hooks. If you feel like hooks are missing, you can also submit a patch to Redmine adding new hooks.

jkraemer
  • 357
  • 1
  • 6
1

Just copy issues/_list.html.erb to your plugin views folder (/plugins/your_plugin/app/views/issues/_list.html.erb) and edit it as nessecary.

Redmine will use your plugin's views first.

General Failure
  • 2,421
  • 4
  • 23
  • 49
  • Downvoted, because Jens' answer is right: it will work but it will hurt in the long run. – jan Oct 23 '15 at 05:22
  • Yes, it's my mistake. I understand first that @kdjonua want to fully replace view. Of course, my answer is wrong for views updating. – General Failure Oct 26 '15 at 04:23
0

You can try to add gem deface and replace part of the view with its functionality. Look at this commit as example

gotva
  • 5,919
  • 2
  • 25
  • 35