Version 3 (modified by 5年 ago) (diff) | ,
---|
Ticket 问题描述模板定义规则
按照下面的格式定义:
- 使用== 开头定义模板名字,这个名字会显示在模板选择列表里
- 使用{{{、}}}将模板内容包含起来,模板内容可以是任意符合wiki语法的文本
== 模板名字 {{{ 模板内容 }}}
补丁申请模板(html)
<!-- html template --> <style type="text/css"> #panel textarea { margin: 2px; height: 85px; } #panel th { width: 58px; text-align: right; vertical-align: top; padding: 0.4em; } </style> <script type="text/javascript"> function clearDescriptionCookie() { $.cookie("description_panel", ""); } function getDescriptionCookie() { return $.cookie("description_panel"); } function setDescriptionCookie(value) { $.cookie("description_panel", value); } function createDescriptionPanel() { let template = '<fieldset id="panel">' + $("#panel").html() + "</fieldset>"; $("#panel").remove(); let description_element = $("label#field-description-help").parent(); $(description_element).children().css("display", "none"); $(description_element).css("display", ""); $(description_element).prepend(template); $(".date-picker").datepicker({ changeMonth: true, changeYear: true }); $(".date-picker").datepicker("option", "dateFormat", "yy-mm-dd"); if (window.location.href.split(window.location.host)[1] != $("#propertyform").attr("action")) { clearDescriptionCookie(); } $("#developer-resolve-date").val("[=#developer-resolve-date]"); let description_panel = getDescriptionCookie(); if (description_panel != undefined && description_panel != "") { let panel_info = JSON.parse(description_panel); $("#panel table label").each(function(index, element) { let text_element = $(element).parent().next("td").find("input:text")[0]; if (text_element == undefined) { text_element = $(element).parent().next("td").find("textarea")[0]; } if ($(text_element).attr("class") != undefined && $(text_element).attr("class").match(/date-picker/) != null) $(text_element).datepicker("setDate", panel_info[index]); else $(text_element).val(panel_info[index]); }); } function updateDescriptionForServer() { let data = populateDescription(); if (data != null) { setDescriptionCookie(data.panel_info); $("#field-description").val(data.description); } } $("input:submit[name='preview']").click(function() { updateDescriptionForServer(); }); $("input:submit[name='submit']").click(function() { updateDescriptionForServer(); }); } function populateDescription() { let boundary = "|------"; let panel_info = []; let description = ""; $("#panel tr").each(function(index, element) { let labels = $(element).find("th label"); let row_data = []; let title = $(element).attr("title"); description += "== " + title + "\n"; if (labels.length == 1) { let value = $(element).find("td").children("input:text").val(); if (value == undefined) { value = $(element).find("td").children("textarea").val(); } if (title == "出错日志") description += "{{{\n" + value + "\n}}}\n"; else description += value + "\n"; panel_info.push(value); } else { let values = $(element).find("td input:text"); for (let i = 0; i < labels.length; i++) { let input_val = $(values.get(i)).val(); description += "- " + $(labels.get(i)).text() + input_val + "\n"; panel_info.push(input_val); } } description += boundary + "\n"; }); return {panel_info: JSON.stringify(panel_info), description: description}; } </script> <fieldset id="panel"> <table> <tbody> <tr title="问题描述"> <th><label>问题描述:</label></th> <td colspan="5"><textarea style=""></textarea></td> </tr> <tr title="问题场景"> <th><label>问题场景:</label></th> <td colspan="5"><textarea></textarea></td> </tr> <tr title="复现步骤"> <th><label>复现步骤:</label></th> <td colspan="5"><textarea></textarea></td> </tr> <tr title="出错日志"> <th><label>出错日志:</label></th> <td colspan="5"><textarea></textarea></td> </tr> <tr title="初步定位"> <th><label>初步定位:</label></th> <td colspan="5"><textarea></textarea></td> </tr> <tr title="问题处理时间段"> <th><label>发现日期:</label></th> <td><input type="text" id="issue-occur-date" class="date-picker"></td> <th style="width: 85px;padding-left: 10px;"><label>期望解决日期:</label></th> <td><input type="text" id="issue-resolve-date" class="date-picker"></td> <th style="display: none"><label>开发人员预期解决日期:</label></th> <td style="display: none"><input type="text" id="developer-resolve-date"></td> </tr> <tr title="联系人信息"> <th style="width: 72px;"><label>沟通联系人:</label></th> <td><input type="text"></td> <th><label>电话:</label></th> <td><input type="text"></td> <th><label>邮箱:</label></th> <td><input type="text"></td> </tr> </tbody> </table> </fieldset>
附件 (1)
- toolbar.png (1.0 KB) - added by 5年 ago.
Download all attachments as: .zip