##// END OF EJS Templates
pull requests: make the difference between changeset comments with status and PR comments with votes more obvious
Mads Kiilerich -
r4051:fd4ea41c default
parent child Browse files
Show More
@@ -1,239 +1,245 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
17
18 <div style="float:left;padding:4px 0px 0px 5px">
18 <div style="float:left;padding:4px 0px 0px 5px">
19 <span class="">
19 <span class="">
20 %if co.pull_request:
20 %if co.pull_request:
21 <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">
21 <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">
22 %if co.status_change:
22 %if co.status_change:
23 ${_('Status change on pull request #%s') % co.pull_request.pull_request_id}:
23 ${_('Vote on pull request #%s') % co.pull_request.pull_request_id}:
24 %else:
24 %else:
25 ${_('Comment on pull request #%s') % co.pull_request.pull_request_id}
25 ${_('Comment on pull request #%s') % co.pull_request.pull_request_id}
26 %endif
26 %endif
27 </a>
27 </a>
28 %else:
28 %else:
29 %if co.status_change:
29 %if co.status_change:
30 ${_('Status change on changeset')}:
30 ${_('Status change on changeset')}:
31 %else:
31 %else:
32 ${_('Comment on changeset')}
32 ${_('Comment on changeset')}
33 %endif
33 %endif
34 %endif
34 %endif
35 </span>
35 </span>
36 </div>
36 </div>
37
37
38 %if co.status_change:
38 %if co.status_change:
39 <div style="float:left" class="changeset-status-container">
39 <div style="float:left" class="changeset-status-container">
40 <div style="float:left;padding:10px 2px 0px 2px"></div>
40 <div style="float:left;padding:10px 2px 0px 2px"></div>
41 <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div>
41 <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div>
42 <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div>
42 <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div>
43 </div>
43 </div>
44 %endif
44 %endif
45
45
46 <a class="permalink" href="#comment-${co.comment_id}">&para;</a>
46 <a class="permalink" href="#comment-${co.comment_id}">&para;</a>
47 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
47 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
48 <div onClick="deleteComment(${co.comment_id})" class="buttons delete-comment ui-btn small">${_('Delete')}</div>
48 <div onClick="deleteComment(${co.comment_id})" class="buttons delete-comment ui-btn small">${_('Delete')}</div>
49 %endif
49 %endif
50 </div>
50 </div>
51 <div class="text">
51 <div class="text">
52 ${h.rst_w_mentions(co.text)|n}
52 ${h.rst_w_mentions(co.text)|n}
53 </div>
53 </div>
54 </div>
54 </div>
55 </div>
55 </div>
56 </%def>
56 </%def>
57
57
58
58
59 <%def name="comment_inline_form()">
59 <%def name="comment_inline_form()">
60 <div id='comment-inline-form-template' style="display:none">
60 <div id='comment-inline-form-template' style="display:none">
61 <div class="comment-inline-form ac">
61 <div class="comment-inline-form ac">
62 %if c.rhodecode_user.username != 'default':
62 %if c.rhodecode_user.username != 'default':
63 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
63 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
64 ${h.form('#', class_='inline-form')}
64 ${h.form('#', class_='inline-form')}
65 <div id="edit-container_{1}" class="clearfix">
65 <div id="edit-container_{1}" class="clearfix">
66 <div class="comment-help">${_('Commenting on line {1}.')}
66 <div class="comment-help">${_('Commenting on line {1}.')}
67 ${(_('Comments parsed using %s syntax with %s support.') % (
67 ${(_('Comments parsed using %s syntax with %s support.') % (
68 ('<a href="%s">RST</a>' % h.url('rst_help')),
68 ('<a href="%s">RST</a>' % h.url('rst_help')),
69 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
69 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
70 )
70 )
71 )|n
71 )|n
72 }
72 }
73 <div id="preview-btn_{1}" class="preview-btn ui-btn small">${_('Preview')}</div>
73 <div id="preview-btn_{1}" class="preview-btn ui-btn small">${_('Preview')}</div>
74 </div>
74 </div>
75 <div class="mentions-container" id="mentions_container_{1}"></div>
75 <div class="mentions-container" id="mentions_container_{1}"></div>
76 <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea>
76 <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea>
77 </div>
77 </div>
78 <div id="preview-container_{1}" class="clearfix" style="display:none">
78 <div id="preview-container_{1}" class="clearfix" style="display:none">
79 <div class="comment-help">
79 <div class="comment-help">
80 ${_('Comment preview')}
80 ${_('Comment preview')}
81 <div id="edit-btn_{1}" class="edit-btn ui-btn small">${_('Edit')}</div>
81 <div id="edit-btn_{1}" class="edit-btn ui-btn small">${_('Edit')}</div>
82 </div>
82 </div>
83 <div id="preview-box_{1}" class="preview-box"></div>
83 <div id="preview-box_{1}" class="preview-box"></div>
84 </div>
84 </div>
85 <div class="comment-button">
85 <div class="comment-button">
86 <input type="hidden" name="f_path" value="{0}">
86 <input type="hidden" name="f_path" value="{0}">
87 <input type="hidden" name="line" value="{1}">
87 <input type="hidden" name="line" value="{1}">
88 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
88 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
89 ${h.reset('hide-inline-form', _('Cancel'), class_='ui-btn hide-inline-form')}
89 ${h.reset('hide-inline-form', _('Cancel'), class_='ui-btn hide-inline-form')}
90 </div>
90 </div>
91 ${h.end_form()}
91 ${h.end_form()}
92 %else:
92 %else:
93 ${h.form('')}
93 ${h.form('')}
94 <div class="clearfix">
94 <div class="clearfix">
95 <div class="comment-help">
95 <div class="comment-help">
96 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
96 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
97 </div>
97 </div>
98 </div>
98 </div>
99 <div class="comment-button">
99 <div class="comment-button">
100 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
100 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
101 </div>
101 </div>
102 ${h.end_form()}
102 ${h.end_form()}
103 %endif
103 %endif
104 </div>
104 </div>
105 </div>
105 </div>
106 </%def>
106 </%def>
107
107
108
108
109 ## generates inlines taken from c.comments var
109 ## generates inlines taken from c.comments var
110 <%def name="inlines()">
110 <%def name="inlines()">
111 <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>
111 <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>
112 %for path, lines in c.inline_comments:
112 %for path, lines in c.inline_comments:
113 % for line,comments in lines.iteritems():
113 % for line,comments in lines.iteritems():
114 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
114 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
115 %for co in comments:
115 %for co in comments:
116 ${comment_block(co)}
116 ${comment_block(co)}
117 %endfor
117 %endfor
118 </div>
118 </div>
119 %endfor
119 %endfor
120 %endfor
120 %endfor
121
121
122 </%def>
122 </%def>
123
123
124 ## generate inline comments and the main ones
124 ## generate inline comments and the main ones
125 <%def name="generate_comments(include_pr=False)">
125 <%def name="generate_comments(include_pr=False)">
126 <div class="comments">
126 <div class="comments">
127 <div id="inline-comments-container">
127 <div id="inline-comments-container">
128 ## generate inlines for this changeset
128 ## generate inlines for this changeset
129 ${inlines()}
129 ${inlines()}
130 </div>
130 </div>
131
131
132 %for co in c.comments:
132 %for co in c.comments:
133 <div id="comment-tr-${co.comment_id}">
133 <div id="comment-tr-${co.comment_id}">
134 ## only render comments that are not from pull request, or from
134 ## only render comments that are not from pull request, or from
135 ## pull request and a status change
135 ## pull request and a status change
136 %if not co.pull_request or (co.pull_request and co.status_change) or include_pr:
136 %if not co.pull_request or (co.pull_request and co.status_change) or include_pr:
137 ${comment_block(co)}
137 ${comment_block(co)}
138 %endif
138 %endif
139 </div>
139 </div>
140 %endfor
140 %endfor
141 </div>
141 </div>
142 </%def>
142 </%def>
143
143
144 ## MAIN COMMENT FORM
144 ## MAIN COMMENT FORM
145 <%def name="comments(post_url, cur_status, close_btn=False, change_status=True)">
145 <%def name="comments(post_url, cur_status, is_pr=False, change_status=True)">
146
146
147 <div class="comments">
147 <div class="comments">
148 %if c.rhodecode_user.username != 'default':
148 %if c.rhodecode_user.username != 'default':
149 <div class="comment-form ac">
149 <div class="comment-form ac">
150 ${h.form(post_url)}
150 ${h.form(post_url)}
151 <div id="edit-container" class="clearfix">
151 <div id="edit-container" class="clearfix">
152 <div class="comment-help">
152 <div class="comment-help">
153 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
153 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
154 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
154 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
155 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
155 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
156 %if change_status:
156 %if change_status:
157 | <a id="show_changeset_link" onClick="change_status_show();"> ${_('Change status')}</a>
157 | <a id="show_changeset_link" onClick="change_status_show();">
158 %if is_pr:
159 ${_('Vote for pull request status')}
160 %else:
161 ${_('Change changeset status')}
162 %endif
163 </a>
158 <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" />
164 <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" />
159 %endif
165 %endif
160 <div id="preview-btn" class="preview-btn ui-btn small">${_('Preview')}</div>
166 <div id="preview-btn" class="preview-btn ui-btn small">${_('Preview')}</div>
161 </div>
167 </div>
162 %if change_status:
168 %if change_status:
163 <div id="status_block_container" class="status-block" style="display:none">
169 <div id="status_block_container" class="status-block" style="display:none">
164 %for status,lbl in c.changeset_statuses:
170 %for status,lbl in c.changeset_statuses:
165 <div class="">
171 <div class="">
166 <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}">
172 <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}">
167 <label for="${status}">${lbl}</label>
173 <label for="${status}">${lbl}</label>
168 </div>
174 </div>
169 %endfor
175 %endfor
170 %if close_btn and change_status:
176 %if is_pr and change_status:
171 <input id="save_close" type="checkbox" name="save_close" disabled="${'1' if cur_status in ['not_reviewed','under_review'] else ''}">
177 <input id="save_close" type="checkbox" name="save_close" disabled="${'1' if cur_status in ['not_reviewed','under_review'] else ''}">
172 <label id="save_close_label" for="save_close" class="${'disabled' if cur_status in ['not_reviewed','under_review'] else ''}">${_("Close (when approved or rejected)")}</label>
178 <label id="save_close_label" for="save_close" class="${'disabled' if cur_status in ['not_reviewed','under_review'] else ''}">${_("Close (when approved or rejected)")}</label>
173 %endif
179 %endif
174 </div>
180 </div>
175 %endif
181 %endif
176 <div class="mentions-container" id="mentions_container"></div>
182 <div class="mentions-container" id="mentions_container"></div>
177 ${h.textarea('text', class_="comment-block-ta")}
183 ${h.textarea('text', class_="comment-block-ta")}
178 </div>
184 </div>
179
185
180 <div id="preview-container" class="clearfix" style="display:none">
186 <div id="preview-container" class="clearfix" style="display:none">
181 <div class="comment-help">
187 <div class="comment-help">
182 ${_('Comment preview')}
188 ${_('Comment preview')}
183 <div id="edit-btn" class="edit-btn ui-btn small">${_('Edit')}</div>
189 <div id="edit-btn" class="edit-btn ui-btn small">${_('Edit')}</div>
184 </div>
190 </div>
185 <div id="preview-box" class="preview-box"></div>
191 <div id="preview-box" class="preview-box"></div>
186 </div>
192 </div>
187
193
188 <div class="comment-button">
194 <div class="comment-button">
189 ${h.submit('save', _('Comment'), class_="ui-btn large")}
195 ${h.submit('save', _('Comment'), class_="ui-btn large")}
190 </div>
196 </div>
191 ${h.end_form()}
197 ${h.end_form()}
192 </div>
198 </div>
193 %endif
199 %endif
194 </div>
200 </div>
195 <script>
201 <script>
196 var change_status_show = function(){
202 var change_status_show = function(){
197 var show = ! YUD.get('show_changeset_status_box').checked;
203 var show = ! YUD.get('show_changeset_status_box').checked;
198 YUD.get('show_changeset_status_box').checked = show;
204 YUD.get('show_changeset_status_box').checked = show;
199 YUD.setStyle('status_block_container', 'display', show?'':'none');
205 YUD.setStyle('status_block_container', 'display', show?'':'none');
200 };
206 };
201
207
202 YUE.onDOMReady(function () {
208 YUE.onDOMReady(function () {
203 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
209 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
204
210
205 YUE.on(YUQ('.status_change_radio'), 'change',function(e){
211 YUE.on(YUQ('.status_change_radio'), 'change',function(e){
206 var val = e.currentTarget.value;
212 var val = e.currentTarget.value;
207 if (val == 'approved' || val == 'rejected') {
213 if (val == 'approved' || val == 'rejected') {
208 YUD.removeClass('save_close_label', 'disabled');
214 YUD.removeClass('save_close_label', 'disabled');
209 YUD.get('save_close').disabled = false;
215 YUD.get('save_close').disabled = false;
210 }else{
216 }else{
211 YUD.addClass('save_close_label', 'disabled');
217 YUD.addClass('save_close_label', 'disabled');
212 YUD.get('save_close').disabled = true;
218 YUD.get('save_close').disabled = true;
213 }
219 }
214 })
220 })
215 YUE.on('preview-btn', 'click', function(e){
221 YUE.on('preview-btn', 'click', function(e){
216 var _text = YUD.get('text').value;
222 var _text = YUD.get('text').value;
217 if(!_text){
223 if(!_text){
218 return
224 return
219 }
225 }
220 var post_data = {'text': _text};
226 var post_data = {'text': _text};
221 YUD.addClass('preview-box', 'unloaded');
227 YUD.addClass('preview-box', 'unloaded');
222 YUD.get('preview-box').innerHTML = _TM['Loading ...'];
228 YUD.get('preview-box').innerHTML = _TM['Loading ...'];
223 YUD.setStyle('edit-container', 'display', 'none');
229 YUD.setStyle('edit-container', 'display', 'none');
224 YUD.setStyle('preview-container', 'display', '');
230 YUD.setStyle('preview-container', 'display', '');
225
231
226 var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'});
232 var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'});
227 ajaxPOST(url,post_data,function(o){
233 ajaxPOST(url,post_data,function(o){
228 YUD.get('preview-box').innerHTML = o.responseText;
234 YUD.get('preview-box').innerHTML = o.responseText;
229 YUD.removeClass('preview-box', 'unloaded');
235 YUD.removeClass('preview-box', 'unloaded');
230 })
236 })
231 })
237 })
232 YUE.on('edit-btn', 'click', function(e){
238 YUE.on('edit-btn', 'click', function(e){
233 YUD.setStyle('edit-container', 'display', '');
239 YUD.setStyle('edit-container', 'display', '');
234 YUD.setStyle('preview-container', 'display', 'none');
240 YUD.setStyle('preview-container', 'display', 'none');
235 })
241 })
236
242
237 });
243 });
238 </script>
244 </script>
239 </%def>
245 </%def>
@@ -1,125 +1,124 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('%s Changesets') % c.repo_name} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -&gt; r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)} &middot; ${c.rhodecode_name}
5 ${_('%s Changesets') % c.repo_name} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -&gt; r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)} &middot; ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8 <%def name="breadcrumbs_links()">
8 <%def name="breadcrumbs_links()">
9 ${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -&gt; r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)}
9 ${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -&gt; r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)}
10 </%def>
10 </%def>
11
11
12 <%def name="page_nav()">
12 <%def name="page_nav()">
13 ${self.menu('repositories')}
13 ${self.menu('repositories')}
14 </%def>
14 </%def>
15
15
16 <%def name="main()">
16 <%def name="main()">
17 ${self.repo_context_bar('changelog')}
17 ${self.repo_context_bar('changelog')}
18 <div class="box">
18 <div class="box">
19 <!-- box / title -->
19 <!-- box / title -->
20 <div class="title">
20 <div class="title">
21 ${self.breadcrumbs()}
21 ${self.breadcrumbs()}
22 </div>
22 </div>
23 <div class="table">
23 <div class="table">
24 <div id="body" class="diffblock">
24 <div id="body" class="diffblock">
25 <div class="code-header">
25 <div class="code-header">
26 <div>
26 <div>
27 ${h.link_to('r%s:%s -> r%s:%s' % (c.cs_ranges[0].revision, h.short_id(c.cs_ranges[0].raw_id), c.cs_ranges[-1].revision, h.short_id(c.cs_ranges[-1].raw_id)),
27 ${h.link_to('r%s:%s -> r%s:%s' % (c.cs_ranges[0].revision, h.short_id(c.cs_ranges[0].raw_id), c.cs_ranges[-1].revision, h.short_id(c.cs_ranges[-1].raw_id)),
28 h.url('compare_url',repo_name=c.repo_name,org_ref_type='rev',org_ref=getattr(c.cs_ranges[0].parents[0] if c.cs_ranges[0].parents else h.EmptyChangeset(),'raw_id'),other_ref_type='rev',other_ref=c.cs_ranges[-1].raw_id)
28 h.url('compare_url',repo_name=c.repo_name,org_ref_type='rev',org_ref=getattr(c.cs_ranges[0].parents[0] if c.cs_ranges[0].parents else h.EmptyChangeset(),'raw_id'),other_ref_type='rev',other_ref=c.cs_ranges[-1].raw_id)
29 )}
29 )}
30 </div>
30 </div>
31 </div>
31 </div>
32 </div>
32 </div>
33 <div id="changeset_compare_view_content">
33 <div id="changeset_compare_view_content">
34 <div class="container">
34 <div class="container">
35 <table class="compare_view_commits noborder">
35 <table class="compare_view_commits noborder">
36 %for cnt,cs in enumerate(c.cs_ranges):
36 %for cnt,cs in enumerate(c.cs_ranges):
37 <tr>
37 <tr>
38 <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),14)}"/></div></td>
38 <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),14)}"/></div></td>
39 <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
39 <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
40 <td><div class="author">${h.person(cs.author)}</div></td>
40 <td><div class="author">${h.person(cs.author)}</div></td>
41 <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
41 <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
42 <td>
42 <td>
43 %if c.statuses:
43 %if c.statuses:
44 <div title="${h.tooltip(_('Changeset status'))}" class="changeset-status-ico"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cnt])}" /></div>
44 <div title="${h.tooltip(_('Changeset status'))}" class="changeset-status-ico"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cnt])}" /></div>
45 %endif
45 %endif
46 </td>
46 </td>
47 <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}</div></td>
47 <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}</div></td>
48 </tr>
48 </tr>
49 %endfor
49 %endfor
50 </table>
50 </table>
51 </div>
51 </div>
52 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
52 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
53 <div class="cs_files">
53 <div class="cs_files">
54 %for cs in c.cs_ranges:
54 %for cs in c.cs_ranges:
55 <div class="cur_cs">${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
55 <div class="cur_cs">${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
56 %for FID, (cs1, cs2, change, path, diff, stats) in c.changes[cs.raw_id].iteritems():
56 %for FID, (cs1, cs2, change, path, diff, stats) in c.changes[cs.raw_id].iteritems():
57 <div class="cs_${change}">
57 <div class="cs_${change}">
58 <div class="node">
58 <div class="node">
59 ${h.link_to(h.safe_unicode(path),h.url.current(anchor=FID))}
59 ${h.link_to(h.safe_unicode(path),h.url.current(anchor=FID))}
60 </div>
60 </div>
61 <div class="changes">${h.fancy_file_stats(stats)}</div>
61 <div class="changes">${h.fancy_file_stats(stats)}</div>
62 </div>
62 </div>
63 %endfor
63 %endfor
64 %endfor
64 %endfor
65 </div>
65 </div>
66 </div>
66 </div>
67
67
68 </div>
68 </div>
69 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
69 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
70 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
70 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
71 %for cs in c.cs_ranges:
71 %for cs in c.cs_ranges:
72 ##${comment.comment_inline_form(cs)}
72 ##${comment.comment_inline_form(cs)}
73 ## diff block
73 ## diff block
74 <div class="h3">
74 <div class="h3">
75 <a class="tooltip" title="${h.tooltip(cs.message)}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}">${'r%s:%s' % (cs.revision,h.short_id(cs.raw_id))}</a>
75 <a class="tooltip" title="${h.tooltip(cs.message)}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}">${'r%s:%s' % (cs.revision,h.short_id(cs.raw_id))}</a>
76 <div class="gravatar">
76 <div class="gravatar">
77 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),20)}"/>
77 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),20)}"/>
78 </div>
78 </div>
79 <div class="right">
79 <div class="right">
80 <span class="logtags">
80 <span class="logtags">
81 %if len(cs.parents)>1:
81 %if len(cs.parents)>1:
82 <span class="merge">${_('merge')}</span>
82 <span class="merge">${_('merge')}</span>
83 %endif
83 %endif
84 %if h.is_hg(c.rhodecode_repo):
84 %if h.is_hg(c.rhodecode_repo):
85 %for book in cs.bookmarks:
85 %for book in cs.bookmarks:
86 <span class="booktag" title="${_('Bookmark %s') % book}">
86 <span class="booktag" title="${_('Bookmark %s') % book}">
87 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
87 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
88 </span>
88 </span>
89 %endfor
89 %endfor
90 %endif
90 %endif
91 %for tag in cs.tags:
91 %for tag in cs.tags:
92 <span class="tagtag" title="${_('Tag %s') % tag}">
92 <span class="tagtag" title="${_('Tag %s') % tag}">
93 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
93 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
94 %endfor
94 %endfor
95 %if cs.branch:
95 %if cs.branch:
96 <span class="branchtag" title="${_('Branch %s') % cs.branch}">
96 <span class="branchtag" title="${_('Branch %s') % cs.branch}">
97 ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
97 ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
98 </span>
98 </span>
99 %endif
99 %endif
100 </span>
100 </span>
101 </div>
101 </div>
102 </div>
102 </div>
103 ${diff_block.diff_block(c.changes[cs.raw_id])}
103 ${diff_block.diff_block(c.changes[cs.raw_id])}
104 ##${comment.comments(cs)}
105
104
106 %endfor
105 %endfor
107 <script type="text/javascript">
106 <script type="text/javascript">
108
107
109 YUE.onDOMReady(function(){
108 YUE.onDOMReady(function(){
110
109
111 YUE.on(YUQ('.diff-menu-activate'),'click',function(e){
110 YUE.on(YUQ('.diff-menu-activate'),'click',function(e){
112 var act = e.currentTarget.nextElementSibling;
111 var act = e.currentTarget.nextElementSibling;
113
112
114 if(YUD.hasClass(act,'active')){
113 if(YUD.hasClass(act,'active')){
115 YUD.removeClass(act,'active');
114 YUD.removeClass(act,'active');
116 YUD.setStyle(act,'display','none');
115 YUD.setStyle(act,'display','none');
117 }else{
116 }else{
118 YUD.addClass(act,'active');
117 YUD.addClass(act,'active');
119 YUD.setStyle(act,'display','');
118 YUD.setStyle(act,'display','');
120 }
119 }
121 });
120 });
122 })
121 })
123 </script>
122 </script>
124 </div>
123 </div>
125 </%def>
124 </%def>
@@ -1,257 +1,257 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)} &middot; ${c.rhodecode_name}
4 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)} &middot; ${c.rhodecode_name}
5 </%def>
5 </%def>
6
6
7 <%def name="breadcrumbs_links()">
7 <%def name="breadcrumbs_links()">
8 ${_('Pull request #%s') % c.pull_request.pull_request_id}
8 ${_('Pull request #%s') % c.pull_request.pull_request_id}
9 </%def>
9 </%def>
10
10
11 <%def name="page_nav()">
11 <%def name="page_nav()">
12 ${self.menu('repositories')}
12 ${self.menu('repositories')}
13 </%def>
13 </%def>
14
14
15 <%def name="main()">
15 <%def name="main()">
16 ${self.repo_context_bar('showpullrequest')}
16 ${self.repo_context_bar('showpullrequest')}
17 <div class="box">
17 <div class="box">
18 <!-- box / title -->
18 <!-- box / title -->
19 <div class="title">
19 <div class="title">
20 ${self.breadcrumbs()}
20 ${self.breadcrumbs()}
21 </div>
21 </div>
22
22
23 <h3 class="${'closed' if c.pull_request.is_closed() else ''}">
23 <h3 class="${'closed' if c.pull_request.is_closed() else ''}">
24 <img src="${h.url('/images/icons/flag_status_%s.png' % str(c.pull_request.last_review_status))}" />
24 <img src="${h.url('/images/icons/flag_status_%s.png' % str(c.pull_request.last_review_status))}" />
25 ${_('Title')}: ${c.pull_request.title}
25 ${_('Title')}: ${c.pull_request.title}
26 %if c.pull_request.is_closed():
26 %if c.pull_request.is_closed():
27 (${_('Closed')})
27 (${_('Closed')})
28 %endif
28 %endif
29 </h3>
29 </h3>
30
30
31 <div class="form">
31 <div class="form">
32 <div id="summary" class="fields">
32 <div id="summary" class="fields">
33 <div class="field">
33 <div class="field">
34 <div class="label-summary">
34 <div class="label-summary">
35 <label>${_('Review status')}:</label>
35 <label>${_('Review status')}:</label>
36 </div>
36 </div>
37 <div class="input">
37 <div class="input">
38 <div class="changeset-status-container" style="float:none;clear:both">
38 <div class="changeset-status-container" style="float:none;clear:both">
39 %if c.current_changeset_status:
39 %if c.current_changeset_status:
40 <div title="${_('Pull request status')}" class="changeset-status-lbl">
40 <div title="${_('Pull request status')}" class="changeset-status-lbl">
41 %if c.pull_request.is_closed():
41 %if c.pull_request.is_closed():
42 ${_('Closed')},
42 ${_('Closed')},
43 %endif
43 %endif
44 ${h.changeset_status_lbl(c.current_changeset_status)}
44 ${h.changeset_status_lbl(c.current_changeset_status)}
45 </div>
45 </div>
46 <div class="changeset-status-ico" style="padding:1px 4px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" /></div>
46 <div class="changeset-status-ico" style="padding:1px 4px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" /></div>
47 %endif
47 %endif
48 </div>
48 </div>
49 </div>
49 </div>
50 </div>
50 </div>
51 <div class="field">
51 <div class="field">
52 <div class="label-summary">
52 <div class="label-summary">
53 <label>${_('Still not reviewed by')}:</label>
53 <label>${_('Still not reviewed by')}:</label>
54 </div>
54 </div>
55 <div class="input">
55 <div class="input">
56 % if len(c.pull_request_pending_reviewers) > 0:
56 % if len(c.pull_request_pending_reviewers) > 0:
57 <div class="tooltip" title="${h.tooltip(', '.join([x.username for x in c.pull_request_pending_reviewers]))}">${ungettext('%d reviewer', '%d reviewers',len(c.pull_request_pending_reviewers)) % len(c.pull_request_pending_reviewers)}</div>
57 <div class="tooltip" title="${h.tooltip(', '.join([x.username for x in c.pull_request_pending_reviewers]))}">${ungettext('%d reviewer', '%d reviewers',len(c.pull_request_pending_reviewers)) % len(c.pull_request_pending_reviewers)}</div>
58 %else:
58 %else:
59 <div>${_('Pull request was reviewed by all reviewers')}</div>
59 <div>${_('Pull request was reviewed by all reviewers')}</div>
60 %endif
60 %endif
61 </div>
61 </div>
62 </div>
62 </div>
63 <div class="field">
63 <div class="field">
64 <div class="label-summary">
64 <div class="label-summary">
65 <label>${_('Origin repository')}:</label>
65 <label>${_('Origin repository')}:</label>
66 </div>
66 </div>
67 <div class="input">
67 <div class="input">
68 <div>
68 <div>
69 ##%if h.is_hg(c.pull_request.org_repo):
69 ##%if h.is_hg(c.pull_request.org_repo):
70 ## <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
70 ## <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
71 ##%elif h.is_git(c.pull_request.org_repo):
71 ##%elif h.is_git(c.pull_request.org_repo):
72 ## <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
72 ## <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
73 ##%endif
73 ##%endif
74 <span class="spantag">${c.pull_request.org_ref_parts[0]}: ${c.pull_request.org_ref_parts[1]}</span>
74 <span class="spantag">${c.pull_request.org_ref_parts[0]}: ${c.pull_request.org_ref_parts[1]}</span>
75 <span>
75 <span>
76 %if h.is_hg(c.pull_request.org_repo):
76 %if h.is_hg(c.pull_request.org_repo):
77 | ${_('Pull changes')} <span style="font-family: monospace">hg pull -r ${h.short_id(c.cs_ranges[-1].raw_id)} <a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name)}">${c.pull_request.org_repo.clone_url()}</a></span>
77 | ${_('Pull changes')} <span style="font-family: monospace">hg pull -r ${h.short_id(c.cs_ranges[-1].raw_id)} <a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name)}">${c.pull_request.org_repo.clone_url()}</a></span>
78 %elif h.is_git(c.pull_request.org_repo):
78 %elif h.is_git(c.pull_request.org_repo):
79 | ${_('Pull changes')}
79 | ${_('Pull changes')}
80 %endif
80 %endif
81 </div>
81 </div>
82 </div>
82 </div>
83 </div>
83 </div>
84 <div class="field">
84 <div class="field">
85 <div class="label-summary">
85 <div class="label-summary">
86 <label>${_('Description')}:</label>
86 <label>${_('Description')}:</label>
87 </div>
87 </div>
88 <div class="input">
88 <div class="input">
89 <div style="white-space:pre-wrap">${h.urlify_commit(c.pull_request.description)}</div>
89 <div style="white-space:pre-wrap">${h.urlify_commit(c.pull_request.description)}</div>
90 </div>
90 </div>
91 </div>
91 </div>
92 <div class="field">
92 <div class="field">
93 <div class="label-summary">
93 <div class="label-summary">
94 <label>${_('Created on')}:</label>
94 <label>${_('Created on')}:</label>
95 </div>
95 </div>
96 <div class="input">
96 <div class="input">
97 <div>${h.fmt_date(c.pull_request.created_on)}</div>
97 <div>${h.fmt_date(c.pull_request.created_on)}</div>
98 </div>
98 </div>
99 </div>
99 </div>
100 </div>
100 </div>
101 </div>
101 </div>
102
102
103 <div style="overflow: auto;">
103 <div style="overflow: auto;">
104 ##DIFF
104 ##DIFF
105 <div class="table" style="float:left;clear:none">
105 <div class="table" style="float:left;clear:none">
106 <div id="body" class="diffblock">
106 <div id="body" class="diffblock">
107 <div style="white-space:pre-wrap;padding:5px">${_('Compare view')}</div>
107 <div style="white-space:pre-wrap;padding:5px">${_('Compare view')}</div>
108 </div>
108 </div>
109 <div id="changeset_compare_view_content">
109 <div id="changeset_compare_view_content">
110 ##CS
110 ##CS
111 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}</div>
111 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}</div>
112 <%include file="/compare/compare_cs.html" />
112 <%include file="/compare/compare_cs.html" />
113
113
114 ## FILES
114 ## FILES
115 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
115 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
116
116
117 % if c.limited_diff:
117 % if c.limited_diff:
118 ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)}
118 ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)}
119 % else:
119 % else:
120 ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.files)) % (len(c.files),c.lines_added,c.lines_deleted)}:
120 ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.files)) % (len(c.files),c.lines_added,c.lines_deleted)}:
121 %endif
121 %endif
122
122
123 </div>
123 </div>
124 <div class="cs_files">
124 <div class="cs_files">
125 %if not c.files:
125 %if not c.files:
126 <span class="empty_data">${_('No files')}</span>
126 <span class="empty_data">${_('No files')}</span>
127 %endif
127 %endif
128 %for fid, change, f, stat in c.files:
128 %for fid, change, f, stat in c.files:
129 <div class="cs_${change}">
129 <div class="cs_${change}">
130 <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div>
130 <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div>
131 <div class="changes">${h.fancy_file_stats(stat)}</div>
131 <div class="changes">${h.fancy_file_stats(stat)}</div>
132 </div>
132 </div>
133 %endfor
133 %endfor
134 </div>
134 </div>
135 % if c.limited_diff:
135 % if c.limited_diff:
136 <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h5>
136 <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h5>
137 % endif
137 % endif
138 </div>
138 </div>
139 </div>
139 </div>
140 ## REVIEWERS
140 ## REVIEWERS
141 <div style="float:left; border-left:1px dashed #eee">
141 <div style="float:left; border-left:1px dashed #eee">
142 <h4>${_('Pull request reviewers')}</h4>
142 <h4>${_('Pull request reviewers')}</h4>
143 <div id="reviewers" style="padding:0px 0px 5px 10px">
143 <div id="reviewers" style="padding:0px 0px 5px 10px">
144 ## members goes here !
144 ## members goes here !
145 <div class="group_members_wrap" style="min-height:45px">
145 <div class="group_members_wrap" style="min-height:45px">
146 <ul id="review_members" class="group_members">
146 <ul id="review_members" class="group_members">
147 %for member,status in c.pull_request_reviewers:
147 %for member,status in c.pull_request_reviewers:
148 <li id="reviewer_${member.user_id}">
148 <li id="reviewer_${member.user_id}">
149 <div class="reviewers_member">
149 <div class="reviewers_member">
150 <div style="float:left;padding:0px 3px 0px 0px" class="tooltip" title="${h.tooltip(h.changeset_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
150 <div style="float:left;padding:0px 3px 0px 0px" class="tooltip" title="${h.tooltip(h.changeset_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
151 <img src="${h.url(str('/images/icons/flag_status_%s.png' % (status[0][1].status if status else 'not_reviewed')))}"/>
151 <img src="${h.url(str('/images/icons/flag_status_%s.png' % (status[0][1].status if status else 'not_reviewed')))}"/>
152 </div>
152 </div>
153 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
153 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
154 <div style="float:left">${member.full_name} (${_('owner') if c.pull_request.user_id == member.user_id else _('reviewer')})</div>
154 <div style="float:left">${member.full_name} (${_('owner') if c.pull_request.user_id == member.user_id else _('reviewer')})</div>
155 <input type="hidden" value="${member.user_id}" name="review_members" />
155 <input type="hidden" value="${member.user_id}" name="review_members" />
156 %if not c.pull_request.is_closed() and (h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.user_id == c.rhodecode_user.user_id):
156 %if not c.pull_request.is_closed() and (h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.user_id == c.rhodecode_user.user_id):
157 <span class="delete_icon action_button" onclick="removeReviewMember(${member.user_id})"></span>
157 <span class="delete_icon action_button" onclick="removeReviewMember(${member.user_id})"></span>
158 %endif
158 %endif
159 </div>
159 </div>
160 </li>
160 </li>
161 %endfor
161 %endfor
162 </ul>
162 </ul>
163 </div>
163 </div>
164 %if not c.pull_request.is_closed():
164 %if not c.pull_request.is_closed():
165 <div class='ac'>
165 <div class='ac'>
166 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id:
166 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id:
167 <div class="reviewer_ac">
167 <div class="reviewer_ac">
168 ${h.text('user', class_='yui-ac-input')}
168 ${h.text('user', class_='yui-ac-input')}
169 <span class="help-block">${_('Add or remove reviewer to this pull request.')}</span>
169 <span class="help-block">${_('Add or remove reviewer to this pull request.')}</span>
170 <div id="reviewers_container"></div>
170 <div id="reviewers_container"></div>
171 </div>
171 </div>
172 <div style="padding:0px 10px">
172 <div style="padding:0px 10px">
173 <span id="update_pull_request" class="ui-btn xsmall">${_('Save changes')}</span>
173 <span id="update_pull_request" class="ui-btn xsmall">${_('Save changes')}</span>
174 </div>
174 </div>
175 %endif
175 %endif
176 </div>
176 </div>
177 %endif
177 %endif
178 </div>
178 </div>
179 </div>
179 </div>
180 </div>
180 </div>
181 <script>
181 <script>
182 var _USERS_AC_DATA = ${c.users_array|n};
182 var _USERS_AC_DATA = ${c.users_array|n};
183 var _GROUPS_AC_DATA = ${c.users_groups_array|n};
183 var _GROUPS_AC_DATA = ${c.users_groups_array|n};
184 // TODO: switch this to pyroutes
184 // TODO: switch this to pyroutes
185 AJAX_COMMENT_URL = "${url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id)}";
185 AJAX_COMMENT_URL = "${url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id)}";
186 AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
186 AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
187
187
188 pyroutes.register('pullrequest_comment', "${url('pullrequest_comment',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']);
188 pyroutes.register('pullrequest_comment', "${url('pullrequest_comment',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']);
189 pyroutes.register('pullrequest_comment_delete', "${url('pullrequest_comment_delete',repo_name='%(repo_name)s',comment_id='%(comment_id)s')}", ['repo_name', 'comment_id']);
189 pyroutes.register('pullrequest_comment_delete', "${url('pullrequest_comment_delete',repo_name='%(repo_name)s',comment_id='%(comment_id)s')}", ['repo_name', 'comment_id']);
190 pyroutes.register('pullrequest_update', "${url('pullrequest_update',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']);
190 pyroutes.register('pullrequest_update', "${url('pullrequest_update',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']);
191
191
192 </script>
192 </script>
193
193
194 ## diff block
194 ## diff block
195 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
195 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
196 %for fid, change, f, stat in c.files:
196 %for fid, change, f, stat in c.files:
197 ${diff_block.diff_block_simple([c.changes[fid]])}
197 ${diff_block.diff_block_simple([c.changes[fid]])}
198 %endfor
198 %endfor
199 % if c.limited_diff:
199 % if c.limited_diff:
200 <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h4>
200 <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h4>
201 % endif
201 % endif
202
202
203
203
204 ## template for inline comment form
204 ## template for inline comment form
205 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
205 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
206 ${comment.comment_inline_form()}
206 ${comment.comment_inline_form()}
207
207
208 ## render comments and inlines
208 ## render comments and inlines
209 ${comment.generate_comments(include_pr=True)}
209 ${comment.generate_comments(include_pr=True)}
210
210
211 % if not c.pull_request.is_closed():
211 % if not c.pull_request.is_closed():
212 ## main comment form and it status
212 ## main comment form and it status
213 ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name,
213 ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name,
214 pull_request_id=c.pull_request.pull_request_id),
214 pull_request_id=c.pull_request.pull_request_id),
215 c.current_changeset_status,
215 c.current_changeset_status,
216 close_btn=True, change_status=c.allowed_to_change_status)}
216 is_pr=True, change_status=c.allowed_to_change_status)}
217 %endif
217 %endif
218
218
219 <script type="text/javascript">
219 <script type="text/javascript">
220 YUE.onDOMReady(function(){
220 YUE.onDOMReady(function(){
221 PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
221 PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
222
222
223 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
223 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
224 var show = 'none';
224 var show = 'none';
225 var target = e.currentTarget;
225 var target = e.currentTarget;
226 if(target.checked){
226 if(target.checked){
227 var show = ''
227 var show = ''
228 }
228 }
229 var boxid = YUD.getAttribute(target,'id_for');
229 var boxid = YUD.getAttribute(target,'id_for');
230 var comments = YUQ('#{0} .inline-comments'.format(boxid));
230 var comments = YUQ('#{0} .inline-comments'.format(boxid));
231 for(c in comments){
231 for(c in comments){
232 YUD.setStyle(comments[c],'display',show);
232 YUD.setStyle(comments[c],'display',show);
233 }
233 }
234 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
234 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
235 for(c in btns){
235 for(c in btns){
236 YUD.setStyle(btns[c],'display',show);
236 YUD.setStyle(btns[c],'display',show);
237 }
237 }
238 })
238 })
239
239
240 YUE.on(YUQ('.line'),'click',function(e){
240 YUE.on(YUQ('.line'),'click',function(e){
241 var tr = e.currentTarget;
241 var tr = e.currentTarget;
242 injectInlineForm(tr);
242 injectInlineForm(tr);
243 });
243 });
244
244
245 // inject comments into they proper positions
245 // inject comments into they proper positions
246 var file_comments = YUQ('.inline-comment-placeholder');
246 var file_comments = YUQ('.inline-comment-placeholder');
247 renderInlineComments(file_comments);
247 renderInlineComments(file_comments);
248
248
249 YUE.on(YUD.get('update_pull_request'),'click',function(e){
249 YUE.on(YUD.get('update_pull_request'),'click',function(e){
250 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
250 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
251 })
251 })
252 })
252 })
253 </script>
253 </script>
254
254
255 </div>
255 </div>
256
256
257 </%def>
257 </%def>
General Comments 0
You need to be logged in to leave comments. Login now