Show More
@@ -1,385 +1,388 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | ## usage: |
|
2 | ## usage: | |
3 | ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
3 | ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> | |
4 | ## ${comment.comment_block(comment)} |
|
4 | ## ${comment.comment_block(comment)} | |
5 | ## |
|
5 | ## | |
6 | <%namespace name="base" file="/base/base.mako"/> |
|
6 | <%namespace name="base" file="/base/base.mako"/> | |
7 |
|
7 | |||
8 | <%def name="comment_block(comment, inline=False)"> |
|
8 | <%def name="comment_block(comment, inline=False)"> | |
9 | <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %> |
|
9 | <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %> | |
10 | % if inline: |
|
10 | % if inline: | |
11 | <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %> |
|
11 | <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %> | |
12 | % else: |
|
12 | % else: | |
13 | <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %> |
|
13 | <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %> | |
14 | % endif |
|
14 | % endif | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | <div class="comment |
|
17 | <div class="comment | |
18 | ${'comment-inline' if inline else 'comment-general'} |
|
18 | ${'comment-inline' if inline else 'comment-general'} | |
19 | ${'comment-outdated' if outdated_at_ver else 'comment-current'}" |
|
19 | ${'comment-outdated' if outdated_at_ver else 'comment-current'}" | |
20 | id="comment-${comment.comment_id}" |
|
20 | id="comment-${comment.comment_id}" | |
21 | line="${comment.line_no}" |
|
21 | line="${comment.line_no}" | |
22 | data-comment-id="${comment.comment_id}" |
|
22 | data-comment-id="${comment.comment_id}" | |
23 | data-comment-type="${comment.comment_type}" |
|
23 | data-comment-type="${comment.comment_type}" | |
24 | data-comment-inline=${h.json.dumps(inline)} |
|
24 | data-comment-inline=${h.json.dumps(inline)} | |
25 | style="${'display: none;' if outdated_at_ver else ''}"> |
|
25 | style="${'display: none;' if outdated_at_ver else ''}"> | |
26 |
|
26 | |||
27 | <div class="meta"> |
|
27 | <div class="meta"> | |
28 | <div class="comment-type-label"> |
|
28 | <div class="comment-type-label"> | |
29 | <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}"> |
|
29 | <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}"> | |
30 | % if comment.comment_type == 'todo': |
|
30 | % if comment.comment_type == 'todo': | |
31 | % if comment.resolved: |
|
31 | % if comment.resolved: | |
32 | <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}"> |
|
32 | <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}"> | |
33 | <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a> |
|
33 | <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a> | |
34 | </div> |
|
34 | </div> | |
35 | % else: |
|
35 | % else: | |
36 | <div class="resolved tooltip" style="display: none"> |
|
36 | <div class="resolved tooltip" style="display: none"> | |
37 | <span>${comment.comment_type}</span> |
|
37 | <span>${comment.comment_type}</span> | |
38 | </div> |
|
38 | </div> | |
39 | <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}"> |
|
39 | <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}"> | |
40 | ${comment.comment_type} |
|
40 | ${comment.comment_type} | |
41 | </div> |
|
41 | </div> | |
42 | % endif |
|
42 | % endif | |
43 | % else: |
|
43 | % else: | |
44 | % if comment.resolved_comment: |
|
44 | % if comment.resolved_comment: | |
45 | fix |
|
45 | fix | |
46 | % else: |
|
46 | % else: | |
47 | ${comment.comment_type or 'note'} |
|
47 | ${comment.comment_type or 'note'} | |
48 | % endif |
|
48 | % endif | |
49 | % endif |
|
49 | % endif | |
50 | </div> |
|
50 | </div> | |
51 | </div> |
|
51 | </div> | |
52 |
|
52 | |||
53 | <div class="author ${'author-inline' if inline else 'author-general'}"> |
|
53 | <div class="author ${'author-inline' if inline else 'author-general'}"> | |
54 | ${base.gravatar_with_user(comment.author.email, 16)} |
|
54 | ${base.gravatar_with_user(comment.author.email, 16)} | |
55 | </div> |
|
55 | </div> | |
56 | <div class="date"> |
|
56 | <div class="date"> | |
57 | ${h.age_component(comment.modified_at, time_is_local=True)} |
|
57 | ${h.age_component(comment.modified_at, time_is_local=True)} | |
58 | </div> |
|
58 | </div> | |
59 | % if inline: |
|
59 | % if inline: | |
60 | <span></span> |
|
60 | <span></span> | |
61 | % else: |
|
61 | % else: | |
62 | <div class="status-change"> |
|
62 | <div class="status-change"> | |
63 | % if comment.pull_request: |
|
63 | % if comment.pull_request: | |
64 | <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}"> |
|
64 | <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}"> | |
65 | % if comment.status_change: |
|
65 | % if comment.status_change: | |
66 | ${_('pull request #%s') % comment.pull_request.pull_request_id}: |
|
66 | ${_('pull request #%s') % comment.pull_request.pull_request_id}: | |
67 | % else: |
|
67 | % else: | |
68 | ${_('pull request #%s') % comment.pull_request.pull_request_id} |
|
68 | ${_('pull request #%s') % comment.pull_request.pull_request_id} | |
69 | % endif |
|
69 | % endif | |
70 | </a> |
|
70 | </a> | |
71 | % else: |
|
71 | % else: | |
72 | % if comment.status_change: |
|
72 | % if comment.status_change: | |
73 | ${_('Status change on commit')}: |
|
73 | ${_('Status change on commit')}: | |
74 | % endif |
|
74 | % endif | |
75 | % endif |
|
75 | % endif | |
76 | </div> |
|
76 | </div> | |
77 | % endif |
|
77 | % endif | |
78 |
|
78 | |||
79 | % if comment.status_change: |
|
79 | % if comment.status_change: | |
80 | <div class="${'flag_status %s' % comment.status_change[0].status}"></div> |
|
80 | <div class="${'flag_status %s' % comment.status_change[0].status}"></div> | |
81 | <div title="${_('Commit status')}" class="changeset-status-lbl"> |
|
81 | <div title="${_('Commit status')}" class="changeset-status-lbl"> | |
82 | ${comment.status_change[0].status_lbl} |
|
82 | ${comment.status_change[0].status_lbl} | |
83 | </div> |
|
83 | </div> | |
84 | % endif |
|
84 | % endif | |
85 |
|
85 | |||
86 | <a class="permalink" href="#comment-${comment.comment_id}"> ¶</a> |
|
86 | <a class="permalink" href="#comment-${comment.comment_id}"> ¶</a> | |
87 |
|
87 | |||
88 | <div class="comment-links-block"> |
|
88 | <div class="comment-links-block"> | |
89 |
|
89 | |||
90 | % if inline: |
|
90 | % if inline: | |
91 | <div class="pr-version-inline"> |
|
91 | <div class="pr-version-inline"> | |
92 | <a href="${h.url.current(version=comment.pull_request_version_id, anchor='comment-{}'.format(comment.comment_id))}"> |
|
92 | <a href="${h.url.current(version=comment.pull_request_version_id, anchor='comment-{}'.format(comment.comment_id))}"> | |
93 | % if outdated_at_ver: |
|
93 | % if outdated_at_ver: | |
94 | <code class="pr-version-num" title="${_('Outdated comment from pull request version {0}').format(pr_index_ver)}"> |
|
94 | <code class="pr-version-num" title="${_('Outdated comment from pull request version {0}').format(pr_index_ver)}"> | |
95 | outdated ${'v{}'.format(pr_index_ver)} | |
|
95 | outdated ${'v{}'.format(pr_index_ver)} | | |
96 | </code> |
|
96 | </code> | |
97 | % elif pr_index_ver: |
|
97 | % elif pr_index_ver: | |
98 | <code class="pr-version-num" title="${_('Comment from pull request version {0}').format(pr_index_ver)}"> |
|
98 | <code class="pr-version-num" title="${_('Comment from pull request version {0}').format(pr_index_ver)}"> | |
99 | ${'v{}'.format(pr_index_ver)} | |
|
99 | ${'v{}'.format(pr_index_ver)} | | |
100 | </code> |
|
100 | </code> | |
101 | % endif |
|
101 | % endif | |
102 | </a> |
|
102 | </a> | |
103 | </div> |
|
103 | </div> | |
104 | % else: |
|
104 | % else: | |
105 | % if comment.pull_request_version_id and pr_index_ver: |
|
105 | % if comment.pull_request_version_id and pr_index_ver: | |
106 | | |
|
106 | | | |
107 | <div class="pr-version"> |
|
107 | <div class="pr-version"> | |
108 | % if comment.outdated: |
|
108 | % if comment.outdated: | |
109 | <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}"> |
|
109 | <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}"> | |
110 | ${_('Outdated comment from pull request version {}').format(pr_index_ver)} |
|
110 | ${_('Outdated comment from pull request version {}').format(pr_index_ver)} | |
111 | </a> |
|
111 | </a> | |
112 | % else: |
|
112 | % else: | |
113 | <div title="${_('Comment from pull request version {0}').format(pr_index_ver)}"> |
|
113 | <div title="${_('Comment from pull request version {0}').format(pr_index_ver)}"> | |
114 | <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id, version=comment.pull_request_version_id)}"> |
|
114 | <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id, version=comment.pull_request_version_id)}"> | |
115 | <code class="pr-version-num"> |
|
115 | <code class="pr-version-num"> | |
116 | ${'v{}'.format(pr_index_ver)} |
|
116 | ${'v{}'.format(pr_index_ver)} | |
117 | </code> |
|
117 | </code> | |
118 | </a> |
|
118 | </a> | |
119 | </div> |
|
119 | </div> | |
120 | % endif |
|
120 | % endif | |
121 | </div> |
|
121 | </div> | |
122 | % endif |
|
122 | % endif | |
123 | % endif |
|
123 | % endif | |
124 |
|
124 | |||
125 | ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed |
|
125 | ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed | |
126 | ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated |
|
126 | ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated | |
127 | %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())): |
|
127 | %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())): | |
128 | ## permissions to delete |
|
128 | ## permissions to delete | |
129 | %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id: |
|
129 | %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id: | |
130 | ## TODO: dan: add edit comment here |
|
130 | ## TODO: dan: add edit comment here | |
131 | <a onclick="return Rhodecode.comments.deleteComment(this);" class="delete-comment"> ${_('Delete')}</a> |
|
131 | <a onclick="return Rhodecode.comments.deleteComment(this);" class="delete-comment"> ${_('Delete')}</a> | |
132 | %else: |
|
132 | %else: | |
133 | <button class="btn-link" disabled="disabled"> ${_('Delete')}</button> |
|
133 | <button class="btn-link" disabled="disabled"> ${_('Delete')}</button> | |
134 | %endif |
|
134 | %endif | |
135 | %else: |
|
135 | %else: | |
136 | <button class="btn-link" disabled="disabled"> ${_('Delete')}</button> |
|
136 | <button class="btn-link" disabled="disabled"> ${_('Delete')}</button> | |
137 | %endif |
|
137 | %endif | |
138 |
|
138 | |||
139 |
%if |
|
139 | % if outdated_at_ver: | |
|
140 | | <a onclick="return Rhodecode.comments.prevOutdatedComment(this);" class="prev-comment"> ${_('Prev')}</a> | |||
|
141 | | <a onclick="return Rhodecode.comments.nextOutdatedComment(this);" class="next-comment"> ${_('Next')}</a> | |||
|
142 | % else: | |||
140 | | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a> |
|
143 | | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a> | |
141 | | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a> |
|
144 | | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a> | |
142 | %endif |
|
145 | % endif | |
143 |
|
146 | |||
144 | </div> |
|
147 | </div> | |
145 | </div> |
|
148 | </div> | |
146 | <div class="text"> |
|
149 | <div class="text"> | |
147 | ${comment.render(mentions=True)|n} |
|
150 | ${comment.render(mentions=True)|n} | |
148 | </div> |
|
151 | </div> | |
149 |
|
152 | |||
150 | </div> |
|
153 | </div> | |
151 | </%def> |
|
154 | </%def> | |
152 |
|
155 | |||
153 | ## generate main comments |
|
156 | ## generate main comments | |
154 | <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)"> |
|
157 | <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)"> | |
155 | <div id="comments"> |
|
158 | <div class="general-comments" id="comments"> | |
156 | %for comment in comments: |
|
159 | %for comment in comments: | |
157 | <div id="comment-tr-${comment.comment_id}"> |
|
160 | <div id="comment-tr-${comment.comment_id}"> | |
158 | ## only render comments that are not from pull request, or from |
|
161 | ## only render comments that are not from pull request, or from | |
159 | ## pull request and a status change |
|
162 | ## pull request and a status change | |
160 | %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request: |
|
163 | %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request: | |
161 | ${comment_block(comment)} |
|
164 | ${comment_block(comment)} | |
162 | %endif |
|
165 | %endif | |
163 | </div> |
|
166 | </div> | |
164 | %endfor |
|
167 | %endfor | |
165 | ## to anchor ajax comments |
|
168 | ## to anchor ajax comments | |
166 | <div id="injected_page_comments"></div> |
|
169 | <div id="injected_page_comments"></div> | |
167 | </div> |
|
170 | </div> | |
168 | </%def> |
|
171 | </%def> | |
169 |
|
172 | |||
170 |
|
173 | |||
171 | <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)"> |
|
174 | <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)"> | |
172 |
|
175 | |||
173 | <div class="comments"> |
|
176 | <div class="comments"> | |
174 | <% |
|
177 | <% | |
175 | if is_pull_request: |
|
178 | if is_pull_request: | |
176 | placeholder = _('Leave a comment on this Pull Request.') |
|
179 | placeholder = _('Leave a comment on this Pull Request.') | |
177 | elif is_compare: |
|
180 | elif is_compare: | |
178 | placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras)) |
|
181 | placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras)) | |
179 | else: |
|
182 | else: | |
180 | placeholder = _('Leave a comment on this Commit.') |
|
183 | placeholder = _('Leave a comment on this Commit.') | |
181 | %> |
|
184 | %> | |
182 |
|
185 | |||
183 | % if c.rhodecode_user.username != h.DEFAULT_USER: |
|
186 | % if c.rhodecode_user.username != h.DEFAULT_USER: | |
184 | <div class="js-template" id="cb-comment-general-form-template"> |
|
187 | <div class="js-template" id="cb-comment-general-form-template"> | |
185 | ## template generated for injection |
|
188 | ## template generated for injection | |
186 | ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)} |
|
189 | ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)} | |
187 | </div> |
|
190 | </div> | |
188 |
|
191 | |||
189 | <div id="cb-comment-general-form-placeholder" class="comment-form ac"> |
|
192 | <div id="cb-comment-general-form-placeholder" class="comment-form ac"> | |
190 | ## inject form here |
|
193 | ## inject form here | |
191 | </div> |
|
194 | </div> | |
192 | <script type="text/javascript"> |
|
195 | <script type="text/javascript"> | |
193 | var lineNo = 'general'; |
|
196 | var lineNo = 'general'; | |
194 | var resolvesCommentId = null; |
|
197 | var resolvesCommentId = null; | |
195 | var generalCommentForm = Rhodecode.comments.createGeneralComment( |
|
198 | var generalCommentForm = Rhodecode.comments.createGeneralComment( | |
196 | lineNo, "${placeholder}", resolvesCommentId); |
|
199 | lineNo, "${placeholder}", resolvesCommentId); | |
197 |
|
200 | |||
198 | // set custom success callback on rangeCommit |
|
201 | // set custom success callback on rangeCommit | |
199 | % if is_compare: |
|
202 | % if is_compare: | |
200 | generalCommentForm.setHandleFormSubmit(function(o) { |
|
203 | generalCommentForm.setHandleFormSubmit(function(o) { | |
201 | var self = generalCommentForm; |
|
204 | var self = generalCommentForm; | |
202 |
|
205 | |||
203 | var text = self.cm.getValue(); |
|
206 | var text = self.cm.getValue(); | |
204 | var status = self.getCommentStatus(); |
|
207 | var status = self.getCommentStatus(); | |
205 | var commentType = self.getCommentType(); |
|
208 | var commentType = self.getCommentType(); | |
206 |
|
209 | |||
207 | if (text === "" && !status) { |
|
210 | if (text === "" && !status) { | |
208 | return; |
|
211 | return; | |
209 | } |
|
212 | } | |
210 |
|
213 | |||
211 | // we can pick which commits we want to make the comment by |
|
214 | // we can pick which commits we want to make the comment by | |
212 | // selecting them via click on preview pane, this will alter the hidden inputs |
|
215 | // selecting them via click on preview pane, this will alter the hidden inputs | |
213 | var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0; |
|
216 | var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0; | |
214 |
|
217 | |||
215 | var commitIds = []; |
|
218 | var commitIds = []; | |
216 | $('#changeset_compare_view_content .compare_select').each(function(el) { |
|
219 | $('#changeset_compare_view_content .compare_select').each(function(el) { | |
217 | var commitId = this.id.replace('row-', ''); |
|
220 | var commitId = this.id.replace('row-', ''); | |
218 | if ($(this).hasClass('hl') || !cherryPicked) { |
|
221 | if ($(this).hasClass('hl') || !cherryPicked) { | |
219 | $("input[data-commit-id='{0}']".format(commitId)).val(commitId); |
|
222 | $("input[data-commit-id='{0}']".format(commitId)).val(commitId); | |
220 | commitIds.push(commitId); |
|
223 | commitIds.push(commitId); | |
221 | } else { |
|
224 | } else { | |
222 | $("input[data-commit-id='{0}']".format(commitId)).val('') |
|
225 | $("input[data-commit-id='{0}']".format(commitId)).val('') | |
223 | } |
|
226 | } | |
224 | }); |
|
227 | }); | |
225 |
|
228 | |||
226 | self.setActionButtonsDisabled(true); |
|
229 | self.setActionButtonsDisabled(true); | |
227 | self.cm.setOption("readOnly", true); |
|
230 | self.cm.setOption("readOnly", true); | |
228 | var postData = { |
|
231 | var postData = { | |
229 | 'text': text, |
|
232 | 'text': text, | |
230 | 'changeset_status': status, |
|
233 | 'changeset_status': status, | |
231 | 'comment_type': commentType, |
|
234 | 'comment_type': commentType, | |
232 | 'commit_ids': commitIds, |
|
235 | 'commit_ids': commitIds, | |
233 | 'csrf_token': CSRF_TOKEN |
|
236 | 'csrf_token': CSRF_TOKEN | |
234 | }; |
|
237 | }; | |
235 |
|
238 | |||
236 | var submitSuccessCallback = function(o) { |
|
239 | var submitSuccessCallback = function(o) { | |
237 | location.reload(true); |
|
240 | location.reload(true); | |
238 | }; |
|
241 | }; | |
239 | var submitFailCallback = function(){ |
|
242 | var submitFailCallback = function(){ | |
240 | self.resetCommentFormState(text) |
|
243 | self.resetCommentFormState(text) | |
241 | }; |
|
244 | }; | |
242 | self.submitAjaxPOST( |
|
245 | self.submitAjaxPOST( | |
243 | self.submitUrl, postData, submitSuccessCallback, submitFailCallback); |
|
246 | self.submitUrl, postData, submitSuccessCallback, submitFailCallback); | |
244 | }); |
|
247 | }); | |
245 | % endif |
|
248 | % endif | |
246 |
|
249 | |||
247 |
|
250 | |||
248 | </script> |
|
251 | </script> | |
249 | % else: |
|
252 | % else: | |
250 | ## form state when not logged in |
|
253 | ## form state when not logged in | |
251 | <div class="comment-form ac"> |
|
254 | <div class="comment-form ac"> | |
252 |
|
255 | |||
253 | <div class="comment-area"> |
|
256 | <div class="comment-area"> | |
254 | <div class="comment-area-header"> |
|
257 | <div class="comment-area-header"> | |
255 | <ul class="nav-links clearfix"> |
|
258 | <ul class="nav-links clearfix"> | |
256 | <li class="active"> |
|
259 | <li class="active"> | |
257 | <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a> |
|
260 | <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a> | |
258 | </li> |
|
261 | </li> | |
259 | <li class=""> |
|
262 | <li class=""> | |
260 | <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a> |
|
263 | <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a> | |
261 | </li> |
|
264 | </li> | |
262 | </ul> |
|
265 | </ul> | |
263 | </div> |
|
266 | </div> | |
264 |
|
267 | |||
265 | <div class="comment-area-write" style="display: block;"> |
|
268 | <div class="comment-area-write" style="display: block;"> | |
266 | <div id="edit-container"> |
|
269 | <div id="edit-container"> | |
267 | <div style="padding: 40px 0"> |
|
270 | <div style="padding: 40px 0"> | |
268 | ${_('You need to be logged in to leave comments.')} |
|
271 | ${_('You need to be logged in to leave comments.')} | |
269 | <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a> |
|
272 | <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a> | |
270 | </div> |
|
273 | </div> | |
271 | </div> |
|
274 | </div> | |
272 | <div id="preview-container" class="clearfix" style="display: none;"> |
|
275 | <div id="preview-container" class="clearfix" style="display: none;"> | |
273 | <div id="preview-box" class="preview-box"></div> |
|
276 | <div id="preview-box" class="preview-box"></div> | |
274 | </div> |
|
277 | </div> | |
275 | </div> |
|
278 | </div> | |
276 |
|
279 | |||
277 | <div class="comment-area-footer"> |
|
280 | <div class="comment-area-footer"> | |
278 | <div class="toolbar"> |
|
281 | <div class="toolbar"> | |
279 | <div class="toolbar-text"> |
|
282 | <div class="toolbar-text"> | |
280 | </div> |
|
283 | </div> | |
281 | </div> |
|
284 | </div> | |
282 | </div> |
|
285 | </div> | |
283 | </div> |
|
286 | </div> | |
284 |
|
287 | |||
285 | <div class="comment-footer"> |
|
288 | <div class="comment-footer"> | |
286 | </div> |
|
289 | </div> | |
287 |
|
290 | |||
288 | </div> |
|
291 | </div> | |
289 | % endif |
|
292 | % endif | |
290 |
|
293 | |||
291 | <script type="text/javascript"> |
|
294 | <script type="text/javascript"> | |
292 | bindToggleButtons(); |
|
295 | bindToggleButtons(); | |
293 | </script> |
|
296 | </script> | |
294 | </div> |
|
297 | </div> | |
295 | </%def> |
|
298 | </%def> | |
296 |
|
299 | |||
297 |
|
300 | |||
298 | <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)"> |
|
301 | <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)"> | |
299 | ## comment injected based on assumption that user is logged in |
|
302 | ## comment injected based on assumption that user is logged in | |
300 |
|
303 | |||
301 | <form ${'id="{}"'.format(form_id) if form_id else '' |n} action="#" method="GET"> |
|
304 | <form ${'id="{}"'.format(form_id) if form_id else '' |n} action="#" method="GET"> | |
302 |
|
305 | |||
303 | <div class="comment-area"> |
|
306 | <div class="comment-area"> | |
304 | <div class="comment-area-header"> |
|
307 | <div class="comment-area-header"> | |
305 | <ul class="nav-links clearfix"> |
|
308 | <ul class="nav-links clearfix"> | |
306 | <li class="active"> |
|
309 | <li class="active"> | |
307 | <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a> |
|
310 | <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a> | |
308 | </li> |
|
311 | </li> | |
309 | <li class=""> |
|
312 | <li class=""> | |
310 | <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a> |
|
313 | <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a> | |
311 | </li> |
|
314 | </li> | |
312 | <li class="pull-right"> |
|
315 | <li class="pull-right"> | |
313 | <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type"> |
|
316 | <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type"> | |
314 | % for val in c.visual.comment_types: |
|
317 | % for val in c.visual.comment_types: | |
315 | <option value="${val}">${val.upper()}</option> |
|
318 | <option value="${val}">${val.upper()}</option> | |
316 | % endfor |
|
319 | % endfor | |
317 | </select> |
|
320 | </select> | |
318 | </li> |
|
321 | </li> | |
319 | </ul> |
|
322 | </ul> | |
320 | </div> |
|
323 | </div> | |
321 |
|
324 | |||
322 | <div class="comment-area-write" style="display: block;"> |
|
325 | <div class="comment-area-write" style="display: block;"> | |
323 | <div id="edit-container_${lineno_id}"> |
|
326 | <div id="edit-container_${lineno_id}"> | |
324 | <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea> |
|
327 | <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea> | |
325 | </div> |
|
328 | </div> | |
326 | <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;"> |
|
329 | <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;"> | |
327 | <div id="preview-box_${lineno_id}" class="preview-box"></div> |
|
330 | <div id="preview-box_${lineno_id}" class="preview-box"></div> | |
328 | </div> |
|
331 | </div> | |
329 | </div> |
|
332 | </div> | |
330 |
|
333 | |||
331 | <div class="comment-area-footer"> |
|
334 | <div class="comment-area-footer"> | |
332 | <div class="toolbar"> |
|
335 | <div class="toolbar"> | |
333 | <div class="toolbar-text"> |
|
336 | <div class="toolbar-text"> | |
334 | ${(_('Comments parsed using %s syntax with %s support.') % ( |
|
337 | ${(_('Comments parsed using %s syntax with %s support.') % ( | |
335 | ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())), |
|
338 | ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())), | |
336 | ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')) |
|
339 | ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')) | |
337 | ) |
|
340 | ) | |
338 | )|n} |
|
341 | )|n} | |
339 | </div> |
|
342 | </div> | |
340 | </div> |
|
343 | </div> | |
341 | </div> |
|
344 | </div> | |
342 | </div> |
|
345 | </div> | |
343 |
|
346 | |||
344 | <div class="comment-footer"> |
|
347 | <div class="comment-footer"> | |
345 |
|
348 | |||
346 | % if review_statuses: |
|
349 | % if review_statuses: | |
347 | <div class="status_box"> |
|
350 | <div class="status_box"> | |
348 | <select id="change_status_${lineno_id}" name="changeset_status"> |
|
351 | <select id="change_status_${lineno_id}" name="changeset_status"> | |
349 | <option></option> ## Placeholder |
|
352 | <option></option> ## Placeholder | |
350 | % for status, lbl in review_statuses: |
|
353 | % for status, lbl in review_statuses: | |
351 | <option value="${status}" data-status="${status}">${lbl}</option> |
|
354 | <option value="${status}" data-status="${status}">${lbl}</option> | |
352 | %if is_pull_request and change_status and status in ('approved', 'rejected'): |
|
355 | %if is_pull_request and change_status and status in ('approved', 'rejected'): | |
353 | <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option> |
|
356 | <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option> | |
354 | %endif |
|
357 | %endif | |
355 | % endfor |
|
358 | % endfor | |
356 | </select> |
|
359 | </select> | |
357 | </div> |
|
360 | </div> | |
358 | % endif |
|
361 | % endif | |
359 |
|
362 | |||
360 | ## inject extra inputs into the form |
|
363 | ## inject extra inputs into the form | |
361 | % if form_extras and isinstance(form_extras, (list, tuple)): |
|
364 | % if form_extras and isinstance(form_extras, (list, tuple)): | |
362 | <div id="comment_form_extras"> |
|
365 | <div id="comment_form_extras"> | |
363 | % for form_ex_el in form_extras: |
|
366 | % for form_ex_el in form_extras: | |
364 | ${form_ex_el|n} |
|
367 | ${form_ex_el|n} | |
365 | % endfor |
|
368 | % endfor | |
366 | </div> |
|
369 | </div> | |
367 | % endif |
|
370 | % endif | |
368 |
|
371 | |||
369 | <div class="action-buttons"> |
|
372 | <div class="action-buttons"> | |
370 | ## inline for has a file, and line-number together with cancel hide button. |
|
373 | ## inline for has a file, and line-number together with cancel hide button. | |
371 | % if form_type == 'inline': |
|
374 | % if form_type == 'inline': | |
372 | <input type="hidden" name="f_path" value="{0}"> |
|
375 | <input type="hidden" name="f_path" value="{0}"> | |
373 | <input type="hidden" name="line" value="${lineno_id}"> |
|
376 | <input type="hidden" name="line" value="${lineno_id}"> | |
374 | <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);"> |
|
377 | <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);"> | |
375 | ${_('Cancel')} |
|
378 | ${_('Cancel')} | |
376 | </button> |
|
379 | </button> | |
377 | % endif |
|
380 | % endif | |
378 | ${h.submit('save', _('Comment'), class_='btn btn-success comment-button-input')} |
|
381 | ${h.submit('save', _('Comment'), class_='btn btn-success comment-button-input')} | |
379 |
|
382 | |||
380 | </div> |
|
383 | </div> | |
381 | </div> |
|
384 | </div> | |
382 |
|
385 | |||
383 | </form> |
|
386 | </form> | |
384 |
|
387 | |||
385 | </%def> No newline at end of file |
|
388 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now