diff options
-rw-r--r-- | app/views/layouts/default.rhtml | 2 | ||||
-rw-r--r-- | config/routes.rb | 1 | ||||
-rw-r--r-- | doc/CHANGES.md | 4 | ||||
-rw-r--r-- | doc/THEMES.md | 33 |
4 files changed, 20 insertions, 20 deletions
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 2c19c76f3..4008760a1 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -34,6 +34,8 @@ <!--[if LT IE 8]> <style type="text/css">@import url("/stylesheets/ie7.css");</style> <![endif]--> + <!-- the following method for customising CSS is deprecated -- see `doc/THEMES.md for detail --> + <%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %> <% if force_registration_on_new_request %> <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index a238e2102..48bf92e75 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,6 +20,7 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'general' do |general| general.frontpage '/', :action => 'frontpage' general.blog '/blog', :action => 'blog' + general.custom_css '/stylesheets/custom.css', :action => 'custom_css' general.search_redirect '/search', :action => 'search_redirect' # XXX combined is the search query, and then if sorted a "/newest" at the end. # Couldn't find a way to do this in routes which also picked up multiple other slashes diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 61890275a..753560873 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -5,9 +5,9 @@ * Base design refactored: CSS simplified and reduced, base design colours removed, now provided in example Alaveteli theme override ## Upgrade notes -* Themes created for 0.4 and below will need to be changed to match the new format. +* Themes created for 0.4 and below should be changed to match the new format (although the old way should continue to work): * You should create a resources folder at `<yourtheme>/public/` and symlink to it from the main rails app. See the `install.rb` in `alaveteli-theme` example theme for details. - * Your styles should be moved from `general/custom_styles.rhtml` to a standalone stylesheet in `<yourtheme>/public/stylesheets/` + * Your styles should be moved from `general/custom_css.rhtml` to a standalone stylesheet in `<yourtheme>/public/stylesheets/` * The partial at `general/_before_head_end.rhtml` should be changed in the theme to include this stylesheet diff --git a/doc/THEMES.md b/doc/THEMES.md index a4793a6fd..c2381b61f 100644 --- a/doc/THEMES.md +++ b/doc/THEMES.md @@ -50,24 +50,21 @@ These means that a file at `vendor/plugins/alavetelitheme/lib/help/about.rhml` will appear in place of the core "about us" file. -There's a special file at -`vendor/plugins/alavetelitheme/lib/views/general/custom_css.rhtml`. -Its contents are automatically included as the last CSS file in the -header of the site. In theory, it should be possible to do quite a -lot of layout customisation by only changing this file. - -Your CSS is likely to reference various images such as a logo, -background images, etc. We don't have a nice way of supporting these -at the moment. The current practice is to place them in -`vendor/plugins/alavetelitheme/public/images/` and then symlink this -directory to somewhere within the `public/` folder in the main -Alaveteli Rails app, e.g.: - - ln -s $ALAVETELI_SITE/vendor/plugins/alavetelitheme/public/images/ public/images/my_images - -...and then refer to these in your custom_css.rhtml like so: - - background-image: url("../my_images/navimg/my-logo.png"); +Rails expects all its stylesheets to live at `<railshome>/public`, +which presents a problem for plugins. Here's how we solve it: the +stylesheet and associated resources for your theme live (by +convention) in at `alavatelitheme/public/`. This is symlinked from +the main Rails app -- see `alavetelitheme/install.rb` to see how this +happens. + +The partial at +`alavetelitheme/lib/views/general/_before_head_end.rhtml` includes the +custom CSS in your theme's stylesheet folder (by convention, in +`alavetelitheme/public/stylesheets/`), with: + + <%= stylesheet_link_tag "/alavetelitheme/stylesheets/custom" %> + +...which will, of course, need changing for your theme. # Customising the request states |