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