add comments to commit
This commit is contained in:
parent
ed00ea0752
commit
10c28be905
|
@ -1,9 +1,13 @@
|
|||
commentService = ($http) ->
|
||||
getPath = (kind, project, commentable, id) ->
|
||||
if kind is 'remove' or kind is 'update'
|
||||
if (kind is 'remove' or kind is 'update') and commentable.kind is 'issue'
|
||||
return Routes.project_issue_comment_path(project, commentable.id, id)
|
||||
else if kind is 'add'
|
||||
else if kind is 'add' and commentable.kind is 'issue'
|
||||
return Routes.project_issue_comments_path(project, commentable.id)
|
||||
else if (kind is 'remove' or kind is 'update') and commentable.kind is 'commit'
|
||||
return Routes.project_commit_comment_path(project, commentable.id, id)
|
||||
else if kind is 'add' and commentable.kind is 'commit'
|
||||
return Routes.project_commit_comments_path(project, commentable.id)
|
||||
|
||||
{
|
||||
add: (project, commentable, body) ->
|
||||
|
@ -24,7 +28,7 @@ commentService = ($http) ->
|
|||
update: (project, commentable, id) ->
|
||||
path = getPath('update', project, commentable, id)
|
||||
params = { comment: { body: $('#comment-'+id+'-body').val() }}
|
||||
$http.put(path, params)
|
||||
$http.patch(path, params)
|
||||
|
||||
remove: (project, commentable, id) ->
|
||||
path = getPath('remove', project, commentable, id)
|
||||
|
|
|
@ -170,7 +170,7 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro
|
|||
vm.commentable = commentable
|
||||
vm.processing = false
|
||||
vm.k = 10
|
||||
if commentable.kind is 'issue'
|
||||
if commentable.kind is 'issue' or commentable.kind is 'commit'
|
||||
list = $('#comments_list')
|
||||
else if commentable.kind is 'pull'
|
||||
list = $('#pull-activity')
|
||||
|
|
|
@ -17,7 +17,11 @@
|
|||
.both
|
||||
#repo-wrapper
|
||||
== render 'show'
|
||||
|
||||
- ctrl_params = "{ kind: 'commit', id: '#{@commit.id}' }"
|
||||
-comments = @comments.select {|c| c.data.blank? } # dont work @comments.where(data: nil)
|
||||
div[ ng-controller = 'CommentsController as commentsCtrl'
|
||||
ng-init = "commentsCtrl.init('#{@project.name_with_owner}', #{ctrl_params})" ]
|
||||
== render "projects/comments/list", list: comments, project: @project, commentable: @commit
|
||||
== render "projects/comments/add", project: @project, commentable: @commit if current_user
|
||||
|
||||
|
|
Loading…
Reference in New Issue