Ticket #2647: disable-or-ticket-2647-r8661.patch
| File disable-or-ticket-2647-r8661.patch, 2.5 KB (added by ebray, 3 years ago) |
|---|
-
trac/ticket/templates/query.html
122 122 </tr> 123 123 </tbody> 124 124 125 <tbody py:with="last_clause = clause_num == len(clauses) - 1">125 <tbody py:with="last_clause = clause_num == (len(clauses) or 1) - 1"> 126 126 <tr class="actions"> 127 127 <td class="and" colspan="2"> 128 128 <label for="add_filter_${clause_num}">And</label> -
trac/htdocs/js/query.js
33 33 var ctbody = table.closest("tbody"); 34 34 if (table.children().length > 2 || !ctbody.siblings().length) { 35 35 tbody.remove(); 36 if (!ctbody.siblings().length && table.children().length == 1) { 37 $("#add_clause").attr("disabled", true); 38 } 36 39 } else { 37 40 var add_clause = $("#add_clause", ctbody); 38 41 if (add_clause.length) … … 219 222 this.options[this.selectedIndex].disabled = true; 220 223 221 224 this.selectedIndex = 0; 225 226 // Enable the Or... button if it's been disabled 227 $("#add_clause").attr("disabled", false); 222 228 }).next("div.inlinebuttons").remove(); 223 229 224 230 // Add a new empty clause at the end by cloning the current last clause … … 229 235 tbody = tbody.parents("tbody").eq(0); 230 236 var copy = tbody.clone(true); 231 237 $(button).closest("td").next().attr("colSpan", 4).end().remove(); 232 $("t d.trac-clause-sep", copy).parent().removeAttr("style");238 $("tr:first", copy).removeAttr("style"); 233 239 $("tr tbody:not(:last)", copy).remove(); 234 240 var newId = "add_filter_" + clauseNum; 235 241 $("select", copy).attr("id", newId).attr("name", newId) 236 242 .children().enable().end() 237 243 .prev().attr("for", newId); 238 244 tbody.after(copy); 245 $("#add_clause").attr("disabled", true); 239 246 } 240 247 241 248 // Make the button for adding a clause a client-side trigger … … 246 253 addClause(this); 247 254 return false; 248 255 })); 256 if (!add_clause.closest("tbody").siblings().length) { 257 // That is, if there are no filters added to this clause 258 add_clause.attr("disabled", true); 259 } 249 260 } 250 261 251 262 })(jQuery);
