Mercurial > kallithea
comparison rhodecode/templates/changeset/changeset.html @ 1682:1f2ba96de73e beta
#71 code review
- inline comments are now positioned inlines
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 14 Nov 2011 22:10:02 +0200 |
parents | 1bf03daafaf0 |
children | 6ff8bcb783e9 |
comparison
equal
deleted
inserted
replaced
1681:1bf03daafaf0 | 1682:1f2ba96de73e |
---|---|
14 ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} | 14 ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} |
15 </%def> | 15 </%def> |
16 | 16 |
17 <%def name="page_nav()"> | 17 <%def name="page_nav()"> |
18 ${self.menu('changelog')} | 18 ${self.menu('changelog')} |
19 </%def> | |
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 %> | |
19 </%def> | 25 </%def> |
20 | 26 |
21 <%def name="main()"> | 27 <%def name="main()"> |
22 <div class="box"> | 28 <div class="box"> |
23 <!-- box / title --> | 29 <!-- box / title --> |
90 ${_('%s files affected with %s additions and %s deletions.') % (len(c.changeset.affected_files),c.lines_added,c.lines_deleted)} | 96 ${_('%s files affected with %s additions and %s deletions.') % (len(c.changeset.affected_files),c.lines_added,c.lines_deleted)} |
91 </span> | 97 </span> |
92 <div class="cs_files"> | 98 <div class="cs_files"> |
93 %for change,filenode,diff,cs1,cs2,stat in c.changes: | 99 %for change,filenode,diff,cs1,cs2,stat in c.changes: |
94 <div class="cs_${change}"> | 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 <div class="changes">${h.fancy_file_stats(stat)}</div> | 102 <div class="changes">${h.fancy_file_stats(stat)}</div> |
97 </div> | 103 </div> |
98 %endfor | 104 %endfor |
99 % if c.cut_off: | 105 % if c.cut_off: |
100 ${_('Changeset was too big and was cut off...')} | 106 ${_('Changeset was too big and was cut off...')} |
106 | 112 |
107 %for change,filenode,diff,cs1,cs2,stat in c.changes: | 113 %for change,filenode,diff,cs1,cs2,stat in c.changes: |
108 %if change !='removed': | 114 %if change !='removed': |
109 <div style="clear:both;height:10px"></div> | 115 <div style="clear:both;height:10px"></div> |
110 <div class="diffblock margined"> | 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 <div class="changeset_header"> | 118 <div class="changeset_header"> |
113 <span class="changeset_file"> | 119 <span class="changeset_file"> |
114 ${h.link_to_if(change!='removed',h.safe_unicode(filenode.path),h.url('files_home',repo_name=c.repo_name, | 120 ${h.link_to_if(change!='removed',h.safe_unicode(filenode.path),h.url('files_home',repo_name=c.repo_name, |
115 revision=filenode.changeset.raw_id,f_path=h.safe_unicode(filenode.path)))} | 121 revision=filenode.changeset.raw_id,f_path=h.safe_unicode(filenode.path)))} |
116 </span> | 122 </span> |
140 | 146 |
141 <div class="comments"> | 147 <div class="comments"> |
142 <div class="comments-number">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div> | 148 <div class="comments-number">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div> |
143 | 149 |
144 %for path, lines in c.inline_comments: | 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 % for line,comments in lines.iteritems(): | 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 %for co in comments: | 154 %for co in comments: |
149 ${comment.comment_block(co)} | 155 ${comment.comment_block(co)} |
150 %endfor | 156 %endfor |
151 </div> | 157 </div> |
152 %endfor | 158 %endfor |
206 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0]; | 212 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0]; |
207 var f_path = YUD.getAttribute(node,'path'); | 213 var f_path = YUD.getAttribute(node,'path'); |
208 var lineno = getLineNo(tr); | 214 var lineno = getLineNo(tr); |
209 var form = createInlineForm(tr, f_path, lineno); | 215 var form = createInlineForm(tr, f_path, lineno); |
210 YUD.insertAfter(form,tr); | 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 </script> | 237 </script> |
215 </div> | 238 </div> |
216 </%def> | 239 </%def> |