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