Opened 12 years ago
Closed 4 years ago
#10284 closed enhancement (fixed)
Support Trac 1.0's new custom text field formats "reference", "list"
Reported by: | ejucovy | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | CustomFieldAdminPlugin |
Severity: | normal | Keywords: | |
Cc: | Jun Omae | Trac Release: | 1.0 |
Description (last modified by )
Per #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>
Attachments (1)
Change History (14)
comment:1 Changed 11 years ago by
comment:3 Changed 11 years ago by
All tests passed.
$ python setup.py test running test running egg_info writing requirements to TracCustomFieldAdmin.egg-info/requires.txt writing TracCustomFieldAdmin.egg-info/PKG-INFO writing top-level names to TracCustomFieldAdmin.egg-info/top_level.txt writing dependency_links to TracCustomFieldAdmin.egg-info/dependency_links.txt writing entry points to TracCustomFieldAdmin.egg-info/entry_points.txt writing manifest file 'TracCustomFieldAdmin.egg-info/SOURCES.txt' running build_ext test_create (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_delete (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_delete_unknown_options (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_not_delete_unknown_options_for_modify (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_systeminfo (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_update (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_update_non_existing (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_update_non_existing_no_name (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_update_textarea (customfieldadmin.tests.api.CustomFieldApiTestCase) ... ok test_translation_function (customfieldadmin.tests.api.CustomFieldL10NTestCase) ... ok test_translation_function_tag (customfieldadmin.tests.api.CustomFieldL10NTestCase) ... ok test_add_optional_select (customfieldadmin.tests.admin.CustomFieldAdminPageTestCase) ... ok test_apply_optional_select (customfieldadmin.tests.admin.CustomFieldAdminPageTestCase) ... ok test_create (customfieldadmin.tests.admin.CustomFieldAdminPageTestCase) ... ok ---------------------------------------------------------------------- Ran 14 tests in 0.155s OK
Changed 11 years ago by
Attachment: | support-custom-text-format-for-r13638.patch added |
---|
remake to be able to patch for r13638
comment:4 Changed 11 years ago by
I confirmed the list
and reference
custom format work after I made these fields with attached patch.
Could you review and merge it?
comment:5 Changed 11 years ago by
Cc: | Jun Omae added; anonymous removed |
---|
comment:7 Changed 8 years ago by
I think patched plugin on Trac 0.12.x should show only supported types (reference and list types shouldn't be shown on Trac 0.12.x). If it is difficult to implement with single source, we should create new branch for Trac 1.0.
comment:8 follow-up: 10 Changed 7 years ago by
Will you also then look at the MultiSelectFieldPlugin as it has a .options =
for a text field which this removes. I didn't think I need to create a new ticket for that.
comment:9 Changed 4 years ago by
Description: | modified (diff) |
---|
comment:10 Changed 4 years ago by
Replying to Christiaan:
Will you also then look at the MultiSelectFieldPlugin as it has a
.options =
for a text field which this removes. I didn't think I need to create a new ticket for that.
This will be addressed in trac:#13206.
comment:11 Changed 4 years ago by
Owner: | changed from osimons to Ryan J Ollos |
---|---|
Status: | new → accepted |
comment:13 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I tried to patch this, but it rejected to r13638.