You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bloodhound.apache.org by Gary <ga...@wandisco.com> on 2012/04/21 17:26:35 UTC

Re: svn commit: r1328689 - /incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Hi,

This commit should stop and stylesheets provided by trac from being 
loaded (leaving the stylesheets provided by plugins and site 
customisation alone) when the bloodhound theme is active.

Cheers,
     Gary

On 21/04/12 16:17, gjm@apache.org wrote:
> Author: gjm
> Date: Sat Apr 21 15:17:12 2012
> New Revision: 1328689
>
> URL: http://svn.apache.org/viewvc?rev=1328689&view=rev
> Log:
> theme: post process chrome links to remove trac provided stylesheets - fixes #39
>
> Modified:
>      incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
>
> Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
> URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1328689&r1=1328688&r2=1328689&view=diff
> ==============================================================================
> --- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
> +++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Sat Apr 21 15:17:12 2012
> @@ -66,6 +66,27 @@ class BloodhoundTheme(ThemeBase):
>       """Look and feel of Bloodhound issue tracker.
>       """
>       template = htdocs = css = screenshot = disable_trac_css = True
> +    disable_all_trac_css = True
> +
> +    implements(IRequestFilter)
> +
> +    # IRequestFilter methods
> +
> +    def pre_process_request(self, req, handler):
> +        """Pre process request filter"""
> +        return handler
> +
> +    def post_process_request(self, req, template, data, content_type):
> +        """Post process request filter.
> +        Removes all trac provided css if required"""
> +        if self.disable_all_trac_css:
> +            links = req.chrome.get('links',{})
> +            indices = [i for (i,ss) in enumerate(links.get('stylesheet',[]))
> +                       if ss.get('href').startswith(req.base_path +
> +                                                    '/chrome/common/css/')]
> +            for i in indices:
> +                del links['stylesheet'][i]
> +        return template, data, content_type
>
>   class QuickCreateTicketDialog(Component):
>       implements(IRequestFilter, IRequestHandler)
>
>