##// END OF EJS Templates
pull requests: link to origin branch
marcink -
r4057:6eaee7e2 default
parent child Browse files
Show More
@@ -1,257 +1,259 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 <div class="pr-details-title ${'closed' if c.pull_request.is_closed() else ''}">
23 <div class="pr-details-title ${'closed' if c.pull_request.is_closed() else ''}">
24 ${_('Title')}: ${c.pull_request.title}
24 ${_('Title')}: ${c.pull_request.title}
25 %if c.pull_request.is_closed():
25 %if c.pull_request.is_closed():
26 (${_('Closed')})
26 (${_('Closed')})
27 %endif
27 %endif
28 </div>
28 </div>
29
29
30 <div class="form">
30 <div class="form">
31 <div id="summary" class="fields">
31 <div id="summary" class="fields">
32 <div class="field">
32 <div class="field">
33 <div class="label-summary">
33 <div class="label-summary">
34 <label>${_('Review status')}:</label>
34 <label>${_('Review status')}:</label>
35 </div>
35 </div>
36 <div class="input">
36 <div class="input">
37 <div class="changeset-status-container" style="float:none;clear:both">
37 <div class="changeset-status-container" style="float:none;clear:both">
38 %if c.current_changeset_status:
38 %if c.current_changeset_status:
39 <div class="changeset-status-ico" style="padding:0px 4px 0px 0px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" title="${_('Pull request status calculated from votes')}"/></div>
39 <div class="changeset-status-ico" style="padding:0px 4px 0px 0px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" title="${_('Pull request status calculated from votes')}"/></div>
40 <div class="changeset-status-lbl tooltip" title="${_('Pull request status calculated from votes')}">
40 <div class="changeset-status-lbl tooltip" title="${_('Pull request status calculated from votes')}">
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
46
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
75 ## branch link is only valid if it is a branch
76 <span class="spantag"><a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name, anchor=c.pull_request.org_ref_parts[1])}">${c.pull_request.org_ref_parts[0]}: ${c.pull_request.org_ref_parts[1]}</a></span>
75 <span>
77 <span>
76 %if h.is_hg(c.pull_request.org_repo):
78 %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>
79 | ${_('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):
80 %elif h.is_git(c.pull_request.org_repo):
79 | ${_('Pull changes')}
81 | ${_('Pull changes')}
80 %endif
82 %endif
81 </div>
83 </div>
82 </div>
84 </div>
83 </div>
85 </div>
84 <div class="field">
86 <div class="field">
85 <div class="label-summary">
87 <div class="label-summary">
86 <label>${_('Description')}:</label>
88 <label>${_('Description')}:</label>
87 </div>
89 </div>
88 <div class="input">
90 <div class="input">
89 <div style="white-space:pre-wrap">${h.urlify_commit(c.pull_request.description)}</div>
91 <div style="white-space:pre-wrap">${h.urlify_commit(c.pull_request.description)}</div>
90 </div>
92 </div>
91 </div>
93 </div>
92 <div class="field">
94 <div class="field">
93 <div class="label-summary">
95 <div class="label-summary">
94 <label>${_('Created on')}:</label>
96 <label>${_('Created on')}:</label>
95 </div>
97 </div>
96 <div class="input">
98 <div class="input">
97 <div>${h.fmt_date(c.pull_request.created_on)}</div>
99 <div>${h.fmt_date(c.pull_request.created_on)}</div>
98 </div>
100 </div>
99 </div>
101 </div>
100 </div>
102 </div>
101 </div>
103 </div>
102
104
103 <div style="overflow: auto;">
105 <div style="overflow: auto;">
104 ##DIFF
106 ##DIFF
105 <div class="table" style="float:left;clear:none">
107 <div class="table" style="float:left;clear:none">
106 <div id="body" class="diffblock">
108 <div id="body" class="diffblock">
107 <div style="white-space:pre-wrap;padding:5px">${_('Compare view')}</div>
109 <div style="white-space:pre-wrap;padding:5px">${_('Compare view')}</div>
108 </div>
110 </div>
109 <div id="changeset_compare_view_content">
111 <div id="changeset_compare_view_content">
110 ##CS
112 ##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>
113 <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" />
114 <%include file="/compare/compare_cs.html" />
113
115
114 ## FILES
116 ## FILES
115 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
117 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
116
118
117 % if c.limited_diff:
119 % if c.limited_diff:
118 ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)}
120 ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)}
119 % else:
121 % 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)}:
122 ${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
123 %endif
122
124
123 </div>
125 </div>
124 <div class="cs_files">
126 <div class="cs_files">
125 %if not c.files:
127 %if not c.files:
126 <span class="empty_data">${_('No files')}</span>
128 <span class="empty_data">${_('No files')}</span>
127 %endif
129 %endif
128 %for fid, change, f, stat in c.files:
130 %for fid, change, f, stat in c.files:
129 <div class="cs_${change}">
131 <div class="cs_${change}">
130 <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div>
132 <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>
133 <div class="changes">${h.fancy_file_stats(stat)}</div>
132 </div>
134 </div>
133 %endfor
135 %endfor
134 </div>
136 </div>
135 % if c.limited_diff:
137 % 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>
138 <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
139 % endif
138 </div>
140 </div>
139 </div>
141 </div>
140 ## REVIEWERS
142 ## REVIEWERS
141 <div style="float:left; border-left:1px dashed #eee">
143 <div style="float:left; border-left:1px dashed #eee">
142 <h4>${_('Pull request reviewers')}</h4>
144 <h4>${_('Pull request reviewers')}</h4>
143 <div id="reviewers" style="padding:0px 0px 5px 10px">
145 <div id="reviewers" style="padding:0px 0px 5px 10px">
144 ## members goes here !
146 ## members goes here !
145 <div class="group_members_wrap" style="min-height:45px">
147 <div class="group_members_wrap" style="min-height:45px">
146 <ul id="review_members" class="group_members">
148 <ul id="review_members" class="group_members">
147 %for member,status in c.pull_request_reviewers:
149 %for member,status in c.pull_request_reviewers:
148 <li id="reviewer_${member.user_id}">
150 <li id="reviewer_${member.user_id}">
149 <div class="reviewers_member">
151 <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'))}">
152 <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')))}"/>
153 <img src="${h.url(str('/images/icons/flag_status_%s.png' % (status[0][1].status if status else 'not_reviewed')))}"/>
152 </div>
154 </div>
153 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
155 <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>
156 <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" />
157 <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):
158 %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>
159 <span class="delete_icon action_button" onclick="removeReviewMember(${member.user_id})"></span>
158 %endif
160 %endif
159 </div>
161 </div>
160 </li>
162 </li>
161 %endfor
163 %endfor
162 </ul>
164 </ul>
163 </div>
165 </div>
164 %if not c.pull_request.is_closed():
166 %if not c.pull_request.is_closed():
165 <div class='ac'>
167 <div class='ac'>
166 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id:
168 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id:
167 <div class="reviewer_ac">
169 <div class="reviewer_ac">
168 ${h.text('user', class_='yui-ac-input')}
170 ${h.text('user', class_='yui-ac-input')}
169 <span class="help-block">${_('Add or remove reviewer to this pull request.')}</span>
171 <span class="help-block">${_('Add or remove reviewer to this pull request.')}</span>
170 <div id="reviewers_container"></div>
172 <div id="reviewers_container"></div>
171 </div>
173 </div>
172 <div style="padding:0px 10px">
174 <div style="padding:0px 10px">
173 <span id="update_pull_request" class="ui-btn xsmall">${_('Save changes')}</span>
175 <span id="update_pull_request" class="ui-btn xsmall">${_('Save changes')}</span>
174 </div>
176 </div>
175 %endif
177 %endif
176 </div>
178 </div>
177 %endif
179 %endif
178 </div>
180 </div>
179 </div>
181 </div>
180 </div>
182 </div>
181 <script>
183 <script>
182 var _USERS_AC_DATA = ${c.users_array|n};
184 var _USERS_AC_DATA = ${c.users_array|n};
183 var _GROUPS_AC_DATA = ${c.users_groups_array|n};
185 var _GROUPS_AC_DATA = ${c.users_groups_array|n};
184 // TODO: switch this to pyroutes
186 // 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)}";
187 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__')}";
188 AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
187
189
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']);
190 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']);
191 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']);
192 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
193
192 </script>
194 </script>
193
195
194 ## diff block
196 ## diff block
195 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
197 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
196 %for fid, change, f, stat in c.files:
198 %for fid, change, f, stat in c.files:
197 ${diff_block.diff_block_simple([c.changes[fid]])}
199 ${diff_block.diff_block_simple([c.changes[fid]])}
198 %endfor
200 %endfor
199 % if c.limited_diff:
201 % 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>
202 <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
203 % endif
202
204
203
205
204 ## template for inline comment form
206 ## template for inline comment form
205 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
207 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
206 ${comment.comment_inline_form()}
208 ${comment.comment_inline_form()}
207
209
208 ## render comments and inlines
210 ## render comments and inlines
209 ${comment.generate_comments(include_pr=True)}
211 ${comment.generate_comments(include_pr=True)}
210
212
211 % if not c.pull_request.is_closed():
213 % if not c.pull_request.is_closed():
212 ## main comment form and it status
214 ## main comment form and it status
213 ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name,
215 ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name,
214 pull_request_id=c.pull_request.pull_request_id),
216 pull_request_id=c.pull_request.pull_request_id),
215 c.current_changeset_status,
217 c.current_changeset_status,
216 is_pr=True, change_status=c.allowed_to_change_status)}
218 is_pr=True, change_status=c.allowed_to_change_status)}
217 %endif
219 %endif
218
220
219 <script type="text/javascript">
221 <script type="text/javascript">
220 YUE.onDOMReady(function(){
222 YUE.onDOMReady(function(){
221 PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
223 PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
222
224
223 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
225 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
224 var show = 'none';
226 var show = 'none';
225 var target = e.currentTarget;
227 var target = e.currentTarget;
226 if(target.checked){
228 if(target.checked){
227 var show = ''
229 var show = ''
228 }
230 }
229 var boxid = YUD.getAttribute(target,'id_for');
231 var boxid = YUD.getAttribute(target,'id_for');
230 var comments = YUQ('#{0} .inline-comments'.format(boxid));
232 var comments = YUQ('#{0} .inline-comments'.format(boxid));
231 for(c in comments){
233 for(c in comments){
232 YUD.setStyle(comments[c],'display',show);
234 YUD.setStyle(comments[c],'display',show);
233 }
235 }
234 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
236 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
235 for(c in btns){
237 for(c in btns){
236 YUD.setStyle(btns[c],'display',show);
238 YUD.setStyle(btns[c],'display',show);
237 }
239 }
238 })
240 })
239
241
240 YUE.on(YUQ('.line'),'click',function(e){
242 YUE.on(YUQ('.line'),'click',function(e){
241 var tr = e.currentTarget;
243 var tr = e.currentTarget;
242 injectInlineForm(tr);
244 injectInlineForm(tr);
243 });
245 });
244
246
245 // inject comments into they proper positions
247 // inject comments into they proper positions
246 var file_comments = YUQ('.inline-comment-placeholder');
248 var file_comments = YUQ('.inline-comment-placeholder');
247 renderInlineComments(file_comments);
249 renderInlineComments(file_comments);
248
250
249 YUE.on(YUD.get('update_pull_request'),'click',function(e){
251 YUE.on(YUD.get('update_pull_request'),'click',function(e){
250 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
252 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
251 })
253 })
252 })
254 })
253 </script>
255 </script>
254
256
255 </div>
257 </div>
256
258
257 </%def>
259 </%def>
General Comments 0
You need to be logged in to leave comments. Login now