#6277 closed defect (wontfix)
Adding new custom field OUTSIDE of ticket properties
Reported by: | Connie | Owned by: | Jonas Borgström |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | 0.10.4 |
Severity: | major | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Hi, I am just wondering if somebody can help me with this. I am trying to add 2 custom fields called "URL" and "Steps to Reproduce" OUTSIDE of the "Ticket Properties" form. (which means I cannot just add the field through [ticket_custom] in the ini file as suggested here: http://trac.edgewall.org/wiki/TracTicketsCustomFields). This is what I have done so far:
1) Copied the newticket.cs and ticket.cs files from the \share\trac\templates directory to my project directory (\my-project\templates) and added those two fields as follows:
<tr>
<th><label for="url">URL:</label></th> <td class="fullrow" colspan="3"><input type="text" value="<?cs
var:ticket.url ?>" id="url" name="url" size="70" /></td>
</tr> <tr>
<th><label for="reproduce">Steps to Reproduce:</label></th> <td class="fullrow" colspan="3"> <textarea id = "reproduce" name="reproduce" class="wikitext" rows="10" cols = "68" /> <?cs var:ticket.reproduce ?></textarea></td>
</tr>
My question is do I need to create some kind of script so that these custom fields will actually be saved in the database? They are being added to the UI, but they are really not doing anything. Help!
Thanks Connie
Attachments (1)
Change History (4)
comment:1 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 17 years ago
Sorry, the full diff should be:
-
trac/ticket/web_ui.py
164 164 name = field['name'] 165 165 del field['name'] 166 166 if name in ('summary', 'reporter', 'description', 'type', 'status', 167 'resolution' ):167 'resolution', 'url', 'reproduce'): 168 168 field['skip'] = True 169 169 elif name == 'owner': 170 170 field['label'] = 'Assign to' … … 596 596 name = field['name'] 597 597 del field['name'] 598 598 if name in ('summary', 'reporter', 'description', 'type', 'status', 599 'resolution', 'owner' ):599 'resolution', 'owner', 'url', 'reproduce'): 600 600 field['skip'] = True 601 601 req.hdf['ticket.fields.' + name] = field
You could also add code directly to the templates to skip those fields, but I think this way might be easier.
by , 17 years ago
Attachment: | Ticket 6277.doc added |
---|
Screenshot of VIEW TICKET and PREVIEW TICKET page
comment:3 by , 17 years ago
This works out perfect! Thanks! Please ignore my screen-shot. I think your 2nd posting fixed my problem! Many thanks!
Yes, Trac would have to know that the fields exist. The CS templates just display things—Trac can't divine from them added functionality, so this isn't really a problem with Trac.
Here's something you could do though:
trac/ticket/web_ui.py
):