@@ -349,13 +349,13 @@ def make_map(config):
rmap.connect('changeset_comment', '/{repo_name:.*}/changeset/{revision}/comment',
controller='changeset', revision='tip', action='comment',
conditions=dict(function=check_repo))
rmap.connect('changeset_comment_delete', '/{repo_name:.*}/changeset/comment/{comment_id}/delete',
controller='changeset', action='delete_comment',
conditions = dict(function=check_repo, method=["DELETE"]))
rmap.connect('raw_changeset_home',
'/{repo_name:.*}/raw-changeset/{revision}',
controller='changeset', action='raw_changeset',
revision='tip', conditions=dict(function=check_repo))
@@ -41,12 +41,13 @@ from rhodecode.model.db import Changeset
from rhodecode.model.comment import ChangesetCommentsModel
from vcs.exceptions import RepositoryError, ChangesetError, \
ChangesetDoesNotExistError
from vcs.nodes import FileNode
from vcs.utils import diffs as differ
from webob.exc import HTTPForbidden
log = logging.getLogger(__name__)
class ChangesetController(BaseRepoController):
@@ -275,11 +276,16 @@ class ChangesetController(BaseRepoContro
line_no = request.POST.get('line'))
return redirect(h.url('changeset_home', repo_name=repo_name,
revision=revision))
@jsonify
@HasRepoPermissionAnyDecorator('hg.admin', 'repository.admin')
def delete_comment(self, comment_id):
ccmodel = ChangesetCommentsModel()
ccmodel.delete(comment_id=comment_id)
return True
co = ChangesetComment.get(comment_id)
if (h.HasPermissionAny('hg.admin', 'repository.admin')() or
co.author.user_id == c.rhodecode_user.user_id):
else:
raise HTTPForbidden()
@@ -3260,15 +3260,14 @@ div.rst-block pre {
.comments .comment .meta .date {
float: right;
}
.comments .comment .text {
margin-top: 7px;
padding: 6px;
padding-bottom: 13px;
padding: 8px 6px 6px 14px;
background-color: #FAFAFA;
.comments .comments-number{
padding:0px 0px 10px 0px;
font-weight: bold;
@@ -3327,9 +3326,9 @@ form.comment-form {
margin-left: 10px;
margin-top: 10px;
margin-bottom: 10px;
.comment .buttons {
display: none;
position: absolute;
right:40px;
@@ -283,8 +283,18 @@ var q_filter = function(target,nodes,dis
YUD.get('repo_count').innerHTML = showing;
var ajaxPOST = function(url,postData,success) {
var sUrl = url;
var callback = {
success: success,
failure: function (o) {
alert("error");
},
};
var postData = postData;
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
@@ -155,9 +155,20 @@
${h.submit('save', _('Comment'), class_='ui-button')}
</div>
${h.end_form()}
%endif
<script type="text/javascript">
var deleteComment = function(comment_id){
var url = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}".replace('__COMMENT_ID__',comment_id);
var postData = '_method=delete';
var success = function(o){
var n = YUD.get('comment-'+comment_id);
n.parentNode.removeChild(n);
ajaxPOST(url,postData,success);
</script>
</%def>
@@ -19,13 +19,13 @@
${h.age(co.modified_at)}
</span>
<div class="text">
%if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
<div class="buttons">
<a href="javascript:void(0);" onClick="deleteComment(${co.comment_id})" class="">${_('Delete')}</a>
<span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-button-small">${_('Delete')}</span>
${h.rst(co.text)|n}
\ No newline at end of file
Status change: