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