You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by Apache Bloodhound <bl...@incubator.apache.org> on 2012/04/20 17:13:55 UTC

[Apache Bloodhound] #39: Disable old Trac CSS files

#39: Disable old Trac CSS files
-----------------------+-------------------------------------
 Reporter:  jdreimann  |      Owner:  nobody
     Type:  task       |     Status:  new
 Priority:  critical   |  Milestone:  RC1 for initial release
Component:  ui design  |    Version:
 Keywords:             |
-----------------------+-------------------------------------
 Trac used a lot of different css files to apply different styles to parts
 of the interface. In order to make the migration to Bootstrap a little
 easier I propose that we disable these - either by renaming, deleting or
 overwriting (with <null>) these files:
 https://svn.apache.org/repos/asf/incubator/bloodhound/trunk/trac/trac/htdocs/css/

 It would then be more obvious what we still have to adapt to the new
 style. I have done this locally and found it very useful.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 afaict +1

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:12>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 Oops ! Attachment URL is [attachment:t39_r1328689_indexerror.diff this]

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:10>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 Thanks for pointing that out too. I don't think that THEME_NAME is used
 elsewhere so I suggest we go with something like this instead for the
 test:

 {{{
 #!python
         def active_theme():
             is_active = False
             active_theme = ThemeEngineSystem(self.env).theme
             if active_theme is not None:
                 this_theme_name = self.get_theme_names().next()
                 is_active = active_theme['name'] == this_theme_name
             return is_active

         if self.disable_all_trac_css and is_active_theme():
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:11>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------
Changes (by gjm):

 * status:  new => accepted
 * owner:  nobody => gjm


-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:4>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  nobody
      Type:  task       |     Status:  new
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 Note that trac.css is already disabled for our theme as we have set
 {{{disable_trac_css = True}}} for the {{{bhtheme.theme.BloodhoundTheme}}}
 class. We could always also set something like {{{disable_all_trac_css =
 True}}} to control this new behaviour. There may also be a case for
 suggesting that code like this is put into the !ThemeEngine itself.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:3>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Gary <ga...@wandisco.com>.
Hi Joe,

With a quick bit of playing around with some code, I think I found a way 
to do the job programmatically. This could be good if we want this to be 
permanent for the bloodhound theme (i.e. leaving core trac alone). Does 
this sound sensible to everyone?

I left the code suggestion in the 
https://issues.apache.org/bloodhound/ticket/39#comment:1 for the 
implementer to consider.

Cheers,
     Gary


On 04/20/2012 04:40 PM, Joachim Dreimann wrote:
> Hello all,
>
> We've been making steady progress on applying the Bootstrap styles to
> Bloodhound (today I've commited r1328362 for the Activity feed), but
> I'd like to propose a somewhat bolder next step:
> Disable all the old Trac css files.
>
> I've raised the ticket (see below) to describe it a little further.
> The current stylesheets seem inconsistent in their approach and don't
> follow current best practices (many styles are applied by ID).
>
> As a general strategy I suggest we should try and use bootstrap.css
> for all styles wherever reasonable, and only have one other styling
> file for now: bloodhound.css
> This is only for things to which the correct Bootstrap classes haven't
> been applied yet. While it will grow in the short term to accomodate
> for stuff that will break when we disable the old trac css files, in
> the medium term it should shrink to the bare minimum of things that
> really wouldn't fit Bootstrap styles.
>
> - Joe
>
>
> On 20 April 2012 16:13, Apache Bloodhound
> <bl...@incubator.apache.org>  wrote:
>> #39: Disable old Trac CSS files
>> -----------------------+-------------------------------------
>>   Reporter:  jdreimann  |      Owner:  nobody
>>      Type:  task       |     Status:  new
>>   Priority:  critical   |  Milestone:  RC1 for initial release
>> Component:  ui design  |    Version:
>>   Keywords:             |
>> -----------------------+-------------------------------------
>>   Trac used a lot of different css files to apply different styles to parts
>>   of the interface. In order to make the migration to Bootstrap a little
>>   easier I propose that we disable these - either by renaming, deleting or
>>   overwriting (with<null>) these files:
>>   https://svn.apache.org/repos/asf/incubator/bloodhound/trunk/trac/trac/htdocs/css/
>>
>>   It would then be more obvious what we still have to adapt to the new
>>   style. I have done this locally and found it very useful.
>>
>> --
>> Ticket URL:<https://issues.apache.org/bloodhound/ticket/39>
>> Apache Bloodhound<https://issues.apache.org/bloodhound/>
>> The Apache Bloodhound (incubating) issue tracker


Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Joachim Dreimann <jo...@wandisco.com>.
Hello all,

We've been making steady progress on applying the Bootstrap styles to
Bloodhound (today I've commited r1328362 for the Activity feed), but
I'd like to propose a somewhat bolder next step:
Disable all the old Trac css files.

I've raised the ticket (see below) to describe it a little further.
The current stylesheets seem inconsistent in their approach and don't
follow current best practices (many styles are applied by ID).

As a general strategy I suggest we should try and use bootstrap.css
for all styles wherever reasonable, and only have one other styling
file for now: bloodhound.css
This is only for things to which the correct Bootstrap classes haven't
been applied yet. While it will grow in the short term to accomodate
for stuff that will break when we disable the old trac css files, in
the medium term it should shrink to the bare minimum of things that
really wouldn't fit Bootstrap styles.

- Joe


On 20 April 2012 16:13, Apache Bloodhound
<bl...@incubator.apache.org> wrote:
> #39: Disable old Trac CSS files
> -----------------------+-------------------------------------
>  Reporter:  jdreimann  |      Owner:  nobody
>     Type:  task       |     Status:  new
>  Priority:  critical   |  Milestone:  RC1 for initial release
> Component:  ui design  |    Version:
>  Keywords:             |
> -----------------------+-------------------------------------
>  Trac used a lot of different css files to apply different styles to parts
>  of the interface. In order to make the migration to Bootstrap a little
>  easier I propose that we disable these - either by renaming, deleting or
>  overwriting (with <null>) these files:
>  https://svn.apache.org/repos/asf/incubator/bloodhound/trunk/trac/trac/htdocs/css/
>
>  It would then be more obvious what we still have to adapt to the new
>  style. I have done this locally and found it very useful.
>
> --
> Ticket URL: <https://issues.apache.org/bloodhound/ticket/39>
> Apache Bloodhound <https://issues.apache.org/bloodhound/>
> The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------
Changes (by gjm):

 * status:  reopened => accepted


Comment:

 Yes, I see what I did.. that was rather silly.

 I'm glad I get to revisit this as I didn't really like having the
 enumerate in there as I think it makes the list comprehension more
 difficult to read.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:7>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  closed
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:  fixed      |   Keywords:
------------------------+-------------------------------------
Changes (by gjm):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 No further comments noted and so I will close this as fixed.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:14>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 r1329142 should fix and for a bonus looks a bit more readable to me:

 {{{svn diff -r 1329141 bloodhound_theme/bhtheme/theme.py}}}:
 {{{
 #!diff
 Index: bloodhound_theme/bhtheme/theme.py
 ===================================================================
 --- bloodhound_theme/bhtheme/theme.py   (revision 1329114)
 +++ bloodhound_theme/bhtheme/theme.py   (working copy)
 @@ -78,14 +78,14 @@

      def post_process_request(self, req, template, data, content_type):
          """Post process request filter.
 -        Removes all trac provided css if required"""
 +        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]
 +            stylesheets = links.get('stylesheet',[])
 +            if stylesheets:
 +                path = req.base_path + '/chrome/common/css/'
 +                links['stylesheet'] = [ss for ss in stylesheets
 +                                       if not
 ss.get('href').startswith(path)]
          return template, data, content_type

  class QuickCreateTicketDialog(Component):
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:8>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  reopened
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------
Changes (by olemis):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 This solution needs to be improved , considering the fact that I'm getting
 this error :

 {{{
 Trac detected an internal error:
 IndexError: list assignment index out of range
 }}}

 Traceback looks like this :

 {{{

 Python Traceback

 Most recent call last:
 File "/path/to/trac/web/main.py", line 478, in _dispatch_request
   dispatcher.dispatch(req)
 File "/path/to/trac/web/main.py", line 208, in dispatch
   self._post_process_request(req, *resp)
 File "/path/to/trac/web/main.py", line 319, in _post_process_request
   resp = f.post_process_request(req, *resp)
 File "/path/to/bloodhound_theme/bhtheme/theme.py", line 88, in
 post_process_request
   del links['stylesheet'][i]
 }}}

 /me reopening ...

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:6>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  closed
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:  fixed      |   Keywords:
------------------------+-------------------------------------
Changes (by gjm):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 r1328689 fixes

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:5>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  nobody
      Type:  task       |     Status:  new
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 +1

 Doing this it won't be necessary to patch Trac source code by overriding
 rules in `trac.css` using those in `bootstrap.css`

 Nonetheless it'd be nice to assess whether to remove ''trac.css''
 '''ONLY''' rather than all other CSS files at once.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:2>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  nobody
      Type:  task       |     Status:  new
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 If we are only removing trac provided common/css/*.css we could probably
 do this using the post_process_request of an IRequestFilter in the
 bloodhound theme. This way we would not have to change trac itself, which
 would be good.

 I believe something like this could do the job:
 {{{#!python
 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]
 }}}

 This is based on how the theme engine code does the job, though a fair bit
 more condensed.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 There are still some hidden issues .
 [attachment:ticket:39:t39_r1328689_indexerror.diff​ Attached patch] should
 fix them . It's built on top of changeset:1328689 so it needs some update
 (or revert then apply ''';)''' .

 Please try it . Hopefully it will work for you as well .

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:9>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #39: Disable old Trac CSS files

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#39: Disable old Trac CSS files
------------------------+-------------------------------------
  Reporter:  jdreimann  |      Owner:  gjm
      Type:  task       |     Status:  accepted
  Priority:  critical   |  Milestone:  RC1 for initial release
 Component:  ui design  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 r1330156 provides a combination of the patch from Olemis with the change
 in method of checking for the active theme above.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/39#comment:13>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker