##// END OF EJS Templates
Fix inconsistent casing
Mads Kiilerich -
r3753:7b5bf8e0 beta
parent child Browse files
Show More
@@ -1,228 +1,228 b''
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 <div style="float:left"> <img src="${h.gravatar_url(co.author.email, 20)}" /> </div>
10 <div style="float:left"> <img src="${h.gravatar_url(co.author.email, 20)}" /> </div>
11 <div class="user">
11 <div class="user">
12 ${co.author.username}
12 ${co.author.username}
13 </div>
13 </div>
14 <div class="date">
14 <div class="date">
15 ${h.age(co.modified_at)}
15 ${h.age(co.modified_at)}
16 </div>
16 </div>
17 %if co.status_change:
17 %if co.status_change:
18 <div style="float:left" class="changeset-status-container">
18 <div style="float:left" class="changeset-status-container">
19 <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">&rsaquo;</span></div>
19 <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">&rsaquo;</span></div>
20 <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div>
20 <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div>
21 <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div>
21 <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div>
22 </div>
22 </div>
23 %endif
23 %endif
24
24
25 <div style="float:left;padding:4px 0px 0px 5px">
25 <div style="float:left;padding:4px 0px 0px 5px">
26 <span class="">
26 <span class="">
27 %if co.pull_request:
27 %if co.pull_request:
28 <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">
28 <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">
29 %if co.status_change:
29 %if co.status_change:
30 ${_('Status change on pull request #%s') % co.pull_request.pull_request_id}
30 ${_('Status change on pull request #%s') % co.pull_request.pull_request_id}
31 %else:
31 %else:
32 ${_('Comment on pull request #%s') % co.pull_request.pull_request_id}
32 ${_('Comment on pull request #%s') % co.pull_request.pull_request_id}
33 %endif
33 %endif
34 </a>
34 </a>
35 %endif
35 %endif
36 </span>
36 </span>
37 </div>
37 </div>
38 <a class="permalink" href="#comment-${co.comment_id}">&para;</a>
38 <a class="permalink" href="#comment-${co.comment_id}">&para;</a>
39 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
39 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
40 <div onClick="deleteComment(${co.comment_id})" class="buttons delete-comment ui-btn small">${_('Delete')}</div>
40 <div onClick="deleteComment(${co.comment_id})" class="buttons delete-comment ui-btn small">${_('Delete')}</div>
41 %endif
41 %endif
42 </div>
42 </div>
43 <div class="text">
43 <div class="text">
44 ${h.rst_w_mentions(co.text)|n}
44 ${h.rst_w_mentions(co.text)|n}
45 </div>
45 </div>
46 </div>
46 </div>
47 </div>
47 </div>
48 </%def>
48 </%def>
49
49
50
50
51 <%def name="comment_inline_form()">
51 <%def name="comment_inline_form()">
52 <div id='comment-inline-form-template' style="display:none">
52 <div id='comment-inline-form-template' style="display:none">
53 <div class="comment-inline-form ac">
53 <div class="comment-inline-form ac">
54 %if c.rhodecode_user.username != 'default':
54 %if c.rhodecode_user.username != 'default':
55 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
55 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
56 ${h.form('#', class_='inline-form')}
56 ${h.form('#', class_='inline-form')}
57 <div id="edit-container_{1}" class="clearfix">
57 <div id="edit-container_{1}" class="clearfix">
58 <div class="comment-help">${_('Commenting on line {1}.')}
58 <div class="comment-help">${_('Commenting on line {1}.')}
59 ${(_('Comments parsed using %s syntax with %s support.') % (
59 ${(_('Comments parsed using %s syntax with %s support.') % (
60 ('<a href="%s">RST</a>' % h.url('rst_help')),
60 ('<a href="%s">RST</a>' % h.url('rst_help')),
61 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
61 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
62 )
62 )
63 )|n
63 )|n
64 }
64 }
65 <div id="preview-btn_{1}" class="preview-btn ui-btn small">${_('preview')}</div>
65 <div id="preview-btn_{1}" class="preview-btn ui-btn small">${_('Preview')}</div>
66 </div>
66 </div>
67 <div class="mentions-container" id="mentions_container_{1}"></div>
67 <div class="mentions-container" id="mentions_container_{1}"></div>
68 <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea>
68 <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea>
69 </div>
69 </div>
70 <div id="preview-container_{1}" class="clearfix" style="display:none">
70 <div id="preview-container_{1}" class="clearfix" style="display:none">
71 <div class="comment-help">
71 <div class="comment-help">
72 ${_('Comment Preview')}
72 ${_('Comment preview')}
73 <div id="edit-btn_{1}" class="edit-btn ui-btn small">${_('edit')}</div>
73 <div id="edit-btn_{1}" class="edit-btn ui-btn small">${_('Edit')}</div>
74 </div>
74 </div>
75 <div id="preview-box_{1}" class="preview-box"></div>
75 <div id="preview-box_{1}" class="preview-box"></div>
76 </div>
76 </div>
77 <div class="comment-button">
77 <div class="comment-button">
78 <input type="hidden" name="f_path" value="{0}">
78 <input type="hidden" name="f_path" value="{0}">
79 <input type="hidden" name="line" value="{1}">
79 <input type="hidden" name="line" value="{1}">
80 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
80 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
81 ${h.reset('hide-inline-form', _('Cancel'), class_='ui-btn hide-inline-form')}
81 ${h.reset('hide-inline-form', _('Cancel'), class_='ui-btn hide-inline-form')}
82 </div>
82 </div>
83 ${h.end_form()}
83 ${h.end_form()}
84 %else:
84 %else:
85 ${h.form('')}
85 ${h.form('')}
86 <div class="clearfix">
86 <div class="clearfix">
87 <div class="comment-help">
87 <div class="comment-help">
88 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
88 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
89 </div>
89 </div>
90 </div>
90 </div>
91 <div class="comment-button">
91 <div class="comment-button">
92 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
92 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
93 </div>
93 </div>
94 ${h.end_form()}
94 ${h.end_form()}
95 %endif
95 %endif
96 </div>
96 </div>
97 </div>
97 </div>
98 </%def>
98 </%def>
99
99
100
100
101 ## generates inlines taken from c.comments var
101 ## generates inlines taken from c.comments var
102 <%def name="inlines()">
102 <%def name="inlines()">
103 <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>
103 <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>
104 %for path, lines in c.inline_comments:
104 %for path, lines in c.inline_comments:
105 % for line,comments in lines.iteritems():
105 % for line,comments in lines.iteritems():
106 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
106 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
107 %for co in comments:
107 %for co in comments:
108 ${comment_block(co)}
108 ${comment_block(co)}
109 %endfor
109 %endfor
110 </div>
110 </div>
111 %endfor
111 %endfor
112 %endfor
112 %endfor
113
113
114 </%def>
114 </%def>
115
115
116 ## generate inline comments and the main ones
116 ## generate inline comments and the main ones
117 <%def name="generate_comments(include_pr=False)">
117 <%def name="generate_comments(include_pr=False)">
118 <div class="comments">
118 <div class="comments">
119 <div id="inline-comments-container">
119 <div id="inline-comments-container">
120 ## generate inlines for this changeset
120 ## generate inlines for this changeset
121 ${inlines()}
121 ${inlines()}
122 </div>
122 </div>
123
123
124 %for co in c.comments:
124 %for co in c.comments:
125 <div id="comment-tr-${co.comment_id}">
125 <div id="comment-tr-${co.comment_id}">
126 ## only render comments that are not from pull request, or from
126 ## only render comments that are not from pull request, or from
127 ## pull request and a status change
127 ## pull request and a status change
128 %if not co.pull_request or (co.pull_request and co.status_change) or include_pr:
128 %if not co.pull_request or (co.pull_request and co.status_change) or include_pr:
129 ${comment_block(co)}
129 ${comment_block(co)}
130 %endif
130 %endif
131 </div>
131 </div>
132 %endfor
132 %endfor
133 </div>
133 </div>
134 </%def>
134 </%def>
135
135
136 ## MAIN COMMENT FORM
136 ## MAIN COMMENT FORM
137 <%def name="comments(post_url, cur_status, close_btn=False, change_status=True)">
137 <%def name="comments(post_url, cur_status, close_btn=False, change_status=True)">
138
138
139 <div class="comments">
139 <div class="comments">
140 %if c.rhodecode_user.username != 'default':
140 %if c.rhodecode_user.username != 'default':
141 <div class="comment-form ac">
141 <div class="comment-form ac">
142 ${h.form(post_url)}
142 ${h.form(post_url)}
143 <div id="edit-container" class="clearfix">
143 <div id="edit-container" class="clearfix">
144 <div class="comment-help">
144 <div class="comment-help">
145 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
145 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
146 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
146 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
147 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
147 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
148 %if change_status:
148 %if change_status:
149 | <a id="show_changeset_link" onClick="change_status_show();"> ${_('Change status')}</a>
149 | <a id="show_changeset_link" onClick="change_status_show();"> ${_('Change status')}</a>
150 <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" />
150 <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" />
151 %endif
151 %endif
152 <div id="preview-btn" class="preview-btn ui-btn small">${_('preview')}</div>
152 <div id="preview-btn" class="preview-btn ui-btn small">${_('Preview')}</div>
153 </div>
153 </div>
154 %if change_status:
154 %if change_status:
155 <div id="status_block_container" class="status-block" style="display:none">
155 <div id="status_block_container" class="status-block" style="display:none">
156 %for status,lbl in c.changeset_statuses:
156 %for status,lbl in c.changeset_statuses:
157 <div class="">
157 <div class="">
158 <img src="${h.url('/images/icons/flag_status_%s.png' % status)}" /> <input ${'checked="checked"' if status == cur_status else ''}" type="radio" class="status_change_radio" name="changeset_status" id="${status}" value="${status}">
158 <img src="${h.url('/images/icons/flag_status_%s.png' % status)}" /> <input ${'checked="checked"' if status == cur_status else ''}" type="radio" class="status_change_radio" name="changeset_status" id="${status}" value="${status}">
159 <label for="${status}">${lbl}</label>
159 <label for="${status}">${lbl}</label>
160 </div>
160 </div>
161 %endfor
161 %endfor
162 </div>
162 </div>
163 %endif
163 %endif
164 <div class="mentions-container" id="mentions_container"></div>
164 <div class="mentions-container" id="mentions_container"></div>
165 ${h.textarea('text', class_="comment-block-ta")}
165 ${h.textarea('text', class_="comment-block-ta")}
166 </div>
166 </div>
167
167
168 <div id="preview-container" class="clearfix" style="display:none">
168 <div id="preview-container" class="clearfix" style="display:none">
169 <div class="comment-help">
169 <div class="comment-help">
170 ${_('Comment Preview')}
170 ${_('Comment preview')}
171 <div id="edit-btn" class="edit-btn ui-btn small">${_('edit')}</div>
171 <div id="edit-btn" class="edit-btn ui-btn small">${_('Edit')}</div>
172 </div>
172 </div>
173 <div id="preview-box" class="preview-box"></div>
173 <div id="preview-box" class="preview-box"></div>
174 </div>
174 </div>
175
175
176 <div class="comment-button">
176 <div class="comment-button">
177 ${h.submit('save', _('Comment'), class_="ui-btn large")}
177 ${h.submit('save', _('Comment'), class_="ui-btn large")}
178 %if close_btn and change_status:
178 %if close_btn and change_status:
179 ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % ('hidden' if cur_status in ['not_reviewed','under_review'] else ''))}
179 ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % ('hidden' if cur_status in ['not_reviewed','under_review'] else ''))}
180 %endif
180 %endif
181 </div>
181 </div>
182 ${h.end_form()}
182 ${h.end_form()}
183 </div>
183 </div>
184 %endif
184 %endif
185 </div>
185 </div>
186 <script>
186 <script>
187 var change_status_show = function(){
187 var change_status_show = function(){
188 var show = ! YUD.get('show_changeset_status_box').checked;
188 var show = ! YUD.get('show_changeset_status_box').checked;
189 YUD.get('show_changeset_status_box').checked = show;
189 YUD.get('show_changeset_status_box').checked = show;
190 YUD.setStyle('status_block_container', 'display', show?'':'none');
190 YUD.setStyle('status_block_container', 'display', show?'':'none');
191 };
191 };
192
192
193 YUE.onDOMReady(function () {
193 YUE.onDOMReady(function () {
194 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
194 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
195
195
196 YUE.on(YUQ('.status_change_radio'), 'change',function(e){
196 YUE.on(YUQ('.status_change_radio'), 'change',function(e){
197 var val = e.currentTarget.value;
197 var val = e.currentTarget.value;
198 if (val == 'approved' || val == 'rejected') {
198 if (val == 'approved' || val == 'rejected') {
199 YUD.removeClass('save_close', 'hidden');
199 YUD.removeClass('save_close', 'hidden');
200 }else{
200 }else{
201 YUD.addClass('save_close', 'hidden');
201 YUD.addClass('save_close', 'hidden');
202 }
202 }
203 })
203 })
204 YUE.on('preview-btn', 'click', function(e){
204 YUE.on('preview-btn', 'click', function(e){
205 var _text = YUD.get('text').value;
205 var _text = YUD.get('text').value;
206 if(!_text){
206 if(!_text){
207 return
207 return
208 }
208 }
209 var post_data = {'text': _text};
209 var post_data = {'text': _text};
210 YUD.addClass('preview-box', 'unloaded');
210 YUD.addClass('preview-box', 'unloaded');
211 YUD.get('preview-box').innerHTML = _TM['Loading ...'];
211 YUD.get('preview-box').innerHTML = _TM['Loading ...'];
212 YUD.setStyle('edit-container', 'display', 'none');
212 YUD.setStyle('edit-container', 'display', 'none');
213 YUD.setStyle('preview-container', 'display', '');
213 YUD.setStyle('preview-container', 'display', '');
214
214
215 var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'});
215 var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'});
216 ajaxPOST(url,post_data,function(o){
216 ajaxPOST(url,post_data,function(o){
217 YUD.get('preview-box').innerHTML = o.responseText;
217 YUD.get('preview-box').innerHTML = o.responseText;
218 YUD.removeClass('preview-box', 'unloaded');
218 YUD.removeClass('preview-box', 'unloaded');
219 })
219 })
220 })
220 })
221 YUE.on('edit-btn', 'click', function(e){
221 YUE.on('edit-btn', 'click', function(e){
222 YUD.setStyle('edit-container', 'display', '');
222 YUD.setStyle('edit-container', 'display', '');
223 YUD.setStyle('preview-container', 'display', 'none');
223 YUD.setStyle('preview-container', 'display', 'none');
224 })
224 })
225
225
226 });
226 });
227 </script>
227 </script>
228 </%def>
228 </%def>
General Comments 0
You need to be logged in to leave comments. Login now