##// END OF EJS Templates
#71 code review...
marcink -
r1682:1f2ba96d beta
parent child Browse files
Show More
@@ -3235,7 +3235,7 div.rst-block pre {
3235 3235 }
3236 3236
3237 3237
3238
3238 /** comment main **/
3239 3239 .comments {
3240 3240 padding:10px 20px;
3241 3241 }
@@ -3277,6 +3277,7 div.rst-block pre {
3277 3277 color: #666;
3278 3278 font-size: 16px;
3279 3279 }
3280
3280 3281 /** comment form **/
3281 3282
3282 3283 .comment-form .clearfix{
@@ -3394,4 +3395,55 form.comment-inline-form {
3394 3395
3395 3396 .comment-inline-form .comment-button{
3396 3397 padding-top:5px;
3397 } No newline at end of file
3398 }
3399
3400 /** comment inline **/
3401 .inline-comments {
3402 padding:10px 20px;
3403 }
3404
3405 .inline-comments div.rst-block {
3406 clear:both;
3407 overflow:hidden;
3408 margin:0;
3409 padding:0 20px 0px;
3410 }
3411 .inline-comments .comment {
3412 border: 1px solid #ddd;
3413 -webkit-border-radius: 4px;
3414 -moz-border-radius: 4px;
3415 border-radius: 4px;
3416 margin-left: 5px;
3417 margin-right: 5px;
3418 margin-bottom: 3px;
3419 }
3420
3421 .inline-comments .comment .meta {
3422 background: #f8f8f8;
3423 padding: 6px;
3424 border-bottom: 1px solid #ddd;
3425 }
3426
3427 .inline-comments .comment .meta img {
3428 vertical-align: middle;
3429 }
3430
3431 .inline-comments .comment .meta .user {
3432 font-weight: bold;
3433 }
3434
3435 .inline-comments .comment .meta .date {
3436 float: right;
3437 }
3438
3439 .inline-comments .comment .text {
3440 padding: 8px 6px 6px 14px;
3441 background-color: #FAFAFA;
3442 }
3443
3444 .inline-comments .comments-number{
3445 padding:0px 0px 10px 0px;
3446 font-weight: bold;
3447 color: #666;
3448 font-size: 16px;
3449 }
@@ -304,14 +304,19 var removeInlineForm = function(form) {
304 304 form.parentNode.removeChild(form);
305 305 }
306 306
307 var createInlineForm = function(parent_tr, f_path, line) {
307 var tableTr = function(cls,body){
308 308 var form = document.createElement('tr');
309 YUD.addClass(form, 'comment-form-inline');
309 YUD.addClass(form, cls);
310 form.innerHTML = '<td class="lineno new"></td>'+
311 '<td class="lineno old"></td>'+
312 '<td>{0}</td>'.format(body);
313 return form;
314 }
315
316 var createInlineForm = function(parent_tr, f_path, line) {
310 317 var tmpl = YUD.get('comment-inline-form-template').innerHTML;
311 318 tmpl = tmpl.format(f_path, line);
312 form.innerHTML = '<td class="lineno new"></td>'+
313 '<td class="lineno old"></td>'+
314 '<td>{0}</td>'.format(tmpl);
319 var form = tableTr('comment-form-inline',tmpl)
315 320
316 321 // create event for hide button
317 322 form = new YAHOO.util.Element(form);
@@ -18,6 +18,12
18 18 ${self.menu('changelog')}
19 19 </%def>
20 20
21 <%def name="fid(raw_id,path)" filter="strip">
22 <%
23 return 'C-%s-%s' % (h.short_id(raw_id),h.safeid(h.safe_unicode(path)))
24 %>
25 </%def>
26
21 27 <%def name="main()">
22 28 <div class="box">
23 29 <!-- box / title -->
@@ -92,7 +98,7
92 98 <div class="cs_files">
93 99 %for change,filenode,diff,cs1,cs2,stat in c.changes:
94 100 <div class="cs_${change}">
95 <div class="node">${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor='C-%s-%s' % (h.short_id(filenode.changeset.raw_id),h.safeid(h.safe_unicode(filenode.path)))))}</div>
101 <div class="node">${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=self.fid(filenode.changeset.raw_id,filenode.path)))}</div>
96 102 <div class="changes">${h.fancy_file_stats(stat)}</div>
97 103 </div>
98 104 %endfor
@@ -108,7 +114,7
108 114 %if change !='removed':
109 115 <div style="clear:both;height:10px"></div>
110 116 <div class="diffblock margined">
111 <div id="${'C-%s-%s' % (h.short_id(filenode.changeset.raw_id),h.safeid(h.safe_unicode(filenode.path)))}" class="code-header">
117 <div id="${self.fid(filenode.changeset.raw_id,filenode.path)}" class="code-header">
112 118 <div class="changeset_header">
113 119 <span class="changeset_file">
114 120 ${h.link_to_if(change!='removed',h.safe_unicode(filenode.path),h.url('files_home',repo_name=c.repo_name,
@@ -142,9 +148,9
142 148 <div class="comments-number">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div>
143 149
144 150 %for path, lines in c.inline_comments:
145 <div class="inline-comment-placeholder" path="${path} ">
151 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${self.fid(c.changeset.raw_id,path)}">
146 152 % for line,comments in lines.iteritems():
147 <div class="inline-comment-placeholder-line" line="${line}">
153 <div class="inline-comment-placeholder-line" line="${line}" target_id="${h.safeid(h.safe_unicode(path))}">
148 154 %for co in comments:
149 155 ${comment.comment_block(co)}
150 156 %endfor
@@ -208,7 +214,24
208 214 var lineno = getLineNo(tr);
209 215 var form = createInlineForm(tr, f_path, lineno);
210 216 YUD.insertAfter(form,tr);
211 })
217 });
218
219 // inject comments into they proper positions
220 var file_comments = YUQ('.inline-comment-placeholder');
221
222 for (f in file_comments){
223 var box = file_comments[f];
224 var inlines = box.children;
225
226 for(var i=0; i<inlines.length; i++){
227 var inline = inlines[i];
228 var lineno = YUD.getAttribute(inlines[i],'line');
229 var lineid = "a{0}_{1}".format(YUD.getAttribute(inline,'target_id'),lineno);
230 var target_line = YUD.get(lineid);
231 var comments = new YAHOO.util.Element(tableTr('inline-comments',inline.innerHTML))
232 YUD.insertAfter(comments,target_line.parentNode);
233 }
234 }
212 235 })
213 236
214 237 </script>
General Comments 0
You need to be logged in to leave comments. Login now