Ticket #454: ticket-edit-minor-fixes-r8561.diff
| File ticket-edit-minor-fixes-r8561.diff, 7.6 KB (added by cboos, 2 years ago) |
|---|
-
trac/htdocs/css/ticket.css
#454: a few minor enhancements - cosmetic changes for the comment editor, which is now aligned with the preview and other comments - don't show the ''Add comment'' and regular field modification form when editing a comment - add a helper `comment_is_edited` variable in the template diff --git a/trac/htdocs/css/ticket.css b/trac/htdocs/css/ticket.css
a b 73 73 float: right; 74 74 position: relative; 75 75 bottom: 0.3em; 76 margin-left: 0.2em; 76 77 } 77 78 78 79 #changelog { border: 1px outset #996; padding: 1em } 79 #trac-edited_comment { margin-left: -1px; margin-right: -1px; width: 100% } 80 #changelog .wikitoolbar { margin-left: -1px } 80 #trac-comment-editor { margin-left: 2em; } 81 81 #preview { border: 1px solid #d7d7d7; padding: 1em } 82 82 #preview h3, #changelog h3 { 83 83 border-bottom: 1px solid #d7d7d7; … … 85 85 font-size: 100%; 86 86 font-weight: normal; 87 87 } 88 .threading, #changelog .inlinebuttons { float: right; } 88 .threading, #changelog .inlinebuttons { 89 float: right; 90 margin-left: 0.2em; 91 } 89 92 .threading { font-size: 85%; } 90 93 91 94 #preview .changes, #changelog .changes { list-style: square; margin-left: 2em; padding: 0 } -
trac/ticket/templates/ticket.html
diff --git a/trac/ticket/templates/ticket.html b/trac/ticket/templates/ticket.html
a b 49 49 </py:def> 50 50 51 51 <py:def function="display_change(change)"> 52 <ul py:if="change.fields" class="changes"> 53 <li py:for="field_name, field in change.fields.items()"> 54 <strong>${field_labels[field_name]}</strong> 55 <py:choose> 56 <py:when test="field_name == 'attachment'"> 57 <a href="${href.attachment('ticket', ticket.id, field.new)}"><em>${field.new}</em></a> 58 <a href="${href('raw-attachment', 'ticket', ticket.id, field.new)}" 59 title="${_('Download')}" class="trac-rawlink"><img src="${chrome.htdocs_location}download.png" alt="${_('Download')}"/></a> 60 added 61 </py:when> 62 <py:when test="'rendered' in field">${field.rendered}</py:when> 63 <py:when test="field.old and field.new"> 64 changed from <em>${field.old}</em> to <em>${field.new}</em> 65 </py:when> 66 <py:when test="not field.old and field.new"> 67 set to <em>${field.new}</em> 68 </py:when> 69 <py:otherwise> 70 <em>${field.old}</em> deleted 71 </py:otherwise> 72 </py:choose> 73 </li> 74 </ul> 75 <div py:if="'comment' in change and (str(change.cnum) != cnum_edit or edited_comment is not None)" 76 class="comment searchable ${str(change.cnum) == cnum_edit and 'ticketdraft' or None}" xml:space="preserve"> 77 ${wiki_to_html(context, [change.comment, edited_comment][str(change.cnum) == cnum_edit], escape_newlines=preserve_newlines)} 78 </div> 52 <py:with vars="comment_is_edited = str(change.cnum) == cnum_edit"> 53 <ul py:if="change.fields" class="changes"> 54 <li py:for="field_name, field in change.fields.items()"> 55 <strong>${field_labels[field_name]}</strong> 56 <py:choose> 57 <py:when test="field_name == 'attachment'"> 58 <a href="${href.attachment('ticket', ticket.id, field.new)}"><em>${field.new}</em></a> 59 <a href="${href('raw-attachment', 'ticket', ticket.id, field.new)}" 60 title="${_('Download')}" class="trac-rawlink"><img src="${chrome.htdocs_location}download.png" alt="${_('Download')}"/></a> 61 added 62 </py:when> 63 <py:when test="'rendered' in field">${field.rendered}</py:when> 64 <py:when test="field.old and field.new"> 65 changed from <em>${field.old}</em> to <em>${field.new}</em> 66 </py:when> 67 <py:when test="not field.old and field.new"> 68 set to <em>${field.new}</em> 69 </py:when> 70 <py:otherwise> 71 <em>${field.old}</em> deleted 72 </py:otherwise> 73 </py:choose> 74 </li> 75 </ul> 76 <div py:if="'comment' in change and (not comment_is_edited or edited_comment is not None)" 77 class="comment searchable ${comment_is_edited and 'ticketdraft' or None}" xml:space="preserve"> 78 ${wiki_to_html(context, (change.comment, edited_comment)[comment_is_edited], escape_newlines=preserve_newlines)} 79 </div> 80 </py:with> 79 81 </py:def> 80 82 81 83 <div id="content" class="ticket" … … 216 218 <h2>Change History</h2> 217 219 <div id="changelog"> 218 220 <py:for each="change in changes"> 219 <div class="change" >221 <div class="change" py:with="comment_is_edited = str(change.cnum) == cnum_edit"> 220 222 <h3 class="change"> 221 223 <span class="threading" py:if="'cnum' in change" 222 224 py:with="change_replies = replies.get(str(change.cnum), [])"> … … 234 236 </span> 235 237 <i18n:msg params="date, author">Changed ${dateinfo(change.date)} ago by ${authorinfo(change.author)}</i18n:msg> 236 238 </h3> 237 <div py:if="not (can_edit_comment and str(change.cnum) == cnum_edit)" class="inlinebuttons">239 <div py:if="not (can_edit_comment and comment_is_edited)" class="inlinebuttons"> 238 240 <form py:if="'cnum' in change and can_append" 239 241 method="get" action="#comment" class="inlinebuttons"> 240 242 <div> … … 251 253 </form> 252 254 </div> 253 255 ${display_change(change)} 254 <form py:if="can_edit_comment and str(change.cnum) == cnum_edit" method="post" action="#comment:${change.cnum}">256 <form id="trac-comment-editor" py:if="can_edit_comment and comment_is_edited" method="post" action="#comment:${change.cnum}"> 255 257 <div> 256 <textarea id="trac-edited_comment"name="edited_comment" class="wikitext" rows="10" cols="78">258 <textarea name="edited_comment" class="wikitext" rows="10" cols="78"> 257 259 ${[edited_comment, change.comment][edited_comment is None]}</textarea> 258 260 <input type="hidden" name="cnum_edit" value="${change.cnum}"/> 259 <input type="submit" name="preview_comment" value="${_('Preview')}" title= 'Preview changes to comment ${change.cnum}'/>261 <input type="submit" name="preview_comment" value="${_('Preview')}" title="Preview changes to comment ${change.cnum}"/> 260 262 <input type="submit" name="edit_comment" value="${_('Submit changes')}" title="Submit changes to comment ${change.cnum}"/> 261 263 <input type="submit" name="cancel_comment" value="${_('Cancel')}" title="Cancel comment edit"/> 262 264 </div> … … 268 270 </py:if> 269 271 <!--! End of the section we don't show on initial new tickets --> 270 272 271 <form py:if="not version and version != 0 and (can_append or can_modify or can_edit or can_create)"273 <form py:if="not version and version != 0 and not cnum_edit and (can_append or can_modify or can_edit or can_create)" 272 274 action="${ticket.exists and href.ticket(ticket.id) or href.newticket()}" method="post" id="propertyform"> 273 275 <h3 py:if="ticket.exists"><a id="edit" onfocus="$('#comment').get(0).focus()"> 274 276 Add/Change #${ticket.id} ($ticket.summary)</a></h3>
