Modify

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#8479 closed enhancement (fixed)

Children inheriting tickets from parents

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

Attachments (4)

childticketsplugin.py.diff (3.2 KB) - added by plt 13 years ago.
parent ticket with ticket type buttons.png (61.0 KB) - added by plt 13 years ago.
parent ticket with ticket type buttons.2.png (61.0 KB) - added by plt 13 years ago.
perTypeButtons.png (61.0 KB) - added by plt 13 years ago.

Download all attachments as: .zip

Change History (11)

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

comment:2 Changed 13 years ago by plt

Type: defectenhancement

Hi, I've tidied up the code and attached as a diff. Changes i've made are Added a list of fields to inherit to trac.ini.

 parent.enhancement.inherit = field1,field2,field3

will cause these fields to be passed to the child ticket Changed the Create ticket button if a restrict_child_type directive is supplied. You get a set of buttons, one for each child type. It could be tidied up a bit as the buttons are close together. Screenshot coming in a minute.

Changed 13 years ago by plt

Attachment: perTypeButtons.png added

comment:3 Changed 13 years ago by Mark Ryan

Status: newassigned

Hi Pete

Many thanks - I think the changes are brilliant. The ability to define the inherited values from a list is a feature a couple of people have asked for (unfortunately I've not had too much time lately for this - my firm now uses 'another' ticketing system!) and your changes address their requirements.

I've actually changed the code a bit and I've dropped the 'inherit_milestone' option (it seems superfluous given the generic 'inherit' option).

Being able to see exactly what sub-ticket types can be created is also a great idea (I think the buttons look ok - I might just change the background colour a bit perhaps??)

Thanks again, I'll checkin the changes and make it available as a new release (1.1.0)

Regards Mark

comment:4 Changed 13 years ago by Mark Ryan

(In [9850]) fixes: #8479, #8460, #8311

  • Release 1.1.0
  • 'parent.type.inherit_milestone is no longer supported and replaced with 'inherit = list' option now.
  • 'parent.type.inherit = list' allows you to define a list of inherited fields (including 'summary', 'description' and custom fields)
  • 'parent.type.restrict_child_types = list' now overrides 'default_child_type' and, if used presents a series of buttons for creation of child tickets.
  • If no 'restrict_child_types' list is given in trac.ini, then the default 'Create' button now shows 'New Child Ticket'.
  • Many thanks to Pete 'plt' (see #8479) for his work on this and this contribution.

comment:5 Changed 13 years ago by Mark Ryan

Resolution: fixed
Status: assignedclosed

Version 1.1.0 is now committed and available - please let me know if there are any problems & thanks again for the contribution.

Regards Mark

comment:6 Changed 13 years ago by anonymous

Cc: liltor@… added; anonymous removed

comment:7 Changed 13 years ago by anonymous

Cc: anonymous added; liltor@… removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Mark Ryan.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.