Opened 12 years ago
Last modified 4 years ago
#10284 closed enhancement
Support Trac 1.0's new custom text field formats "reference", "list" — at Initial Version
Reported by: | ejucovy | Owned by: | osimons |
---|---|---|---|
Priority: | normal | Component: | CustomFieldAdminPlugin |
Severity: | normal | Keywords: | |
Cc: | Jun Omae | Trac Release: | 1.0 |
Description
Per http://trac.edgewall.org/ticket/10643 Trac 1.0 will support two new formats for custom text fields: reference (query-able value) and list (list of query-able values, like keywords)
This patch adds support for these new options in customfieldadmin's Admin UI:
Index: customfieldadmin/admin.py =================================================================== --- customfieldadmin/admin.py (revision 11937) +++ customfieldadmin/admin.py (working copy) @@ -48,8 +48,8 @@ req.args.get('options','').split("\n")], 'cols': req.args.get('cols','').encode('utf-8'), 'rows': req.args.get('rows','').encode('utf-8'), - 'order': req.args.get('order', '').encode('utf-8'), - 'format': req.args.get('format', '').encode('utf-8')} + 'order': req.args.get('order', '').encode('utf-8')} + cfield['format'] = req.args.get('format-%s' % cfield['type'], '').encode('utf-8') return cfield cf_api = CustomFields(self.env) Index: customfieldadmin/tests/admin.py =================================================================== --- customfieldadmin/tests/admin.py (revision 11937) +++ customfieldadmin/tests/admin.py (working copy) @@ -42,7 +42,7 @@ 'name': "test", 'type': "textarea", 'label': "testing", - 'format': "wiki", + 'format-textarea': "wiki", 'row': '9', 'columns': '42'}) try: Index: customfieldadmin/htdocs/js/customfieldadmin.js =================================================================== --- customfieldadmin/htdocs/js/customfieldadmin.js (revision 11937) +++ customfieldadmin/htdocs/js/customfieldadmin.js (working copy) @@ -8,23 +8,23 @@ function label(property){ return $(property).parents('div.field')} switch (type_element.selectedIndex) { case 0: // text - label('#options, #cols, #rows').hide(); - label('#format').show(); + label('#options, #cols, #rows, .format').hide(); + label('#format-text').show(); break; case 1: // select label('#options').show(); - label('#cols, #rows, #format').hide(); + label('#cols, #rows, .format').hide(); break; case 2: // checkbox - label('#options, #cols, #rows, #format').hide(); + label('#options, #cols, #rows, .format').hide(); break; case 3: // radio label('#options').show(); - label('#cols, #rows, #format').hide(); + label('#cols, #rows, .format').hide(); break; case 4: // textarea - label('#options').hide(); - label('#cols, #rows, #format').show(); + label('#options, .format').hide(); + label('#cols, #rows, #format-textarea').show(); break; } } Index: customfieldadmin/templates/customfieldadmin.html =================================================================== --- customfieldadmin/templates/customfieldadmin.html (revision 11937) +++ customfieldadmin/templates/customfieldadmin.html (working copy) @@ -47,8 +47,17 @@ </label> </div> <div class="field"> - <label>Format (Text or Textarea):<br /> - <select name="format" id="format"> + <label>Format (Text):<br /> + <select name="format-text" id="format-text" class="format"> + <option py:for="format in ['plain', 'wiki', 'reference', 'list']" value="${format}" + selected="${cfield.format==format and 'selected' or None}"> + ${format.capitalize()}</option> + </select> + </label> + </div> + <div class="field"> + <label>Format (Textarea):<br /> + <select name="format-textarea" id="format-textarea" class="format"> <option py:for="format in ['plain', 'wiki']" value="${format}" selected="${cfield.format==format and 'selected' or None}"> ${format.capitalize()}</option> @@ -108,7 +117,15 @@ </div> <div class="field"> <label>Format:<br /> - <select name="format" id="format"> + <select name="format-text" id="format-text" class="format"> + <option py:for="format in ['plain', 'wiki', 'reference', 'list']" + value="${format}">${format.capitalize()}</option> + </select> + </label> + </div> + <div class="field"> + <label>Format:<br /> + <select name="format-textarea" id="format-textarea" class="format"> <option py:for="format in ['plain', 'wiki']" value="${format}">${format.capitalize()}</option> </select>
Note: See
TracTickets for help on using
tickets.