[[PageOutline(2-5,Contents,pullout)]] = Add context-aware styles to Trac page widgets == Description This plugin offers the capability to style your Trac pages and page widgets according to the type of ticket you are dealing with. Key features: 1. Ticket Link Decoration by field value: Set css-class to link to tickets by field value. You can specify field names at `trac.ini`. 1. Decorate over intertrac links, with XmlRpcPlugin and [browser:/contextchromeplugin/0.12/contextchrome/cors.py corsEnabler] included. 1. Ticket color by Type: Set css-class by type or specified field value on ticket. You can design for each type of ticket with trac:wiki:CookBook/SiteStyleCss feature. 1. Wiki color by tags: Set css-class by tags added by TagsPlugin. 1. marked for validation: Set css-class to field specified by validator, such as TracTicketValidatorPlugin or TracTicketConditionalValidatePlugin. 1. User"s own stylesheet or javascript; with user preferences page. 1. Wiki Link Decoration by age of wiki page: add "new" css-class to link to a wiki page that is recent. You can specify the age in `trac.ini`. 1. Decayed Wiki: indicate how old the wiki page is. You can specify colors by age in seconds at `trac.ini`; requires Python 2.7 or later. If you want to edit the CSS inline in the browser, use WikiCssPlugin or ThemeEnginePlugin. If you want to modify the decoration link to a new page, edit the files site.html and site.css. == Bugs/Feature Requests Existing bugs and feature requests for ContextChromePlugin are [report:9?COMPONENT=ContextChromePlugin here]. If you have any issues, create a [/newticket?component=ContextChromePlugin new ticket]. [[TicketQuery(component=ContextChromePlugin,group=type,format=progress)]] == Download Download the zipped source from [export:contextchromeplugin here]. == Source You can check out ContextChromePlugin from [/svn/contextchromeplugin here] using Subversion, or [source:contextchromeplugin browse the source] with Trac. == Installation General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page. == Example Sample `trac.ini` stanza: {{{#!ini [components] contextchrome.linkdeco.internalstylesheet = enabled contextchrome.linkdeco.ticketlinkdecorator = enabled contextchrome.linkdeco.wikilinknewdecolator = enabled contextchrome.style.typeclasstoticket = enabled contextchrome.prefs.userstyle = enabled decayed.wiki.decayedwiki = enabled }}} === Wiki age to decorate or not Example `trac.ini`: {{{#!ini [wiki] wiki_new_info_second = 432000 }}} [[Image(newpage.png, border=2)]] === Decayed Wiki Sample `trac.ini` where the background of wiki pages are colored by age, ie white for modified in a day, light grey for in a week, and so on: {{{#!ini [wiki] decay_colors = 86400: #ffffff, 604800: #eeeeee, 2678400: #dddddd, 31536000: #aaaaaa, 2147483647: #777777 }}} === Ticket link decoration by field value Sample `trac.ini`: {{{#!ini [ticket] decorate_fields = owner, milestone, type }}} Sample style.css: {{{#!css a.type_is_defect { background-color: #f5deb3; /* wheat */ } a.type_is_enhancement { background-color: #87ceeb; /* sky blue */ } a.type_is_task { background-color: #ffd700; /* gold */ } a.owner_is_somebody { border: maroon thin solid; } }}} The defects have a wheat-colored background, the enhancements a sky-blue colored background and the tasks a gold colored background: [[Image(linkdeco.png, border=2)]] To decorate over intertrac links, use XmlRpcPlugin and CrossOriginResourceSharingEnabler as follows: [[Image(cors.png, border=2)]] === Ticket color by Type Sample style.css: {{{#!css body.type_is_defect { background-color: #f5deb3; /* wheat */ } body.type_is_enhancement { background-color: #87ceeb; /* sky blue */ } body.type_is_task { background-color: #ffd700; /* gold */ } body.tagged_as_sometag { background-color: #ffcccc; } }}} The defects have a wheat-colored background, the enhancements a sky-blue colored background and the tasks a gold colored background: [[Image(TypeClassToTicket.png, border=2)]] === Marked for validation Enable required TracTicketValidatorPlugin. Sample `trac.ini`: {{{#!ini [ticketvalidator] validates = keywords, vote keywords.rule = .+ vote.rule = .+ }}} Note how the fields '''Keywords''' and '''Vote''' are emphasised: [[Image(TracTicketValidator.png, border=2)]] == Recent Changes [[ChangeLog(contextchromeplugin, 3)]] == Author/Contributors '''Author:''' [wiki:matobaa] [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:'''