##// END OF EJS Templates
Show pull request link also on regular comments that are now attached to separate changesets
marcink -
r3190:786236aa beta
parent child Browse files
Show More
@@ -1,181 +1,191 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)} <a class="permalink" href="#comment-${co.comment_id}">&para;</a>
15 ${h.age(co.modified_at)} <a class="permalink" href="#comment-${co.comment_id}">&para;</a>
16 </div>
16 </div>
17 %if co.status_change:
17 %if co.status_change:
18 <div style="float:left" class="changeset-status-container">
18 <div style="float:left" class="changeset-status-container">
19 <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">&rsaquo;</span></div>
19 <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">&rsaquo;</span></div>
20 <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div>
20 <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div>
21 <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div>
21 <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div>
22 <div style="float:left;padding:3px 0px 0px 5px"> <span class="">
23 %if co.pull_request:
24 <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">${_('Status from pull request %s') % co.pull_request.pull_request_id}</a>
25 %endif
26 </span> </div>
27 </div>
22 </div>
28 %endif
23 %endif
24
25 <div style="float:left;padding:3px 0px 0px 5px">
26 <span class="">
27 %if co.pull_request:
28 <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">
29 %if co.status_change:
30 ${_('Status from pull request %s') % co.pull_request.pull_request_id}
31 %else:
32 ${_('Comment from pull request %s') % co.pull_request.pull_request_id}
33 %endif
34 </a>
35 %endif
36 </span>
37 </div>
38
29 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
39 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
30 <div class="buttons">
40 <div class="buttons">
31 <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
41 <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
32 </div>
42 </div>
33 %endif
43 %endif
34 </div>
44 </div>
35 <div class="text">
45 <div class="text">
36 ${h.rst_w_mentions(co.text)|n}
46 ${h.rst_w_mentions(co.text)|n}
37 </div>
47 </div>
38 </div>
48 </div>
39 </div>
49 </div>
40 </%def>
50 </%def>
41
51
42
52
43 <%def name="comment_inline_form()">
53 <%def name="comment_inline_form()">
44 <div id='comment-inline-form-template' style="display:none">
54 <div id='comment-inline-form-template' style="display:none">
45 <div class="comment-inline-form ac">
55 <div class="comment-inline-form ac">
46 %if c.rhodecode_user.username != 'default':
56 %if c.rhodecode_user.username != 'default':
47 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
57 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div>
48 ${h.form('#', class_='inline-form')}
58 ${h.form('#', class_='inline-form')}
49 <div class="clearfix">
59 <div class="clearfix">
50 <div class="comment-help">${_('Commenting on line {1}.')}
60 <div class="comment-help">${_('Commenting on line {1}.')}
51 ${(_('Comments parsed using %s syntax with %s support.') % (
61 ${(_('Comments parsed using %s syntax with %s support.') % (
52 ('<a href="%s">RST</a>' % h.url('rst_help')),
62 ('<a href="%s">RST</a>' % h.url('rst_help')),
53 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
63 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
54 )
64 )
55 )|n
65 )|n
56 }
66 }
57 </div>
67 </div>
58 <div class="mentions-container" id="mentions_container_{1}"></div>
68 <div class="mentions-container" id="mentions_container_{1}"></div>
59 <textarea id="text_{1}" name="text" class="yui-ac-input"></textarea>
69 <textarea id="text_{1}" name="text" class="yui-ac-input"></textarea>
60 </div>
70 </div>
61 <div class="comment-button">
71 <div class="comment-button">
62 <input type="hidden" name="f_path" value="{0}">
72 <input type="hidden" name="f_path" value="{0}">
63 <input type="hidden" name="line" value="{1}">
73 <input type="hidden" name="line" value="{1}">
64 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
74 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')}
65 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
75 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
66 </div>
76 </div>
67 ${h.end_form()}
77 ${h.end_form()}
68 %else:
78 %else:
69 ${h.form('')}
79 ${h.form('')}
70 <div class="clearfix">
80 <div class="clearfix">
71 <div class="comment-help">
81 <div class="comment-help">
72 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
82 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a>
73 </div>
83 </div>
74 </div>
84 </div>
75 <div class="comment-button">
85 <div class="comment-button">
76 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
86 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
77 </div>
87 </div>
78 ${h.end_form()}
88 ${h.end_form()}
79 %endif
89 %endif
80 </div>
90 </div>
81 </div>
91 </div>
82 </%def>
92 </%def>
83
93
84
94
85 ## generates inlines taken from c.comments var
95 ## generates inlines taken from c.comments var
86 <%def name="inlines()">
96 <%def name="inlines()">
87 <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>
97 <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>
88 %for path, lines in c.inline_comments:
98 %for path, lines in c.inline_comments:
89 % for line,comments in lines.iteritems():
99 % for line,comments in lines.iteritems():
90 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
100 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
91 %for co in comments:
101 %for co in comments:
92 ${comment_block(co)}
102 ${comment_block(co)}
93 %endfor
103 %endfor
94 </div>
104 </div>
95 %endfor
105 %endfor
96 %endfor
106 %endfor
97
107
98 </%def>
108 </%def>
99
109
100 ## generate inline comments and the main ones
110 ## generate inline comments and the main ones
101 <%def name="generate_comments()">
111 <%def name="generate_comments()">
102 <div class="comments">
112 <div class="comments">
103 <div id="inline-comments-container">
113 <div id="inline-comments-container">
104 ## generate inlines for this changeset
114 ## generate inlines for this changeset
105 ${inlines()}
115 ${inlines()}
106 </div>
116 </div>
107
117
108 %for co in c.comments:
118 %for co in c.comments:
109 <div id="comment-tr-${co.comment_id}">
119 <div id="comment-tr-${co.comment_id}">
110 ${comment_block(co)}
120 ${comment_block(co)}
111 </div>
121 </div>
112 %endfor
122 %endfor
113 </div>
123 </div>
114 </%def>
124 </%def>
115
125
116 ## MAIN COMMENT FORM
126 ## MAIN COMMENT FORM
117 <%def name="comments(post_url, cur_status, close_btn=False, change_status=True)">
127 <%def name="comments(post_url, cur_status, close_btn=False, change_status=True)">
118
128
119 <div class="comments">
129 <div class="comments">
120 %if c.rhodecode_user.username != 'default':
130 %if c.rhodecode_user.username != 'default':
121 <div class="comment-form ac">
131 <div class="comment-form ac">
122 ${h.form(post_url)}
132 ${h.form(post_url)}
123 <strong>${_('Leave a comment')}</strong>
133 <strong>${_('Leave a comment')}</strong>
124 <div class="clearfix">
134 <div class="clearfix">
125 <div class="comment-help">
135 <div class="comment-help">
126 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
136 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
127 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
137 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
128 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
138 _('Use @username inside this text to send notification to this RhodeCode user')))|n}
129 %if change_status:
139 %if change_status:
130 | <label for="show_changeset_status_box" class="tooltip" title="${_('Check this to change current status of code-review for this changeset')}"> ${_('change status')}</label>
140 | <label for="show_changeset_status_box" class="tooltip" title="${_('Check this to change current status of code-review for this changeset')}"> ${_('change status')}</label>
131 <input style="vertical-align: bottom;margin-bottom:-2px" id="show_changeset_status_box" type="checkbox" name="change_changeset_status" />
141 <input style="vertical-align: bottom;margin-bottom:-2px" id="show_changeset_status_box" type="checkbox" name="change_changeset_status" />
132 %endif
142 %endif
133 </div>
143 </div>
134 %if change_status:
144 %if change_status:
135 <div id="status_block_container" class="status-block" style="display:none">
145 <div id="status_block_container" class="status-block" style="display:none">
136 %for status,lbl in c.changeset_statuses:
146 %for status,lbl in c.changeset_statuses:
137 <div class="">
147 <div class="">
138 <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}">
148 <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}">
139 <label for="${status}">${lbl}</label>
149 <label for="${status}">${lbl}</label>
140 </div>
150 </div>
141 %endfor
151 %endfor
142 </div>
152 </div>
143 %endif
153 %endif
144 <div class="mentions-container" id="mentions_container"></div>
154 <div class="mentions-container" id="mentions_container"></div>
145 ${h.textarea('text')}
155 ${h.textarea('text')}
146 </div>
156 </div>
147 <div class="comment-button">
157 <div class="comment-button">
148 ${h.submit('save', _('Comment'), class_="ui-btn large")}
158 ${h.submit('save', _('Comment'), class_="ui-btn large")}
149 %if close_btn and change_status:
159 %if close_btn and change_status:
150 ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % ('hidden' if cur_status in ['not_reviewed','under_review'] else ''))}
160 ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % ('hidden' if cur_status in ['not_reviewed','under_review'] else ''))}
151 %endif
161 %endif
152 </div>
162 </div>
153 ${h.end_form()}
163 ${h.end_form()}
154 </div>
164 </div>
155 %endif
165 %endif
156 </div>
166 </div>
157 <script>
167 <script>
158 YUE.onDOMReady(function () {
168 YUE.onDOMReady(function () {
159 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
169 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
160
170
161 // changeset status box listener
171 // changeset status box listener
162 YUE.on(YUD.get('show_changeset_status_box'),'change',function(e){
172 YUE.on(YUD.get('show_changeset_status_box'),'change',function(e){
163 if(e.currentTarget.checked){
173 if(e.currentTarget.checked){
164 YUD.setStyle('status_block_container','display','');
174 YUD.setStyle('status_block_container','display','');
165 }
175 }
166 else{
176 else{
167 YUD.setStyle('status_block_container','display','none');
177 YUD.setStyle('status_block_container','display','none');
168 }
178 }
169 })
179 })
170 YUE.on(YUQ('.status_change_radio'), 'change',function(e){
180 YUE.on(YUQ('.status_change_radio'), 'change',function(e){
171 var val = e.currentTarget.value;
181 var val = e.currentTarget.value;
172 if (val == 'approved' || val == 'rejected') {
182 if (val == 'approved' || val == 'rejected') {
173 YUD.removeClass('save_close', 'hidden');
183 YUD.removeClass('save_close', 'hidden');
174 }else{
184 }else{
175 YUD.addClass('save_close', 'hidden');
185 YUD.addClass('save_close', 'hidden');
176 }
186 }
177 })
187 })
178
188
179 });
189 });
180 </script>
190 </script>
181 </%def>
191 </%def>
General Comments 0
You need to be logged in to leave comments. Login now