annotate rhodecode/templates/changeset/changeset_file_comment.html @ 2369:c2f131502037 beta

Autocomplete fixes - use translation MAP - move translation to top level in order to be used inside rhodecode.js - re-use user and groups data in changesets page
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 01 Jun 2012 23:29:41 +0200
parents 5143b8df576c
children 91fae60bf2b6 f467c75544af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
1 ## -*- coding: utf-8 -*-
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
2 ## usage:
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
4 ## ${comment.comment_block(co)}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
5 ##
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
6 <%def name="comment_block(co)">
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
7 <div class="comment" id="comment-${co.comment_id}" line="${co.line_no}">
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
8 <div class="comment-wrapp">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
9 <div class="meta">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
10 <span class="user">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
11 <img src="${h.gravatar_url(co.author.email, 20)}" />
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
12 ${co.author.username}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
13 </span>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
14 <span class="date">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
15 ${h.age(co.modified_at)}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
16 </span>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
17 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
18 <span class="buttons">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
19 <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
20 </span>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
21 %endif
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
22 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
23 <div class="text">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
24 ${h.rst_w_mentions(co.text)|n}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
25 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
26 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
27 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
28 </%def>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
29
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
30
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
31 <%def name="comment_inline_form(changeset)">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
32 <div id='comment-inline-form-template' style="display:none">
2369
c2f131502037 Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2368
diff changeset
33 <div class="comment-inline-form ac">
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
34 %if c.rhodecode_user.username != 'default':
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
35 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
36 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id),class_='inline-form')}
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
37 <div class="clearfix">
2307
d2043c703f84 Fixed i18n of the second comment help block.
Vincent Duvert <vincent@duvert.net>
parents: 2302
diff changeset
38 <div class="comment-help">${_('Commenting on line {1}.')}
d2043c703f84 Fixed i18n of the second comment help block.
Vincent Duvert <vincent@duvert.net>
parents: 2302
diff changeset
39 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
2302
66fa6c434ce4 Improved i18n of the changeset inline comment section.
Vincent Duvert <vincent@duvert.net>
parents: 2189
diff changeset
40 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
2368
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
41 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
42 </div>
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
43 <div class="mentions-container" id="mentions_container_{1}"></div>
2369
c2f131502037 Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2368
diff changeset
44 <textarea id="text_{1}" name="text" class="yui-ac-input"></textarea>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
45 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
46 <div class="comment-button">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
47 <input type="hidden" name="f_path" value="{0}">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
48 <input type="hidden" name="line" value="{1}">
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
49 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
50 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
51 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
52 ${h.end_form()}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
53 %else:
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
54 ${h.form('')}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
55 <div class="clearfix">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
56 <div class="comment-help">
2302
66fa6c434ce4 Improved i18n of the changeset inline comment section.
Vincent Duvert <vincent@duvert.net>
parents: 2189
diff changeset
57 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
58 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
59 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
60 <div class="comment-button">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
61 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
62 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
63 ${h.end_form()}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
64 %endif
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
65 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
66 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
67 </%def>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
68
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
69
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
70 <%def name="inlines(changeset)">
2310
83e4447077d3 Improved i18n for the comment count (use of ngettext for pluralisation).
Vincent Duvert <vincent@duvert.net>
parents: 2307
diff changeset
71 <div class="comments-number">${ungettext("%d comment", "%d comments", len(c.comments)) % len(c.comments)} ${ungettext("(%d inline)", "(%d inline)", c.inline_cnt) % c.inline_cnt}</div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
72 %for path, lines in c.inline_comments:
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
73 % for line,comments in lines.iteritems():
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
74 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
75 %for co in comments:
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
76 ${comment_block(co)}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
77 %endfor
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
78 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
79 %endfor
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
80 %endfor
2188
56e96d4e9f6e white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
81
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
82 </%def>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
83
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
84 <%def name="comments(changeset)">
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
85
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
86 <div class="comments">
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
87 <div id="inline-comments-container">
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
88 ${inlines(changeset)}
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 1888
diff changeset
89 </div>
2188
56e96d4e9f6e white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
90
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
91 %for co in c.comments:
2189
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2188
diff changeset
92 <div id="comment-tr-${co.comment_id}">
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2188
diff changeset
93 ${comment_block(co)}
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2188
diff changeset
94 </div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
95 %endfor
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
96 %if c.rhodecode_user.username != 'default':
2368
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
97 <div class="comment-form ac">
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
98 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id))}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
99 <strong>${_('Leave a comment')}</strong>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
100 <div class="clearfix">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
101 <div class="comment-help">
2307
d2043c703f84 Fixed i18n of the second comment help block.
Vincent Duvert <vincent@duvert.net>
parents: 2302
diff changeset
102 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
d2043c703f84 Fixed i18n of the second comment help block.
Vincent Duvert <vincent@duvert.net>
parents: 2302
diff changeset
103 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
d2043c703f84 Fixed i18n of the second comment help block.
Vincent Duvert <vincent@duvert.net>
parents: 2302
diff changeset
104 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
105 </div>
2368
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
106 <div class="mentions-container" id="mentions_container"></div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
107 ${h.textarea('text')}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
108 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
109 <div class="comment-button">
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
110 ${h.submit('save', _('Comment'), class_='ui-button')}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
111 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
112 ${h.end_form()}
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
113 </div>
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
114 %endif
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
115 </div>
2368
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
116 <script>
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
117 YUE.onDOMReady(function () {
2369
c2f131502037 Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2368
diff changeset
118 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
2368
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
119 });
5143b8df576c Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents: 2310
diff changeset
120 </script>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1860
diff changeset
121 </%def>