Redmine Plugin/Rails Engine - Paths for images/javascripts in a plugin that is on every page?

Added by Joshua Enfield over 9 years ago

Alright so I have a plugin for Redmine (Rails Engines.) The plugin uses the hooks such that it's HTML/controls get rendered on every page in Redmine.

I am receiving and sending information from this plugin to the controller. Now I have two options I can use in the javascript and css: relative pathing or absolute pathing.

Relative Pathing won't work for every page since the URL paths may anywhere from one to three sections to path from (Since the control must work from every page). This option requires my plugin to be rendered at the same nested level in the URL every time which it is not.

Absolute Pathing works for a particular install, but my plugin breaks when others use it under installs where the path is not under the domain root i.e. www.mysite.com/redmine/ instead of www.mysite.com. This requires manual editing which is not elegant at all.

Is there any way to easily address this seemingly simple issue?