comparison rhodecode/templates/changeset/changeset.html @ 1677:7276b170ce8b beta

#71 code-review - simple inline comments
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 13 Nov 2011 02:16:12 +0200
parents e86191684f4b
children 1bf03daafaf0
comparison
equal deleted inserted replaced
1676:e86191684f4b 1677:7276b170ce8b
112 <div class="changeset_header"> 112 <div class="changeset_header">
113 <span class="changeset_file"> 113 <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, 114 ${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)))} 115 revision=filenode.changeset.raw_id,f_path=h.safe_unicode(filenode.path)))}
116 </span> 116 </span>
117 %if 1:
118 &raquo; <span>${h.link_to(_('diff'), 117 &raquo; <span>${h.link_to(_('diff'),
119 h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff'))}</span> 118 h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff'))}</span>
120 &raquo; <span>${h.link_to(_('raw diff'), 119 &raquo; <span>${h.link_to(_('raw diff'),
121 h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw'))}</span> 120 h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw'))}</span>
122 &raquo; <span>${h.link_to(_('download diff'), 121 &raquo; <span>${h.link_to(_('download diff'),
123 h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download'))}</span> 122 h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download'))}</span>
124 %endif
125 </div> 123 </div>
126 </div> 124 </div>
127 <div class="code-body"> 125 <div class="code-body">
128 %if diff: 126 <div class="full_f_path" path="${filenode.path}"></div>
129 ${diff|n} 127 %if diff:
130 %else: 128 ${diff|n}
131 ${_('No changes in this file')} 129 %else:
132 %endif 130 ${_('No changes in this file')}
131 %endif
133 </div> 132 </div>
134 </div> 133 </div>
135 %endif 134 %endif
136 %endfor 135 %endfor
137 136
138 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> 137 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
138 ## template for inline comment form
139 ${comment.comment_inline_form()}
139 140
140 <div class="comments"> 141 <div class="comments">
141 <div class="comments-number">${len(c.comments)} comment(s)</div> 142 <div class="comments-number">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div>
143
144 %for path, lines in c.inline_comments:
145 <div class="inline-comment-placeholder" path="${path} ">
146 % for line,comments in lines.iteritems():
147 <div class="inline-comment-placeholder-line" line="${line}">
148 %for co in comments:
149 ${comment.comment_block(co)}
150 %endfor
151 </div>
152 %endfor
153 </div>
154 %endfor
155
142 %for co in c.comments: 156 %for co in c.comments:
143 ${comment.comment_block(co)} 157 ${comment.comment_block(co)}
144 %endfor 158 %endfor
145 %if c.rhodecode_user.username != 'default': 159 %if c.rhodecode_user.username != 'default':
146 <div class="comment-form"> 160 <div class="comment-form">
147 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=c.changeset.raw_id))} 161 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=c.changeset.raw_id))}
148 <strong>Leave a comment</strong> 162 <strong>${_('Leave a comment')}</strong>
149 <div class="clearfix"> 163 <div class="clearfix">
150 <div class="comment-help">${_('Comments parsed using RST syntax')}</div> 164 <div class="comment-help">${_('Comments parsed using RST syntax')}</div>
151 ${h.textarea('text')} 165 ${h.textarea('text')}
152 </div> 166 </div>
153 <div class="comment-button"> 167 <div class="comment-button">
165 var success = function(o){ 179 var success = function(o){
166 var n = YUD.get('comment-'+comment_id); 180 var n = YUD.get('comment-'+comment_id);
167 n.parentNode.removeChild(n); 181 n.parentNode.removeChild(n);
168 } 182 }
169 ajaxPOST(url,postData,success); 183 ajaxPOST(url,postData,success);
170 } 184 }
185
186 YUE.onDOMReady(function(){
187 YUE.on(YUQ('.line'),'mouseenter',function(e){
188 var tr = e.currentTarget;
189 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context')){
190 return
191 }
192 YUD.addClass(tr,'highlight');
193 });
194 YUE.on(YUQ('.line'),'mouseleave',function(e){
195 YUD.removeClass(e.currentTarget,'highlight');
196 });
197
198 YUE.on(YUQ('.line'),'click',function(e){
199 var tr = e.currentTarget;
200 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context')){
201 return
202 }
203 YUD.addClass(tr,'form-open');
204 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0];
205 var f_path = YUD.getAttribute(node,'path');
206 var lineno = getLineNo(tr);
207 var form = createInlineForm(tr, f_path, lineno);
208 YUD.insertAfter(form,tr);
209 })
210 })
211
171 </script> 212 </script>
172 </div> 213 </div>
173 </%def> 214 </%def>