Mercurial > kallithea
annotate rhodecode/templates/changeset/changeset_file_comment.html @ 3695:45df84d36b44 beta
Implemented preview for comments
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 06 Apr 2013 02:49:42 +0200 |
parents | 87b0a652b6b1 |
children | 7b5bf8e01325 |
rev | line source |
---|---|
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
1 ## -*- coding: utf-8 -*- |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
2 ## usage: |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
4 ## ${comment.comment_block(co)} |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
5 ## |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
6 <%def name="comment_block(co)"> |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
7 <div class="comment" id="comment-${co.comment_id}" line="${co.line_no}"> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
8 <div class="comment-wrapp"> |
3197 | 9 <div class="meta"> |
2286
9265958e33bb
Show changes of status inside comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2217
diff
changeset
|
10 <div style="float:left"> <img src="${h.gravatar_url(co.author.email, 20)}" /> </div> |
3197 | 11 <div class="user"> |
12 ${co.author.username} | |
13 </div> | |
14 <div class="date"> | |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
15 ${h.age(co.modified_at)} |
3197 | 16 </div> |
2286
9265958e33bb
Show changes of status inside comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2217
diff
changeset
|
17 %if co.status_change: |
9265958e33bb
Show changes of status inside comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2217
diff
changeset
|
18 <div style="float:left" class="changeset-status-container"> |
9265958e33bb
Show changes of status inside comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2217
diff
changeset
|
19 <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">›</span></div> |
2677
4fbbc65e8cd5
Forbid changing changset status when it is associated with a closed pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2673
diff
changeset
|
20 <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div> |
4fbbc65e8cd5
Forbid changing changset status when it is associated with a closed pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2673
diff
changeset
|
21 <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div> |
2286
9265958e33bb
Show changes of status inside comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2217
diff
changeset
|
22 </div> |
2478
8eab81115660
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2439
diff
changeset
|
23 %endif |
3190
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
24 |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
25 <div style="float:left;padding:4px 0px 0px 5px"> |
3190
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
26 <span class=""> |
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
27 %if co.pull_request: |
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
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)}"> |
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
29 %if co.status_change: |
3608
87b0a652b6b1
comments: "Comment on pull request" feels more natural
Mads Kiilerich <madski@unity3d.com>
parents:
3593
diff
changeset
|
30 ${_('Status change on pull request #%s') % co.pull_request.pull_request_id} |
3190
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
31 %else: |
3608
87b0a652b6b1
comments: "Comment on pull request" feels more natural
Mads Kiilerich <madski@unity3d.com>
parents:
3593
diff
changeset
|
32 ${_('Comment on pull request #%s') % co.pull_request.pull_request_id} |
3190
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
33 %endif |
3216
81bbb8086f03
whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
3200
diff
changeset
|
34 </a> |
3190
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
35 %endif |
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
36 </span> |
786236aa313e
Show pull request link also on regular comments that are now attached to separate changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
3176
diff
changeset
|
37 </div> |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
38 <a class="permalink" href="#comment-${co.comment_id}">¶</a> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
39 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id: |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
40 <div onClick="deleteComment(${co.comment_id})" class="buttons delete-comment ui-btn small">${_('Delete')}</div> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
41 %endif |
3197 | 42 </div> |
43 <div class="text"> | |
44 ${h.rst_w_mentions(co.text)|n} | |
45 </div> | |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
46 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
47 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
48 </%def> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
49 |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
50 |
2489
a0adf8db1416
Enabled inline comments in pull-requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2482
diff
changeset
|
51 <%def name="comment_inline_form()"> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
52 <div id='comment-inline-form-template' style="display:none"> |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
53 <div class="comment-inline-form ac"> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
54 %if c.rhodecode_user.username != 'default': |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
55 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div> |
2489
a0adf8db1416
Enabled inline comments in pull-requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2482
diff
changeset
|
56 ${h.form('#', class_='inline-form')} |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
57 <div id="edit-container_{1}" class="clearfix"> |
2307
d2043c703f84
Fixed i18n of the second comment help block.
Vincent Duvert <vincent@duvert.net>
parents:
2302
diff
changeset
|
58 <div class="comment-help">${_('Commenting on line {1}.')} |
2427
f467c75544af
Added h.tooltip to all places that tooltip_title is used.
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
59 ${(_('Comments parsed using %s syntax with %s support.') % ( |
f467c75544af
Added h.tooltip to all places that tooltip_title is used.
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
60 ('<a href="%s">RST</a>' % h.url('rst_help')), |
3197 | 61 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')) |
2427
f467c75544af
Added h.tooltip to all places that tooltip_title is used.
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
62 ) |
f467c75544af
Added h.tooltip to all places that tooltip_title is used.
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
63 )|n |
f467c75544af
Added h.tooltip to all places that tooltip_title is used.
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
64 } |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
65 <div id="preview-btn_{1}" class="preview-btn ui-btn small">${_('preview')}</div> |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2310
diff
changeset
|
66 </div> |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2310
diff
changeset
|
67 <div class="mentions-container" id="mentions_container_{1}"></div> |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
68 <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
69 </div> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
70 <div id="preview-container_{1}" class="clearfix" style="display:none"> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
71 <div class="comment-help"> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
72 ${_('Comment Preview')} |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
73 <div id="edit-btn_{1}" class="edit-btn ui-btn small">${_('edit')}</div> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
74 </div> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
75 <div id="preview-box_{1}" class="preview-box"></div> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
76 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
77 <div class="comment-button"> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
78 <input type="hidden" name="f_path" value="{0}"> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
79 <input type="hidden" name="line" value="{1}"> |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
80 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')} |
3254
6dd1e4d60720
changeset comment: new uncommitted comments can be cancelled - not just hidden
Mads Kiilerich <madski@unity3d.com>
parents:
3249
diff
changeset
|
81 ${h.reset('hide-inline-form', _('Cancel'), class_='ui-btn hide-inline-form')} |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
82 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
83 ${h.end_form()} |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
84 %else: |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
85 ${h.form('')} |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
86 <div class="clearfix"> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
87 <div class="comment-help"> |
2302
66fa6c434ce4
Improved i18n of the changeset inline comment section.
Vincent Duvert <vincent@duvert.net>
parents:
2189
diff
changeset
|
88 ${_('You need to be logged in to comment.')} <a href="${h.url('login_home',came_from=h.url.current())}">${_('Login now')}</a> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
89 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
90 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
91 <div class="comment-button"> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
92 ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')} |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
93 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
94 ${h.end_form()} |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
95 %endif |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
96 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
97 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
98 </%def> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
99 |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
100 |
2439
ad19dfcdb1cc
Refactoring of changeset_file_comments for more generic usage. In both It enables sharing code between changeset, and pull requests discussions
Marcin Kuzminski <marcin@python-works.com>
parents:
2430
diff
changeset
|
101 ## generates inlines taken from c.comments var |
ad19dfcdb1cc
Refactoring of changeset_file_comments for more generic usage. In both It enables sharing code between changeset, and pull requests discussions
Marcin Kuzminski <marcin@python-works.com>
parents:
2430
diff
changeset
|
102 <%def name="inlines()"> |
2310
83e4447077d3
Improved i18n for the comment count (use of ngettext for pluralisation).
Vincent Duvert <vincent@duvert.net>
parents:
2307
diff
changeset
|
103 <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> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
104 %for path, lines in c.inline_comments: |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
105 % for line,comments in lines.iteritems(): |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
106 <div style="display:none" class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}"> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
107 %for co in comments: |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
108 ${comment_block(co)} |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
109 %endfor |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
110 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
111 %endfor |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
112 %endfor |
2188
56e96d4e9f6e
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
113 |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
114 </%def> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
115 |
2608
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
116 ## generate inline comments and the main ones |
3229
aad51f79d040
added a flag for generating pull-request comments, and force display on pull-requests
Marcin Kuzminski <marcin@python-works.com>
parents:
3216
diff
changeset
|
117 <%def name="generate_comments(include_pr=False)"> |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
118 <div class="comments"> |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
119 <div id="inline-comments-container"> |
2439
ad19dfcdb1cc
Refactoring of changeset_file_comments for more generic usage. In both It enables sharing code between changeset, and pull requests discussions
Marcin Kuzminski <marcin@python-works.com>
parents:
2430
diff
changeset
|
120 ## generate inlines for this changeset |
ad19dfcdb1cc
Refactoring of changeset_file_comments for more generic usage. In both It enables sharing code between changeset, and pull requests discussions
Marcin Kuzminski <marcin@python-works.com>
parents:
2430
diff
changeset
|
121 ${inlines()} |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
1888
diff
changeset
|
122 </div> |
2188
56e96d4e9f6e
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
123 |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
124 %for co in c.comments: |
2189
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2188
diff
changeset
|
125 <div id="comment-tr-${co.comment_id}"> |
3200
89931a504fcf
remove comments associated to pull request from single changesets, it's too confusing.
Marcin Kuzminski <marcin@python-works.com>
parents:
3197
diff
changeset
|
126 ## only render comments that are not from pull request, or from |
89931a504fcf
remove comments associated to pull request from single changesets, it's too confusing.
Marcin Kuzminski <marcin@python-works.com>
parents:
3197
diff
changeset
|
127 ## pull request and a status change |
3229
aad51f79d040
added a flag for generating pull-request comments, and force display on pull-requests
Marcin Kuzminski <marcin@python-works.com>
parents:
3216
diff
changeset
|
128 %if not co.pull_request or (co.pull_request and co.status_change) or include_pr: |
2189
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2188
diff
changeset
|
129 ${comment_block(co)} |
3200
89931a504fcf
remove comments associated to pull request from single changesets, it's too confusing.
Marcin Kuzminski <marcin@python-works.com>
parents:
3197
diff
changeset
|
130 %endif |
2189
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2188
diff
changeset
|
131 </div> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
132 %endfor |
2673
d5e42c00f3c1
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
133 </div> |
2608
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
134 </%def> |
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
135 |
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
136 ## MAIN COMMENT FORM |
3104
c77d5c6358eb
Implemented #670 Implementation of Roles in Pull Request
Marcin Kuzminski <marcin@python-works.com>
parents:
3103
diff
changeset
|
137 <%def name="comments(post_url, cur_status, close_btn=False, change_status=True)"> |
2608
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
138 |
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
139 <div class="comments"> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
140 %if c.rhodecode_user.username != 'default': |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2310
diff
changeset
|
141 <div class="comment-form ac"> |
2439
ad19dfcdb1cc
Refactoring of changeset_file_comments for more generic usage. In both It enables sharing code between changeset, and pull requests discussions
Marcin Kuzminski <marcin@python-works.com>
parents:
2430
diff
changeset
|
142 ${h.form(post_url)} |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
143 <div id="edit-container" class="clearfix"> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
144 <div class="comment-help"> |
2307
d2043c703f84
Fixed i18n of the second comment help block.
Vincent Duvert <vincent@duvert.net>
parents:
2302
diff
changeset
|
145 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')), |
3197 | 146 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % |
147 _('Use @username inside this text to send notification to this RhodeCode user')))|n} | |
3104
c77d5c6358eb
Implemented #670 Implementation of Roles in Pull Request
Marcin Kuzminski <marcin@python-works.com>
parents:
3103
diff
changeset
|
148 %if change_status: |
3593
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
149 | <a id="show_changeset_link" onClick="change_status_show();"> ${_('Change status')}</a> |
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
150 <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" /> |
3104
c77d5c6358eb
Implemented #670 Implementation of Roles in Pull Request
Marcin Kuzminski <marcin@python-works.com>
parents:
3103
diff
changeset
|
151 %endif |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
152 <div id="preview-btn" class="preview-btn ui-btn small">${_('preview')}</div> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
153 </div> |
3104
c77d5c6358eb
Implemented #670 Implementation of Roles in Pull Request
Marcin Kuzminski <marcin@python-works.com>
parents:
3103
diff
changeset
|
154 %if change_status: |
2217
76947224bf27
Implemented initial code-review status of changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
155 <div id="status_block_container" class="status-block" style="display:none"> |
76947224bf27
Implemented initial code-review status of changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
156 %for status,lbl in c.changeset_statuses: |
76947224bf27
Implemented initial code-review status of changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
157 <div class=""> |
3149
68f9c216377d
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
3104
diff
changeset
|
158 <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}"> |
3102
7251b3286077
fixed changeset status labels, they now select radio buttons
Marcin Kuzminski <marcin@python-works.com>
parents:
2990
diff
changeset
|
159 <label for="${status}">${lbl}</label> |
2478
8eab81115660
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2439
diff
changeset
|
160 </div> |
2217
76947224bf27
Implemented initial code-review status of changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
161 %endfor |
2478
8eab81115660
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2439
diff
changeset
|
162 </div> |
3104
c77d5c6358eb
Implemented #670 Implementation of Roles in Pull Request
Marcin Kuzminski <marcin@python-works.com>
parents:
3103
diff
changeset
|
163 %endif |
2391 | 164 <div class="mentions-container" id="mentions_container"></div> |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
165 ${h.textarea('text', class_="comment-block-ta")} |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
166 </div> |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
167 |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
168 <div id="preview-container" class="clearfix" style="display:none"> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
169 <div class="comment-help"> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
170 ${_('Comment Preview')} |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
171 <div id="edit-btn" class="edit-btn ui-btn small">${_('edit')}</div> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
172 </div> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
173 <div id="preview-box" class="preview-box"></div> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
174 </div> |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
175 |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
176 <div class="comment-button"> |
2608
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
177 ${h.submit('save', _('Comment'), class_="ui-btn large")} |
3104
c77d5c6358eb
Implemented #670 Implementation of Roles in Pull Request
Marcin Kuzminski <marcin@python-works.com>
parents:
3103
diff
changeset
|
178 %if close_btn and change_status: |
c77d5c6358eb
Implemented #670 Implementation of Roles in Pull Request
Marcin Kuzminski <marcin@python-works.com>
parents:
3103
diff
changeset
|
179 ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % ('hidden' if cur_status in ['not_reviewed','under_review'] else ''))} |
2608
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2489
diff
changeset
|
180 %endif |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
181 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
182 ${h.end_form()} |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
183 </div> |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
184 %endif |
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
185 </div> |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2310
diff
changeset
|
186 <script> |
3593
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
187 var change_status_show = function(){ |
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
188 var show = ! YUD.get('show_changeset_status_box').checked; |
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
189 YUD.get('show_changeset_status_box').checked = show; |
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
190 YUD.setStyle('status_block_container', 'display', show?'':'none'); |
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
191 }; |
716ac7659b90
pullrequest: use simple link for 'Change style'
Mads Kiilerich <madski@unity3d.com>
parents:
3311
diff
changeset
|
192 |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2310
diff
changeset
|
193 YUE.onDOMReady(function () { |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
194 MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA); |
2478
8eab81115660
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2439
diff
changeset
|
195 |
3103
91492a72b2dc
implements #677: Don't allow to close pull requests when they are under-review state
Marcin Kuzminski <marcin@python-works.com>
parents:
3102
diff
changeset
|
196 YUE.on(YUQ('.status_change_radio'), 'change',function(e){ |
3197 | 197 var val = e.currentTarget.value; |
198 if (val == 'approved' || val == 'rejected') { | |
199 YUD.removeClass('save_close', 'hidden'); | |
200 }else{ | |
201 YUD.addClass('save_close', 'hidden'); | |
202 } | |
3103
91492a72b2dc
implements #677: Don't allow to close pull requests when they are under-review state
Marcin Kuzminski <marcin@python-works.com>
parents:
3102
diff
changeset
|
203 }) |
3695
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
204 YUE.on('preview-btn', 'click', function(e){ |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
205 var _text = YUD.get('text').value; |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
206 if(!_text){ |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
207 return |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
208 } |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
209 var post_data = {'text': _text}; |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
210 YUD.addClass('preview-box', 'unloaded'); |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
211 YUD.get('preview-box').innerHTML = _TM['Loading ...']; |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
212 YUD.setStyle('edit-container', 'display', 'none'); |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
213 YUD.setStyle('preview-container', 'display', ''); |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
214 |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
215 var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'}); |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
216 ajaxPOST(url,post_data,function(o){ |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
217 YUD.get('preview-box').innerHTML = o.responseText; |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
218 YUD.removeClass('preview-box', 'unloaded'); |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
219 }) |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
220 }) |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
221 YUE.on('edit-btn', 'click', function(e){ |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
222 YUD.setStyle('edit-container', 'display', ''); |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
223 YUD.setStyle('preview-container', 'display', 'none'); |
45df84d36b44
Implemented preview for comments
Marcin Kuzminski <marcin@python-works.com>
parents:
3608
diff
changeset
|
224 }) |
2478
8eab81115660
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2439
diff
changeset
|
225 |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2310
diff
changeset
|
226 }); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2310
diff
changeset
|
227 </script> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1860
diff
changeset
|
228 </%def> |