ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Support themes outside of the public/themes path (Bug #993)


Added by Eric Davis at 2012-04-16 05:52 pm. Updated at 2012-04-16 06:13 pm.


Status:Open Start date:2012-04-16
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Themes
Target version:-
Remote issue URL: Affected version:

Description

The themes_storage_path documentation makes it appear that themes can be located outside of the public/themes path but I found that doesn't work at all. Redmine::Themes has two methods that hardcode the css and js to "/themes/THEME_NAME/".

I've attached a patch that allows themes to be located anywhere within the public/ directory. I'm successfully using this to bundle a theme within a plugin (e.g. plugin comes with a theme that is added to the list of available themes).

No pull request because I can't apply this to master yet (deep into another branch) and because I haven't written tests for it.

Tech details

This changes a Theme so it uses a new public_path for it's CSS and JS. The public_path is set by using the Theme's path (absolute filesystem path in initialize) and removing the Rails public path from it. So it converts the default core theme like so:

  • "path" /home/edavis/dev/chiliproject/public/themes/default
  • "public_path" /themes/default
  • "javascript_path" /themes/default/javascripts...

which is how it is currently hardcoded. For my bundled theme it works using Engine's public/plugin_assets like so:

  • "path" /home/edavis/dev/chiliproject/public/plugin_assets/redmine_shane_and_peter_design/themes/modern_tribe
  • "public_path" /plugin_assets/redmine_shane_and_peter_design/themes/modern_tribe
  • "javascript_path" /plugin_assets/redmine_shane_and_peter_design/themes/modern_tribe/javascripts

(I'd be happy to show how I've bundled a theme inside of a plugin as soon as I'm complete)


themes_outside_of_public_theme.diff (964 Bytes) Eric Davis, 2012-04-16 05:52 pm


Associated revisions

Revision 4e961f44
Added by Jean-Philippe Lang at 2008-04-05 06:40 pm

Various timelog report enhancements:
  • report can be done using days as columns (#993)
  • add a total column to the time report
  • replace upper-right links by tabs to switch between details and report
  • preserve date range filter when switching between details and report

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1326 e93f8b46-1217-0410-a6f0-8f06a7374b81

History

Updated by Holger Just at 2012-04-16 06:13 pm

In fact, themes can be located outside of public/themes today. However, it requires an Alias in the frontend webserver. Something like this works just fine today:

# In the Apache vhost
Alias /themes /my/theme/path
# In configuration.yml
themes_storage_path: "/my/theme/path" 

That said, I support the usecase of allowing to ship a theme as a plugin. The current facility doesn't really support that (it does, but it requires more manual steps than it's worth). Allowing plugins to ship themes unifies extensions and overall makes things easier. Once we moved to Rails 3 (with its asset pipeline), this will be the only way for shipping themes anyway as I'd like to handle any extension with gems and (simple) engines.

Also available in: Atom PDF