Opened 13 years ago

Last modified 13 years ago

#8479 closed enhancement

Children inheriting tickets from parents — at Version 1

Reported by: plt Owned by: Mark Ryan
Priority: normal Component: ChildTicketsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description (last modified by Ryan J Ollos)

Hi, I'm working on a rollout of trac and i'm using child tickets. I have a number of custom fields that I need to be applied to child tickets so i've hacked the code a bit and added it in. Can i just checkout the code and then check it back in with the mods? This is the section of code i've modified.

                    # Can user create a new ticket? If not, just display title (ie. no 'create' button).
                    if 'TICKET_CREATE' in req.perm(ticket.resource):
                        #PLT - Moved form to here 20110208
                        form_fields = [
                            tag.input(type="submit", name="childticket", value="Create", title="Create a child ticket"),
                            tag.input(type="hidden", name="parent", value='#'+str(ticket.id)),
                            tag.input(type="hidden", name="milestone", value=default_child_milestone),
                            tag.input(type="hidden", name="type", value=default_child_type),
                            tag.input(type="hidden", name="foobar", value=default_child_type),
                        ]
                        #Added fields based on the inherit list in the config
                        for field in self.config.getlist('childtickets', 'parent.%s.inherit' % ticket['type']):
                            form_fields.append(
                                tag.input(type="hidden", name="%s" % field, value=ticket[field]),
                            )
                        snippet.append(tag.div(
                            tag.form(
                                tag.div(
                                    form_fields, #Read in form fields from variable
                                    class_="inlinebuttons"),
                                method="get", action=req.href.newticket(),
                                ),
                            tag.h3("Child Tickets",id="comment:child_tickets"),
                            ))
                    else:
                        snippet.append(tag.div(tag.h3("Child Tickets",id="comment:child_tickets")))

I've moved the form fields to a list and appended additional fields from the config

Pete

Change History (2)

comment:1 Changed 13 years ago by Ryan J Ollos

Description: modified (diff)

Attaching diff is always preferred so that the maintainer can see exactly what you have modified and directly apply the patch to the source.

Changed 13 years ago by plt

Attachment: childticketsplugin.py.diff added
Note: See TracTickets for help on using tickets.