TicketDescriptionTemplates 的 版本 3 与 版本 4 间的差异
- 时间戳:
- 2020-02-26T21:09:22+08:00 (5年 前)
图例:
- 未修改
- 增加
- 删除
- 修改
-
TicketDescriptionTemplates
v3 v4 20 20 } 21 21 #panel th { 22 width: 58px;22 width: 100px; 23 23 text-align: right; 24 24 vertical-align: top; 25 25 padding: 0.4em; 26 } 27 .required-field-label { 28 color: red; 29 font-size: 0.6em; 26 30 } 27 31 </style> … … 38 42 $.cookie("description_panel", value); 39 43 } 40 41 42 44 43 45 function createDescriptionPanel() { … … 48 50 $(description_element).css("display", ""); 49 51 $(description_element).prepend(template); 52 $("table.trac-properties").css("width", "910px"); 53 54 let required_fields = [ 55 'field-summary', 'field-reporter', 'field-type', 'field-component', 56 'field-priority', 'field-severity', 'field-version', 'field-chip' 57 ]; 58 59 for (let i = 0; i < required_fields.length; i++) { 60 let element = $(`label[for='${required_fields[i]}']`); 61 if (element.length != 0) { 62 let text = element.html().replace(':', ''); 63 element.html(`${text} <span class="required-field-label">(必填)</span>:`); 64 } 65 $(`#${required_fields[i]}`).attr("class", "required-field"); 66 } 50 67 51 68 $(".date-picker").datepicker({ 52 69 changeMonth: true, 53 changeYear: true 70 changeYear: true, 71 onClose: function(date_text, picker) { 72 let warning_tip = $(this).parent().find("span.empty-warning"); 73 if (warning_tip.length != 0) 74 warning_tip.remove(); 75 } 54 76 }); 55 77 $(".date-picker").datepicker("option", "dateFormat", "yy-mm-dd"); … … 60 82 61 83 $("#developer-resolve-date").val("[=#developer-resolve-date]"); 84 85 $(".required-field").blur(function(event) { 86 let warning_tip = $(event.target).parent().find("span.empty-warning"); 87 if ($(event.target).val() == "") { 88 if (warning_tip.length == 0) 89 $(event.target).parent().append('<span class="required-field-label empty-warning">内容不能为空</span>'); 90 } else { 91 if (warning_tip.length != 0) 92 warning_tip.remove(); 93 } 94 }); 62 95 63 96 let description_panel = getDescriptionCookie(); … … 76 109 } 77 110 78 function updateDescriptionForServer() { 111 function updateDescriptionForServer(event) { 112 let found_empty_field = false; 113 let required_elements = $(".required-field"); 114 for (let i = 0; i < required_elements.length; i++) { 115 if ($(required_elements.get(i)).val() == "") { 116 found_empty_field = true; 117 break; 118 } 119 } 120 if (found_empty_field) { 121 event.preventDefault(); 122 alert('有必填项为空,请补充'); 123 } 79 124 let data = populateDescription(); 80 125 if (data != null) { … … 84 129 } 85 130 86 $("input:submit[name='preview']").click(function( ) {87 updateDescriptionForServer( );88 }); 89 90 $("input:submit[name='submit']").click(function( ) {91 updateDescriptionForServer( );131 $("input:submit[name='preview']").click(function(event) { 132 updateDescriptionForServer(event); 133 }); 134 135 $("input:submit[name='submit']").click(function(event) { 136 updateDescriptionForServer(event); 92 137 }); 93 138 } … … 131 176 <tbody> 132 177 <tr title="问题描述"> 133 <th><label>问题描述 :</label></th>134 <td colspan="5"><textarea style=""></textarea></td>178 <th><label>问题描述 <span class="required-field-label">(必填)</span>:</label></th> 179 <td colspan="5"><textarea class="required-field"></textarea></td> 135 180 </tr> 136 181 <tr title="问题场景"> 137 <th><label>问题场景 :</label></th>138 <td colspan="5"><textarea ></textarea></td>182 <th><label>问题场景 <span class="required-field-label">(必填)</span>:</label></th> 183 <td colspan="5"><textarea class="required-field"></textarea></td> 139 184 </tr> 140 185 <tr title="复现步骤"> 141 <th><label>复现步骤 :</label></th>142 <td colspan="5"><textarea ></textarea></td>186 <th><label>复现步骤 <span class="required-field-label">(必填)</span>:</label></th> 187 <td colspan="5"><textarea class="required-field"></textarea></td> 143 188 </tr> 144 189 <tr title="出错日志"> … … 151 196 </tr> 152 197 <tr title="问题处理时间段"> 153 <th><label>发现日期 :</label></th>154 <td><input type="text" id="issue-occur-date" class="date-picker "></td>155 <th style="width: 85px;padding-left: 10px;"><label>期望解决日期:</label></th>156 <td><input type="text" id="issue-resolve-date" class="date-picker "></td>198 <th><label>发现日期 <span class="required-field-label">(必填)</span>:</label></th> 199 <td><input type="text" id="issue-occur-date" class="date-picker required-field"></td> 200 <th style="width: 130px;"><label>期望解决日期 <span class="required-field-label">(必填)</span>:</label></th> 201 <td><input type="text" id="issue-resolve-date" class="date-picker required-field"></td> 157 202 <th style="display: none"><label>开发人员预期解决日期:</label></th> 158 203 <td style="display: none"><input type="text" id="developer-resolve-date"></td> 159 204 </tr> 160 205 <tr title="联系人信息"> 161 <th style="width: 72px;"><label>沟通联系人:</label></th>206 <th style="width: 109px;"><label>沟通联系人:</label></th> 162 207 <td><input type="text"></td> 163 208 <th><label>电话:</label></th> 164 209 <td><input type="text"></td> 165 <th ><label>邮箱:</label></th>166 <td><input type="text" ></td>210 <th style="width: 35px"><label>邮箱:</label></th> 211 <td><input type="text" style="width: 160px"></td> 167 212 </tr> 168 213 </tbody> … … 170 215 </fieldset> 171 216 }}} 217 218