##// END OF EJS Templates
Improved i18n for the comment count (use of ngettext for pluralisation).
Vincent Duvert -
r2310:83e44470 beta
parent child Browse files
Show More
@@ -1,164 +1,164
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3 <%inherit file="/base/base.html"/>
3 <%inherit file="/base/base.html"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 ${c.repo_name} ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} - ${c.rhodecode_name}
6 ${c.repo_name} ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} - ${c.rhodecode_name}
7 </%def>
7 </%def>
8
8
9 <%def name="breadcrumbs_links()">
9 <%def name="breadcrumbs_links()">
10 ${h.link_to(u'Home',h.url('/'))}
10 ${h.link_to(u'Home',h.url('/'))}
11 &raquo;
11 &raquo;
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
13 &raquo;
13 &raquo;
14 ${_('Changeset')} - <span class='hash'>r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}</span>
14 ${_('Changeset')} - <span class='hash'>r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}</span>
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>
19 </%def>
20
20
21 <%def name="main()">
21 <%def name="main()">
22 <div class="box">
22 <div class="box">
23 <!-- box / title -->
23 <!-- box / title -->
24 <div class="title">
24 <div class="title">
25 ${self.breadcrumbs()}
25 ${self.breadcrumbs()}
26 </div>
26 </div>
27 <div class="table">
27 <div class="table">
28 <div class="diffblock">
28 <div class="diffblock">
29 <div class="code-header">
29 <div class="code-header">
30 <div class="hash">
30 <div class="hash">
31 r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
31 r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
32 </div>
32 </div>
33 <div class="date">
33 <div class="date">
34 ${c.changeset.date}
34 ${c.changeset.date}
35 </div>
35 </div>
36 <div class="diff-actions">
36 <div class="diff-actions">
37 <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show')}" title="${_('raw diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a>
37 <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show')}" title="${_('raw diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a>
38 <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download')}" title="${_('download diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white_get.png')}"/></a>
38 <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download')}" title="${_('download diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white_get.png')}"/></a>
39 ${c.ignorews_url(request.GET)}
39 ${c.ignorews_url(request.GET)}
40 ${c.context_url(request.GET)}
40 ${c.context_url(request.GET)}
41 </div>
41 </div>
42 <div class="comments-number" style="float:right;padding-right:5px">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div>
42 <div class="comments-number" style="float:right;padding-right:5px">${ungettext("%d comment", "%d comments", len(c.comments)) % len(c.comments)} ${ungettext("(%d inline)", "(%d inline)", c.inline_cnt) % c.inline_cnt}</div>
43 </div>
43 </div>
44 </div>
44 </div>
45 <div id="changeset_content">
45 <div id="changeset_content">
46 <div class="container">
46 <div class="container">
47 <div class="left">
47 <div class="left">
48 <div class="author">
48 <div class="author">
49 <div class="gravatar">
49 <div class="gravatar">
50 <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),20)}"/>
50 <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),20)}"/>
51 </div>
51 </div>
52 <span>${h.person(c.changeset.author)}</span><br/>
52 <span>${h.person(c.changeset.author)}</span><br/>
53 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
53 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
54 </div>
54 </div>
55 <div class="message">${h.urlify_commit(h.wrap_paragraphs(c.changeset.message),c.repo_name)}</div>
55 <div class="message">${h.urlify_commit(h.wrap_paragraphs(c.changeset.message),c.repo_name)}</div>
56 </div>
56 </div>
57 <div class="right">
57 <div class="right">
58 <div class="changes">
58 <div class="changes">
59 % if len(c.changeset.affected_files) <= c.affected_files_cut_off:
59 % if len(c.changeset.affected_files) <= c.affected_files_cut_off:
60 <span class="removed" title="${_('removed')}">${len(c.changeset.removed)}</span>
60 <span class="removed" title="${_('removed')}">${len(c.changeset.removed)}</span>
61 <span class="changed" title="${_('changed')}">${len(c.changeset.changed)}</span>
61 <span class="changed" title="${_('changed')}">${len(c.changeset.changed)}</span>
62 <span class="added" title="${_('added')}">${len(c.changeset.added)}</span>
62 <span class="added" title="${_('added')}">${len(c.changeset.added)}</span>
63 % else:
63 % else:
64 <span class="removed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
64 <span class="removed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
65 <span class="changed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
65 <span class="changed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
66 <span class="added" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
66 <span class="added" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
67 % endif
67 % endif
68 </div>
68 </div>
69
69
70 %if c.changeset.parents:
70 %if c.changeset.parents:
71 %for p_cs in reversed(c.changeset.parents):
71 %for p_cs in reversed(c.changeset.parents):
72 <div class="parent">${_('Parent')}
72 <div class="parent">${_('Parent')}
73 <span class="changeset_id">${p_cs.revision}:<span class="changeset_hash">${h.link_to(h.short_id(p_cs.raw_id),
73 <span class="changeset_id">${p_cs.revision}:<span class="changeset_hash">${h.link_to(h.short_id(p_cs.raw_id),
74 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}</span></span>
74 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}</span></span>
75 </div>
75 </div>
76 %endfor
76 %endfor
77 %else:
77 %else:
78 <div class="parent">${_('No parents')}</div>
78 <div class="parent">${_('No parents')}</div>
79 %endif
79 %endif
80 <span class="logtags">
80 <span class="logtags">
81 %if len(c.changeset.parents)>1:
81 %if len(c.changeset.parents)>1:
82 <span class="merge">${_('merge')}</span>
82 <span class="merge">${_('merge')}</span>
83 %endif
83 %endif
84 %if c.changeset.branch:
84 %if c.changeset.branch:
85 <span class="branchtag" title="${'%s %s' % (_('branch'),c.changeset.branch)}">
85 <span class="branchtag" title="${'%s %s' % (_('branch'),c.changeset.branch)}">
86 ${h.link_to(c.changeset.branch,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}
86 ${h.link_to(c.changeset.branch,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}
87 </span>
87 </span>
88 %endif
88 %endif
89 %for tag in c.changeset.tags:
89 %for tag in c.changeset.tags:
90 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
90 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
91 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
91 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
92 %endfor
92 %endfor
93 </span>
93 </span>
94 </div>
94 </div>
95 </div>
95 </div>
96 <span>
96 <span>
97 ${_('%s files affected with %s insertions and %s deletions:') % (len(c.changeset.affected_files),c.lines_added,c.lines_deleted)}
97 ${_('%s files affected with %s insertions and %s deletions:') % (len(c.changeset.affected_files),c.lines_added,c.lines_deleted)}
98 </span>
98 </span>
99 <div class="cs_files">
99 <div class="cs_files">
100 %for change,filenode,diff,cs1,cs2,stat in c.changes:
100 %for change,filenode,diff,cs1,cs2,stat in c.changes:
101 <div class="cs_${change}">
101 <div class="cs_${change}">
102 <div class="node">
102 <div class="node">
103 %if change != 'removed':
103 %if change != 'removed':
104 ${h.link_to(h.safe_unicode(filenode.path),c.anchor_url(filenode.changeset.raw_id,filenode.path,request.GET)+"_target")}
104 ${h.link_to(h.safe_unicode(filenode.path),c.anchor_url(filenode.changeset.raw_id,filenode.path,request.GET)+"_target")}
105 %else:
105 %else:
106 ${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=h.FID('',filenode.path)))}
106 ${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=h.FID('',filenode.path)))}
107 %endif
107 %endif
108 </div>
108 </div>
109 <div class="changes">${h.fancy_file_stats(stat)}</div>
109 <div class="changes">${h.fancy_file_stats(stat)}</div>
110 </div>
110 </div>
111 %endfor
111 %endfor
112 % if c.cut_off:
112 % if c.cut_off:
113 ${_('Changeset was too big and was cut off...')}
113 ${_('Changeset was too big and was cut off...')}
114 % endif
114 % endif
115 </div>
115 </div>
116 </div>
116 </div>
117
117
118 </div>
118 </div>
119
119
120 ## diff block
120 ## diff block
121 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
121 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
122 ${diff_block.diff_block(c.changes)}
122 ${diff_block.diff_block(c.changes)}
123
123
124 ## template for inline comment form
124 ## template for inline comment form
125 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
125 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
126 ${comment.comment_inline_form(c.changeset)}
126 ${comment.comment_inline_form(c.changeset)}
127
127
128 ## render comments
128 ## render comments
129 ${comment.comments(c.changeset)}
129 ${comment.comments(c.changeset)}
130 <script type="text/javascript">
130 <script type="text/javascript">
131 YUE.onDOMReady(function(){
131 YUE.onDOMReady(function(){
132 AJAX_COMMENT_URL = "${url('changeset_comment',repo_name=c.repo_name,revision=c.changeset.raw_id)}";
132 AJAX_COMMENT_URL = "${url('changeset_comment',repo_name=c.repo_name,revision=c.changeset.raw_id)}";
133 AJAX_COMMENT_DELETE_URL = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}"
133 AJAX_COMMENT_DELETE_URL = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}"
134 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
134 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
135 var show = 'none';
135 var show = 'none';
136 var target = e.currentTarget;
136 var target = e.currentTarget;
137 if(target.checked){
137 if(target.checked){
138 var show = ''
138 var show = ''
139 }
139 }
140 var boxid = YUD.getAttribute(target,'id_for');
140 var boxid = YUD.getAttribute(target,'id_for');
141 var comments = YUQ('#{0} .inline-comments'.format(boxid));
141 var comments = YUQ('#{0} .inline-comments'.format(boxid));
142 for(c in comments){
142 for(c in comments){
143 YUD.setStyle(comments[c],'display',show);
143 YUD.setStyle(comments[c],'display',show);
144 }
144 }
145 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
145 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
146 for(c in btns){
146 for(c in btns){
147 YUD.setStyle(btns[c],'display',show);
147 YUD.setStyle(btns[c],'display',show);
148 }
148 }
149 })
149 })
150
150
151 YUE.on(YUQ('.line'),'click',function(e){
151 YUE.on(YUQ('.line'),'click',function(e){
152 var tr = e.currentTarget;
152 var tr = e.currentTarget;
153 injectInlineForm(tr);
153 injectInlineForm(tr);
154 });
154 });
155
155
156 // inject comments into they proper positions
156 // inject comments into they proper positions
157 var file_comments = YUQ('.inline-comment-placeholder');
157 var file_comments = YUQ('.inline-comment-placeholder');
158 renderInlineComments(file_comments);
158 renderInlineComments(file_comments);
159 })
159 })
160
160
161 </script>
161 </script>
162
162
163 </div>
163 </div>
164 </%def>
164 </%def>
@@ -1,113 +1,113
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
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}" line="${co.line_no}">
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}
13 </span>
13 </span>
14 <span class="date">
14 <span class="date">
15 ${h.age(co.modified_at)}
15 ${h.age(co.modified_at)}
16 </span>
16 </span>
17 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
17 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
18 <span class="buttons">
18 <span class="buttons">
19 <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
19 <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
20 </span>
20 </span>
21 %endif
21 %endif
22 </div>
22 </div>
23 <div class="text">
23 <div class="text">
24 ${h.rst_w_mentions(co.text)|n}
24 ${h.rst_w_mentions(co.text)|n}
25 </div>
25 </div>
26 </div>
26 </div>
27 </div>
27 </div>
28 </%def>
28 </%def>
29
29
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 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
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 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id),class_='inline-form')}
37 <div class="clearfix">
37 <div class="clearfix">
38 <div class="comment-help">${_('Commenting on line {1}.')}
38 <div class="comment-help">${_('Commenting on line {1}.')}
39 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
39 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
40 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
40 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
41 _('Use @username inside this text to send notification to this RhodeCode user')))|n}</div>
41 _('Use @username inside this text to send notification to this RhodeCode user')))|n}</div>
42 <textarea id="text_{1}" name="text"></textarea>
42 <textarea id="text_{1}" name="text"></textarea>
43 </div>
43 </div>
44 <div class="comment-button">
44 <div class="comment-button">
45 <input type="hidden" name="f_path" value="{0}">
45 <input type="hidden" name="f_path" value="{0}">
46 <input type="hidden" name="line" value="{1}">
46 <input type="hidden" name="line" value="{1}">
47 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
47 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
48 ${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')}
49 </div>
49 </div>
50 ${h.end_form()}
50 ${h.end_form()}
51 %else:
51 %else:
52 ${h.form('')}
52 ${h.form('')}
53 <div class="clearfix">
53 <div class="clearfix">
54 <div class="comment-help">
54 <div class="comment-help">
55 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
55 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
56 </div>
56 </div>
57 </div>
57 </div>
58 <div class="comment-button">
58 <div class="comment-button">
59 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
59 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
60 </div>
60 </div>
61 ${h.end_form()}
61 ${h.end_form()}
62 %endif
62 %endif
63 </div>
63 </div>
64 </div>
64 </div>
65 </%def>
65 </%def>
66
66
67
67
68 <%def name="inlines(changeset)">
68 <%def name="inlines(changeset)">
69 <div class="comments-number">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div>
69 <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>
70 %for path, lines in c.inline_comments:
70 %for path, lines in c.inline_comments:
71 % for line,comments in lines.iteritems():
71 % for line,comments in lines.iteritems():
72 <div style="display:none" class="inline-comment-placeholder" path="${path}" 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))}">
73 %for co in comments:
73 %for co in comments:
74 ${comment_block(co)}
74 ${comment_block(co)}
75 %endfor
75 %endfor
76 </div>
76 </div>
77 %endfor
77 %endfor
78 %endfor
78 %endfor
79
79
80 </%def>
80 </%def>
81
81
82 <%def name="comments(changeset)">
82 <%def name="comments(changeset)">
83
83
84 <div class="comments">
84 <div class="comments">
85 <div id="inline-comments-container">
85 <div id="inline-comments-container">
86 ${inlines(changeset)}
86 ${inlines(changeset)}
87 </div>
87 </div>
88
88
89 %for co in c.comments:
89 %for co in c.comments:
90 <div id="comment-tr-${co.comment_id}">
90 <div id="comment-tr-${co.comment_id}">
91 ${comment_block(co)}
91 ${comment_block(co)}
92 </div>
92 </div>
93 %endfor
93 %endfor
94 %if c.rhodecode_user.username != 'default':
94 %if c.rhodecode_user.username != 'default':
95 <div class="comment-form">
95 <div class="comment-form">
96 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id))}
96 ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id))}
97 <strong>${_('Leave a comment')}</strong>
97 <strong>${_('Leave a comment')}</strong>
98 <div class="clearfix">
98 <div class="clearfix">
99 <div class="comment-help">
99 <div class="comment-help">
100 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
100 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
101 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
101 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
102 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
102 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
103 </div>
103 </div>
104 ${h.textarea('text')}
104 ${h.textarea('text')}
105 </div>
105 </div>
106 <div class="comment-button">
106 <div class="comment-button">
107 ${h.submit('save', _('Comment'), class_='ui-button')}
107 ${h.submit('save', _('Comment'), class_='ui-button')}
108 </div>
108 </div>
109 ${h.end_form()}
109 ${h.end_form()}
110 </div>
110 </div>
111 %endif
111 %endif
112 </div>
112 </div>
113 </%def>
113 </%def>
General Comments 0
You need to be logged in to leave comments. Login now