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