Changeset 3129

Show
Ignore:
Timestamp:
01/22/08 15:47:06 (10 months ago)
Author:
ixokai
Message:

Added "gray_disabled" option per #2457.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • blackmagictickettweaksplugin/0.11/blackmagic/blackmagic.py

    r3122 r3129  
    11from trac.core import Component, implements, TracError 
    2 from trac.config import Option, IntOption, ListOption 
     2from trac.config import Option, IntOption, ListOption, BoolOption 
    33from trac.web.chrome import ITemplateProvider, add_stylesheet, add_script 
    44from pkg_resources import resource_filename 
     
    2323     
    2424    permissions = ListOption('blackmagic', 'permissions', []) 
     25    gray_disabled = Option('blackmagic', 'gray_disabled', '',  
     26        doc="""If not set, disabled items will have their label striked through.  
     27        Otherwise, this color will be used to gray them out. Suggested #cccccc.""") 
    2528    ## IPermissionRequestor methods 
    2629     
     
    5255                if disabled or istrue(self.config.get('blackmagic', '%s.disable' % field, False)): 
    5356                    stream = stream | Transformer('//*[@id="field-%s"]' % field).attr("disabled", "disabled") 
    54                     if not self.config.get('blackmagic', '%s.label' % field, None)
     57                    if not self.gray_disabled
    5558                        stream = stream | Transformer('//label[@for="field-%s"]' % field).replace( 
    5659                            tag.strike()('%s:' % field.capitalize()) 
    5760                        ) 
    58                          
     61                    else: 
     62                        stream = stream | Transformer('//label[@for="field-%s"]' % field).replace( 
     63                            tag.span(style="color:%s" % self.gray_disabled)('%s:' % field.capitalize()) 
     64                        ) 
     65 
    5966                if self.config.get('blackmagic', '%s.label' % field, None): 
    6067                    stream = stream | Transformer('//label[@for="field-%s"]' % field).replace(