comparison rhodecode/templates/changeset/changeset_file_comment.html @ 2187:b61e540122f2 beta

#415: Adding comment to changeset causes reload - comments are now added via ajax and doesn't reload the page
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 14 Apr 2012 22:13:07 +0200
parents f91d3f9b7230
children 56e96d4e9f6e
comparison
equal deleted inserted replaced
2186:7b52c2351231 2187:b61e540122f2
2 ## usage: 2 ## usage:
3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> 3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
4 ## ${comment.comment_block(co)} 4 ## ${comment.comment_block(co)}
5 ## 5 ##
6 <%def name="comment_block(co)"> 6 <%def name="comment_block(co)">
7 <div class="comment" id="comment-${co.comment_id}"> 7 <div class="comment" id="comment-${co.comment_id}" line="${co.line_no}">
8 <div class="comment-wrapp"> 8 <div class="comment-wrapp">
9 <div class="meta"> 9 <div class="meta">
10 <span class="user"> 10 <span class="user">
11 <img src="${h.gravatar_url(co.author.email, 20)}" /> 11 <img src="${h.gravatar_url(co.author.email, 20)}" />
12 ${co.author.username} 12 ${co.author.username}
30 30
31 <%def name="comment_inline_form(changeset)"> 31 <%def name="comment_inline_form(changeset)">
32 <div id='comment-inline-form-template' style="display:none"> 32 <div id='comment-inline-form-template' style="display:none">
33 <div class="comment-inline-form"> 33 <div class="comment-inline-form">
34 %if c.rhodecode_user.username != 'default': 34 %if c.rhodecode_user.username != 'default':
35 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id))} 35 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
36 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id),class_='inline-form')}
36 <div class="clearfix"> 37 <div class="clearfix">
37 <div class="comment-help">${_('Commenting on line')} {1}. ${_('Comments parsed using')} 38 <div class="comment-help">${_('Commenting on line')} {1}. ${_('Comments parsed using')}
38 <a href="${h.url('rst_help')}">RST</a> ${_('syntax')} ${_('with')} 39 <a href="${h.url('rst_help')}">RST</a> ${_('syntax')} ${_('with')}
39 <span style="color:#003367" class="tooltip" title="${_('Use @username inside this text to send notification to this RhodeCode user')}">@mention</span> ${_('support')} 40 <span style="color:#003367" class="tooltip" title="${_('Use @username inside this text to send notification to this RhodeCode user')}">@mention</span> ${_('support')}
40 </div> 41 </div>
41 <textarea id="text_{1}" name="text"></textarea> 42 <textarea id="text_{1}" name="text"></textarea>
42 </div> 43 </div>
43 <div class="comment-button"> 44 <div class="comment-button">
44 <input type="hidden" name="f_path" value="{0}"> 45 <input type="hidden" name="f_path" value="{0}">
45 <input type="hidden" name="line" value="{1}"> 46 <input type="hidden" name="line" value="{1}">
46 ${h.submit('save', _('Comment'), class_='ui-btn')} 47 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
47 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')} 48 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
48 </div> 49 </div>
49 ${h.end_form()} 50 ${h.end_form()}
50 %else: 51 %else:
51 ${h.form('')} 52 ${h.form('')}
62 </div> 63 </div>
63 </div> 64 </div>
64 </%def> 65 </%def>
65 66
66 67
67 <%def name="comments(changeset)"> 68 <%def name="inlines(changeset)">
68
69 <div class="comments">
70 <div class="comments-number">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div> 69 <div class="comments-number">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div>
71
72 %for path, lines in c.inline_comments: 70 %for path, lines in c.inline_comments:
73 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.FID(changeset.raw_id,path)}">
74 % for line,comments in lines.iteritems(): 71 % for line,comments in lines.iteritems():
75 <div class="inline-comment-placeholder-line" line="${line}" target_id="${h.safeid(h.safe_unicode(path))}"> 72 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
76 %for co in comments: 73 %for co in comments:
77 ${comment_block(co)} 74 ${comment_block(co)}
78 %endfor 75 %endfor
79 </div> 76 </div>
80 %endfor 77 %endfor
81 </div>
82 %endfor 78 %endfor
79
80 </%def>
83 81
82 <%def name="comments(changeset)">
83
84 <div class="comments">
85 <div id="inline-comments-container">
86 ${inlines(changeset)}
87 </div>
88
84 %for co in c.comments: 89 %for co in c.comments:
85 ${comment_block(co)} 90 ${comment_block(co)}
86 %endfor 91 %endfor
87 %if c.rhodecode_user.username != 'default': 92 %if c.rhodecode_user.username != 'default':
88 <div class="comment-form"> 93 <div class="comment-form">