Opened 7 years ago

Closed 6 years ago

Last modified 4 years ago

#4959 closed Bug/Something is broken (fixed)

trac ticket template customizations for https://support.mayfirst.org should move into site.html

Reported by: https://id.mayfirst.org/dkg Owned by: https://id.mayfirst.org/dkg
Priority: High Component: Tech
Keywords: support.mayfirst.org trac Cc:
Sensitive: no

Description

as noted during the recent upgrade to 0.12.2, our customizations to the trac ticket pages are clumsy to port across trac upgrades.

I suspect they could be better written as stanzas in /srv/trac/support/templates/site.html, but i haven't tried to do it.

Anyone who wants to take this on could probably try making edits on moses and then restarting apache to see if they do what you expect. If they do, then maybe we could get rid of /srv/trac/support/templates/ticket.html and that would make trac version upgrades smoother and simpler.

Change History (10)

comment:1 Changed 7 years ago by https://id.mayfirst.org/ross

  • Keywords f2f added
  • Owner set to https://id.mayfirst.org/ross
  • Status changed from new to assigned

comment:2 Changed 7 years ago by https://id.mayfirst.org/ross

  • Keywords f2f removed

Genshi templating needs to be modified to tell trac how to pull in changes.

comment:3 Changed 6 years ago by https://id.mayfirst.org/dkg

see #5318 for details about the ticket template customizations that we have already.

comment:4 Changed 6 years ago by https://id.mayfirst.org/dkg

  • Owner changed from https://id.mayfirst.org/ross to https://id.mayfirst.org/dkg

i'm gonna try to figure this out.

comment:5 Changed 6 years ago by https://id.mayfirst.org/dkg

  • Priority changed from Medium to High

comment:6 Changed 6 years ago by https://id.mayfirst.org/dkg

OK, this seems mostly doable so far. my basic workflow is:

  • compare our ticket.html with the shipped ticket.html:
    diff -u5 /usr/share/pyshared/trac/ticket/templates/ticket.html /srv/trac/support/templates/ticket.html
    
  • for each significant hunk in that diff, use the site.html cookbook to think through a genshi-style way of representing the change.
  • place the change in site.html in genshi style, and remove the difference from ticket.html
  • restart apache
  • reload the relevant page on SMO to make sure things look reasonable.

three changes remain to be handled.

comment:7 Changed 6 years ago by https://id.mayfirst.org/dkg

I've gotten everything transferred except for one change: i'm trying to move the "action" fieldset outside of the collapsible div labeled "Modify Ticket", but it's not clear how to make that happen cleanly.

comment:8 Changed 6 years ago by https://id.mayfirst.org/dkg

While the site.html cookbook is good, it's not a comprehensive reference. For that, it's worth reading the genshi xml templating documentation.

I'm finding myself stumped on how to represent this final change in genshi terminology. It's possible that this DOM manipulation should be done entirely in javascript (it's not relevant or necessary for those browsing without javascript).

comment:9 Changed 6 years ago by https://id.mayfirst.org/dkg

  • Resolution set to fixed
  • Status changed from assigned to closed

yep, this change turned out to be much easier to do with javascript:

<!-- move the ticket action fieldset outside of (and above) the foldable "Modify Ticket" section -->
<py:match path="div[@id='content'][@class='ticket']//form[@id='propertyform']//div[@id='modify']//fieldset[@id='action']" once="true">
  <fieldset py:attrs="select('@*')">
    ${select('*|comment()|text()')}
  </fieldset>
  <script type="text/javascript">
    (function () { var a = $('#action'); a.parent().parent().before(a); })()
  </script>
</py:match>

The way this works is:

  • the py:match element makes sure this only triggers on the expected fieldset.
  • we recreate the same fieldset that we matched on and include all its matched attributes
  • then we inject a bit of scoped jquery code that moves the created element up a couple levels in the DOM.

comment:10 Changed 4 years ago by https://id.mayfirst.org/jamie

See regression: #10579

Please login to add comments to this ticket.

Note: See TracTickets for help on using tickets.