Mercurial > kallithea
comparison 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 |
comparison
equal
deleted
inserted
replaced
3694:34093903b505 | 3695:45df84d36b44 |
---|---|
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}">¶</a> | 15 ${h.age(co.modified_at)} |
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;">›</span></div> | 19 <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">›</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> | 22 </div> |
23 %endif | 23 %endif |
24 | 24 |
25 <div style="float:left;padding:3px 0px 0px 5px"> | 25 <div style="float:left;padding:4px 0px 0px 5px"> |
26 <span class=""> | 26 <span class=""> |
27 %if co.pull_request: | 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)}"> | 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: | 29 %if co.status_change: |
30 ${_('Status change on pull request #%s') % co.pull_request.pull_request_id} | 30 ${_('Status change on pull request #%s') % co.pull_request.pull_request_id} |
33 %endif | 33 %endif |
34 </a> | 34 </a> |
35 %endif | 35 %endif |
36 </span> | 36 </span> |
37 </div> | 37 </div> |
38 | 38 <a class="permalink" href="#comment-${co.comment_id}">¶</a> |
39 %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: |
40 <div class="buttons"> | 40 <div onClick="deleteComment(${co.comment_id})" class="buttons delete-comment ui-btn small">${_('Delete')}</div> |
41 <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span> | |
42 </div> | |
43 %endif | 41 %endif |
44 </div> | 42 </div> |
45 <div class="text"> | 43 <div class="text"> |
46 ${h.rst_w_mentions(co.text)|n} | 44 ${h.rst_w_mentions(co.text)|n} |
47 </div> | 45 </div> |
54 <div id='comment-inline-form-template' style="display:none"> | 52 <div id='comment-inline-form-template' style="display:none"> |
55 <div class="comment-inline-form ac"> | 53 <div class="comment-inline-form ac"> |
56 %if c.rhodecode_user.username != 'default': | 54 %if c.rhodecode_user.username != 'default': |
57 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div> | 55 <div class="overlay"><div class="overlay-text">${_('Submitting...')}</div></div> |
58 ${h.form('#', class_='inline-form')} | 56 ${h.form('#', class_='inline-form')} |
59 <div class="clearfix"> | 57 <div id="edit-container_{1}" class="clearfix"> |
60 <div class="comment-help">${_('Commenting on line {1}.')} | 58 <div class="comment-help">${_('Commenting on line {1}.')} |
61 ${(_('Comments parsed using %s syntax with %s support.') % ( | 59 ${(_('Comments parsed using %s syntax with %s support.') % ( |
62 ('<a href="%s">RST</a>' % h.url('rst_help')), | 60 ('<a href="%s">RST</a>' % h.url('rst_help')), |
63 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')) | 61 ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')) |
64 ) | 62 ) |
65 )|n | 63 )|n |
66 } | 64 } |
65 <div id="preview-btn_{1}" class="preview-btn ui-btn small">${_('preview')}</div> | |
67 </div> | 66 </div> |
68 <div class="mentions-container" id="mentions_container_{1}"></div> | 67 <div class="mentions-container" id="mentions_container_{1}"></div> |
69 <textarea id="text_{1}" name="text" class="yui-ac-input"></textarea> | 68 <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea> |
69 </div> | |
70 <div id="preview-container_{1}" class="clearfix" style="display:none"> | |
71 <div class="comment-help"> | |
72 ${_('Comment Preview')} | |
73 <div id="edit-btn_{1}" class="edit-btn ui-btn small">${_('edit')}</div> | |
74 </div> | |
75 <div id="preview-box_{1}" class="preview-box"></div> | |
70 </div> | 76 </div> |
71 <div class="comment-button"> | 77 <div class="comment-button"> |
72 <input type="hidden" name="f_path" value="{0}"> | 78 <input type="hidden" name="f_path" value="{0}"> |
73 <input type="hidden" name="line" value="{1}"> | 79 <input type="hidden" name="line" value="{1}"> |
74 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')} | 80 ${h.submit('save', _('Comment'), class_='ui-btn save-inline-form')} |
132 | 138 |
133 <div class="comments"> | 139 <div class="comments"> |
134 %if c.rhodecode_user.username != 'default': | 140 %if c.rhodecode_user.username != 'default': |
135 <div class="comment-form ac"> | 141 <div class="comment-form ac"> |
136 ${h.form(post_url)} | 142 ${h.form(post_url)} |
137 <div class="clearfix"> | 143 <div id="edit-container" class="clearfix"> |
138 <div class="comment-help"> | 144 <div class="comment-help"> |
139 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')), | 145 ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')), |
140 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % | 146 '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % |
141 _('Use @username inside this text to send notification to this RhodeCode user')))|n} | 147 _('Use @username inside this text to send notification to this RhodeCode user')))|n} |
142 %if change_status: | 148 %if change_status: |
143 | <a id="show_changeset_link" onClick="change_status_show();"> ${_('Change status')}</a> | 149 | <a id="show_changeset_link" onClick="change_status_show();"> ${_('Change status')}</a> |
144 <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" /> | 150 <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" /> |
145 %endif | 151 %endif |
152 <div id="preview-btn" class="preview-btn ui-btn small">${_('preview')}</div> | |
146 </div> | 153 </div> |
147 %if change_status: | 154 %if change_status: |
148 <div id="status_block_container" class="status-block" style="display:none"> | 155 <div id="status_block_container" class="status-block" style="display:none"> |
149 %for status,lbl in c.changeset_statuses: | 156 %for status,lbl in c.changeset_statuses: |
150 <div class=""> | 157 <div class=""> |
153 </div> | 160 </div> |
154 %endfor | 161 %endfor |
155 </div> | 162 </div> |
156 %endif | 163 %endif |
157 <div class="mentions-container" id="mentions_container"></div> | 164 <div class="mentions-container" id="mentions_container"></div> |
158 ${h.textarea('text')} | 165 ${h.textarea('text', class_="comment-block-ta")} |
159 </div> | 166 </div> |
167 | |
168 <div id="preview-container" class="clearfix" style="display:none"> | |
169 <div class="comment-help"> | |
170 ${_('Comment Preview')} | |
171 <div id="edit-btn" class="edit-btn ui-btn small">${_('edit')}</div> | |
172 </div> | |
173 <div id="preview-box" class="preview-box"></div> | |
174 </div> | |
175 | |
160 <div class="comment-button"> | 176 <div class="comment-button"> |
161 ${h.submit('save', _('Comment'), class_="ui-btn large")} | 177 ${h.submit('save', _('Comment'), class_="ui-btn large")} |
162 %if close_btn and change_status: | 178 %if close_btn and change_status: |
163 ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % ('hidden' if cur_status in ['not_reviewed','under_review'] else ''))} | 179 ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % ('hidden' if cur_status in ['not_reviewed','under_review'] else ''))} |
164 %endif | 180 %endif |
183 YUD.removeClass('save_close', 'hidden'); | 199 YUD.removeClass('save_close', 'hidden'); |
184 }else{ | 200 }else{ |
185 YUD.addClass('save_close', 'hidden'); | 201 YUD.addClass('save_close', 'hidden'); |
186 } | 202 } |
187 }) | 203 }) |
204 YUE.on('preview-btn', 'click', function(e){ | |
205 var _text = YUD.get('text').value; | |
206 if(!_text){ | |
207 return | |
208 } | |
209 var post_data = {'text': _text}; | |
210 YUD.addClass('preview-box', 'unloaded'); | |
211 YUD.get('preview-box').innerHTML = _TM['Loading ...']; | |
212 YUD.setStyle('edit-container', 'display', 'none'); | |
213 YUD.setStyle('preview-container', 'display', ''); | |
214 | |
215 var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'}); | |
216 ajaxPOST(url,post_data,function(o){ | |
217 YUD.get('preview-box').innerHTML = o.responseText; | |
218 YUD.removeClass('preview-box', 'unloaded'); | |
219 }) | |
220 }) | |
221 YUE.on('edit-btn', 'click', function(e){ | |
222 YUD.setStyle('edit-container', 'display', ''); | |
223 YUD.setStyle('preview-container', 'display', 'none'); | |
224 }) | |
188 | 225 |
189 }); | 226 }); |
190 </script> | 227 </script> |
191 </%def> | 228 </%def> |