##// END OF EJS Templates
#71 code review...
marcink -
r1674:6f0143e5 beta
parent child Browse files
Show More
@@ -352,7 +352,7 b' def make_map(config):'
352 352
353 353 rmap.connect('changeset_comment_delete', '/{repo_name:.*}/changeset/comment/{comment_id}/delete',
354 354 controller='changeset', action='delete_comment',
355 conditions=dict(function=check_repo))
355 conditions = dict(function=check_repo, method=["DELETE"]))
356 356
357 357 rmap.connect('raw_changeset_home',
358 358 '/{repo_name:.*}/raw-changeset/{revision}',
@@ -44,6 +44,7 b' from vcs.exceptions import RepositoryErr'
44 44 ChangesetDoesNotExistError
45 45 from vcs.nodes import FileNode
46 46 from vcs.utils import diffs as differ
47 from webob.exc import HTTPForbidden
47 48
48 49 log = logging.getLogger(__name__)
49 50
@@ -278,8 +279,13 b' class ChangesetController(BaseRepoContro'
278 279 revision=revision))
279 280
280 281 @jsonify
281 @HasRepoPermissionAnyDecorator('hg.admin', 'repository.admin')
282 282 def delete_comment(self, comment_id):
283 ccmodel = ChangesetCommentsModel()
284 ccmodel.delete(comment_id=comment_id)
285 return True
283 co = ChangesetComment.get(comment_id)
284 if (h.HasPermissionAny('hg.admin', 'repository.admin')() or
285 co.author.user_id == c.rhodecode_user.user_id):
286 ccmodel = ChangesetCommentsModel()
287 ccmodel.delete(comment_id=comment_id)
288 return True
289 else:
290 raise HTTPForbidden()
291
@@ -3263,9 +3263,8 b' div.rst-block pre {'
3263 3263 }
3264 3264
3265 3265 .comments .comment .text {
3266 margin-top: 7px;
3267 padding: 6px;
3268 padding-bottom: 13px;
3266 padding: 8px 6px 6px 14px;
3267 background-color: #FAFAFA;
3269 3268 }
3270 3269
3271 3270 .comments .comments-number{
@@ -3330,6 +3329,6 b' form.comment-form {'
3330 3329 }
3331 3330
3332 3331 .comment .buttons {
3333 float: right;
3334 display: none;
3335 }
3332 position: absolute;
3333 right:40px;
3334 }
@@ -286,5 +286,15 b' var q_filter = function(target,nodes,dis'
286 286 }
287 287 }
288 288
289 var ajaxPOST = function(url,postData,success) {
290 var sUrl = url;
291 var callback = {
292 success: success,
293 failure: function (o) {
294 alert("error");
295 },
296 };
297 var postData = postData;
298 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
299 };
289 300
290
@@ -158,6 +158,17 b''
158 158 </div>
159 159 %endif
160 160 </div>
161
161 <script type="text/javascript">
162 var deleteComment = function(comment_id){
163
164 var url = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}".replace('__COMMENT_ID__',comment_id);
165 var postData = '_method=delete';
166 var success = function(o){
167 var n = YUD.get('comment-'+comment_id);
168 n.parentNode.removeChild(n);
169 }
170 ajaxPOST(url,postData,success);
171 }
172 </script>
162 173 </div>
163 174 </%def>
@@ -22,7 +22,7 b''
22 22 <div class="text">
23 23 %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
24 24 <div class="buttons">
25 <a href="javascript:void(0);" onClick="deleteComment(${co.comment_id})" class="">${_('Delete')}</a>
25 <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-button-small">${_('Delete')}</span>
26 26 </div>
27 27 %endif
28 28 ${h.rst(co.text)|n}
General Comments 0
You need to be logged in to leave comments. Login now